diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index bdae802..f5e4284 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -1,6 +1,6 @@
const install = (Vue, vm) => {
Vue.prototype.$u.http.setConfig({
- baseUrl: 'http://192.168.2.243:3100/dev-api',
+ baseUrl: 'http://192.168.2.17:3100/dev-api',
// baseUrl: 'https://znb.ccttiot.com',
loadingText: '努力加载中~',
loadingTime: 800,
diff --git a/page_user/hezuo/index.vue b/page_user/hezuo/index.vue
index a726edf..d6d8045 100644
--- a/page_user/hezuo/index.vue
+++ b/page_user/hezuo/index.vue
@@ -13,7 +13,7 @@
验证码
- 获取验证码
+ {{yzm}}
@@ -37,7 +37,7 @@
background: '#25CE88'
},
show: false,
- tit:'请选择您的合作意向',
+ tit: '请选择您的合作意向',
list: [{
value: '1',
label: '成为充电合作商'
@@ -51,16 +51,61 @@
label: '贴牌OEM'
}
],
+ yzm: '获取验证码',
+ countdown: 0, // 倒计时变量
+ countdownInterval: null, // 倒计时间隔ID
}
},
methods: {
btnxz() {
- this.show = true
+ this.show = true
},
- confirm(e){
+ confirm(e) {
this.tit = e[0].label
- }
- }
+ },
+ hqyzm() {
+ if(this.yzm == '获取验证码'){
+ uni.showToast({
+ title: '验证码已发送',
+ icon: 'success',
+ duration: 2000
+ });
+ // 清除之前的定时器
+ this.clearCountdown();
+ // 开始新的倒计时
+ this.startCountdown();
+ }else{
+ uni.showToast({
+ title: '验证码已发送',
+ icon: 'none',
+ duration: 2000
+ });
+ }
+ },
+ startCountdown() {
+ this.yzm = '60秒';
+ this.countdown = 60;
+ this.countdownInterval = setInterval(() => {
+ if (this.countdown > 0) {
+ this.countdown--;
+ this.yzm = this.countdown + '秒';
+ } else {
+ this.clearCountdown();
+ this.yzm = '获取验证码';
+ }
+ }, 1000);
+ },
+ clearCountdown() {
+ if (this.countdownInterval) {
+ clearInterval(this.countdownInterval);
+ this.countdownInterval = null;
+ }
+ },
+ },
+ beforeDestroy() {
+ // 在组件销毁前清除定时器
+ this.clearCountdown();
+ },
}
diff --git a/page_user/shopedit.vue b/page_user/shopedit.vue
index 57ae2ce..4417f81 100644
--- a/page_user/shopedit.vue
+++ b/page_user/shopedit.vue
@@ -2,43 +2,81 @@
-
-
-
- 店铺名称
-
-
- 店铺类型
+
+
+
+ 店铺名称
+
+
+
+ 店铺类型
+
- 营业时间
+ 营业时间
+
+ {{ksyy}}
+ --
+ {{jsyy}}
+
-
- 省市区
+
+ 省市区
+
+
+
+ 联系人
+
+
+
+ 联系电话
+
-
- 经纬度
-
-
-
-
+ 经纬度
+
+
+
+
- 详细地址
+ 详细地址
+
-
- 联系人
+
+
+
+
+ 上传门头照
+
+
+ 门头照片必须清晰、方正、易于辨识
+
+
+
+
+
+
-
- 联系电话
+
+ 确定修改
-
- 保存修改
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -46,18 +84,291 @@
export default {
data() {
return {
-
+ params: {
+ hour: true,
+ minute: true,
+ },
+ show: false,
+ imglist: '',
+ token: '',
+ userImgs: '',
+ imgflag: true,
+ selectorshow: false,
+ selectortext: '请选择商铺类型',
+ selectorvalue: '',
+ regionshow: false,
+ regiontext: '请选择省市区',
+ regionvalue: '',
+ selector: [{
+ value: 1,
+ label: '商场'
+ },
+ {
+ value: 2,
+ label: '学校'
+ },
+ {
+ value: 3,
+ label: '娱乐场所'
+ },
+ {
+ value: 4,
+ label: '出租房'
+ },
+ {
+ value: 5,
+ label: '其他'
+ },
+ ],
+ latitude: '请输入纬度',
+ longitude: '请输入经度',
+ shopname: '',
+ yetime: '',
+ lxname: '',
+ lxphone: '',
+ xqdz: '',
+ ksyy:'开始营业时间',
+ jsyy:'结束营业时间',
+ yynum:0,
+ province:'',
+ city:'',
+ area:'',
+ listobj:{},
+ storeId:''
}
},
+ onLoad(option) {
+ let obj = JSON.parse(option.obj)
+ this.listobj = obj
+ console.log(this.listobj);
+ this.shopname = this.listobj.name
+ this.ksyy = this.listobj.businessTimeStart
+ this.jsyy = this.listobj.businessTimeEnd
+ this.regiontext = this.listobj.province + this.listobj.city + this.listobj.county
+ this.lxname = this.listobj.contactName
+ this.lxphone = this.listobj.contactMobile
+ this.latitude = this.listobj.lat
+ this.longitude = this.listobj.lng
+ this.xqdz = this.listobj.address
+ this.selectorvalue = this.listobj.type
+ this.imglist = this.listobj.picture
+ this.province = this.listobj.province
+ this.city = this.listobj.city
+ this.area = this.listobj.county
+ this.storeId = this.listobj.storeId
+ if(this.selectorvalue == 1){
+ this.selectortext = '商场'
+ }else if(this.selectorvalue == 2){
+ this.selectortext = '学校'
+ }else if(this.selectorvalue == 3){
+ this.selectortext = '娱乐场所'
+ }else if(this.selectorvalue == 4){
+ this.selectortext = '出租房'
+ }else{
+ this.selectortext = '其他'
+ }
+ this.getQiniuToken()
+ },
methods: {
+ btnyinye(num){
+ this.show = true
+ this.yynum = num
+ },
+ btnyy(e){
+ if(this.yynum == 1){
+ this.ksyy = e.hour + ':' + e.minute
+ }else{
+ this.jsyy = e.hour + ':' + e.minute
+ }
+ },
+ btncreat() {
+ let phoneRegex = /^1[3-9]\d{9}$/ //判断手机号码格式
+ if (this.shopname == '') {
+ uni.showToast({
+ title: '请输入店铺名称',
+ icon: 'none',
+ duration: 1000
+ });
+ } else if (this.selectortext == '请选择商铺类型') {
+ uni.showToast({
+ title: '请选择商铺类型',
+ icon: 'none',
+ duration: 1000
+ });
+ } else if (this.ksyy == '开始营业时间') {
+ uni.showToast({
+ title: '请选择开始营业时间',
+ icon: 'none',
+ duration: 2000
+ });
+ } else if (this.jsyy == '结束营业时间') {
+ uni.showToast({
+ title: '请选择结束营业时间',
+ icon: 'none',
+ duration: 2000
+ });
+ } else if (this.regiontext == '请选择省市区') {
+ uni.showToast({
+ title: '请选择省市区',
+ icon: 'none',
+ duration: 1000
+ });
+ } else if (this.lxname == '') {
+ uni.showToast({
+ title: '请输入联系人',
+ icon: 'none',
+ duration: 1000
+ });
+ } else if (this.lxphone == '') {
+ uni.showToast({
+ title: '请输入联系电话',
+ icon: 'none',
+ duration: 1000
+ });
+ } else if (this.latitude == '请输入纬度') {
+ uni.showToast({
+ title: '请输入纬度',
+ icon: 'none',
+ duration: 1000
+ });
+ } else if (this.longitude == '请输入经度') {
+ uni.showToast({
+ title: '请输入经度',
+ icon: 'none',
+ duration: 1000
+ });
+ }else if (this.xqdz == '') {
+ uni.showToast({
+ title: '请输入详细地址',
+ icon: 'none',
+ duration: 1000
+ });
+ } else if (this.imglist == '') {
+ uni.showToast({
+ title: '请上传一张商铺门面照',
+ icon: 'none',
+ duration: 1000
+ });
+ } else {
+ let data = {
+ name: this.shopname,
+ picture: this.imglist,
+ address: this.xqdz,
+ lng: this.longitude,
+ lat: this.latitude,
+ businessTimeStart:this.ksyy,
+ businessTimeEnd:this.jsyy,
+ province:this.province,
+ city:this.city,
+ county:this.area,
+ specificAddress:this.xqdz,
+ contactName:this.lxname,
+ contactMobile:this.lxphone,
+ type:this.selectorvalue,
+ storeId:this.storeId
+ }
+ this.$u.put("/app/store",data).then(res => {
+ if (res.code == 500) {
+ uni.showToast({
+ title: 'res.msg',
+ icon: 'success',
+ duration: 1000
+ })
+ }else{
+ uni.showToast({
+ title: '修改成功',
+ icon: 'success',
+ duration: 1000
+ })
+ setTimeout(()=>{
+ uni.navigateBack({
+ delta: 2
+ })
+ },1000)
+ }
+ })
+ }
+ },
+ btnlx() {
+ this.selectorshow = true
+ },
+ btnselector(e) {
+ this.selectorvalue = e[0].value
+ this.selectortext = e[0].label
+ },
+ btnregion() {
+ this.regionshow = true
+ },
+ btnregions(e) {
+ this.regiontext = e.province.label + e.city.label + e.area.label
+ this.province = e.province.label
+ this.city = e.city.label
+ this.area = e.area.label
+ },
+ btnjwd() {
+ uni.chooseLocation({
+ success: (res) => {
+ this.latitude = res.latitude;
+ this.longitude = res.longitude;
+ },
+ fail: function(err) {
+ console.log('选择位置失败', err);
+ },
+ complete: (res) => {
+ if (res.errMsg === 'chooseLocation:ok') {
+ } else if (res.errMsg.indexOf('chooseLocation:cancel') === 0) {
+ uni.showToast({
+ title: '您取消了位置选择',
+ icon: 'none'
+ });
+ }
+ }
+ });
+ },
+
+
+ getQiniuToken() {
+ this.$u.get("/common/qiniu/uploadInfo").then((res) => {
+ if (res.code == 200) {
+ this.token = res.token
+ }
+ });
+ },
+ btn() {
+ let _this = this
+ let math = 'static/' + _this.$u.guid(20)
+ uni.chooseImage({
+ count: 1,
+ type: 'all',
+ success(res) {
+ const tempFilePaths = res.tempFiles
+ wx.uploadFile({
+ url: 'https://up-z2.qiniup.com',
+ name: 'file',
+ filePath: tempFilePaths[0].path,
+ formData: {
+ token: _this.token, //后端返回的token
+ key: 'smartmeter/img/' + math
+ },
+ success: function(res) {
+ let str = JSON.parse(res.data)
+ console.log(str.key)
+ _this.userImgs = 'https://api.ccttiot.com/' + str.key
+ _this.imglist = _this.userImgs
+ _this.imgflag = false
+ }
+ });
+ }
+ })
+ },
}
}