From 96aeb2a232d85306ced2061f024a2ff491a92ff7 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期四, 25 七月 2024 17:47:12 +0800 Subject: [PATCH] fix bug --- sub_pages/customer/trade/list.vue | 2 common/self.scss | 4 sub_pages/customer/shopping/shopping.vue | 286 +++--- pages/user/user-info/user-info.vue | 2 pages.json | 21 store/index.js | 4 sub_pages/partner/partner-info/partner-info.vue | 2 pages/login/supplier-login.vue | 877 ++++++++++---------- pages/home/components/home-price.vue | 12 pages/login/supplier-reg.vue | 930 ++++++++++---------- sub_pages/customer/shopping/confirm.vue | 16 sub_pages/customer/customer-info/customer-info.vue | 373 ++++++++ pages/home/components/home-category.vue | 2 pages/user/supplier-user.vue | 16 14 files changed, 1,473 insertions(+), 1,074 deletions(-) diff --git a/common/self.scss b/common/self.scss index 31c6db8..a4e635b 100644 --- a/common/self.scss +++ b/common/self.scss @@ -237,7 +237,9 @@ .m-r-80 { margin-right: 160rpx; } - +.m-b-12{ + margin-bottom: 24rpx; +} .m-b-20 { margin-bottom: 40rpx; } diff --git a/pages.json b/pages.json index 3d9a2b1..82e365e 100644 --- a/pages.json +++ b/pages.json @@ -36,8 +36,6 @@ } }, // #endif - - // #ifdef PUB_SUPPLIER { "path": "pages/login/supplier-reg", "style": { @@ -45,16 +43,6 @@ "navigationStyle": "custom" } }, - // #endif - - // #ifdef PUB_PARTNER - { - "path": "pages/login/supplier-reg", - "style": { - "navigationBarTitleText": "申请入驻" - } - }, - // #endif { "path": "pages/user/supplier-user", "style": { @@ -217,8 +205,13 @@ "root": "sub_pages/customer", "pages": [ // #ifdef PUB_CUSTOMER - - + { + "path": "customer-info/customer-info", + "style": { + "navigationBarTitleText": "信息维护", + "enablePullDownRefresh": false + } + }, { "path": "trade/trade", "style": { diff --git a/pages/home/components/home-category.vue b/pages/home/components/home-category.vue index c16284c..910cc73 100644 --- a/pages/home/components/home-category.vue +++ b/pages/home/components/home-category.vue @@ -38,7 +38,7 @@ methods: { toList(item){ uni.navigateTo({ - url:'//sub_pages/customer/trade/list?categoryId='+item.id + url:'/sub_pages/customer/trade/list?categoryId='+item.id }) } }, diff --git a/pages/home/components/home-price.vue b/pages/home/components/home-price.vue index 779db45..04bd06e 100644 --- a/pages/home/components/home-price.vue +++ b/pages/home/components/home-price.vue @@ -9,7 +9,7 @@ <view class="item flex1"> <view class="title">{{list1[0]&&list1[0].name||''}}</view> <view class="price"> - {{list1[0]&&list1[0].avePrice||''}} + {{list1[0]&&list1[0].avePrice||'-'}} </view> <view class="flex desc" v-if="list1[0]"> <view class="m-l-a m-r-a">{{list1[0]&&list1[0].avePriceDifference<0?'-':'+'}}{{list1[0]&&list1[0].avePriceDifference||''}}</view> @@ -20,7 +20,7 @@ <view class="item flex1"> <view class="title">{{list1[1]&&list1[1].name||''}}</view> <view class="price"> - {{list1[1]&&list1[1].avePrice||''}} + {{list1[1]&&list1[1].avePrice||'-'}} </view> <view class="flex desc" v-if="list1[1]"> <view class="m-l-a m-r-a">{{list1[1]&&list1[1].avePriceDifference<0?'-':'+'}}{{list1[1]&&list1[1].avePriceDifference||''}}</view> @@ -31,7 +31,7 @@ <view class="item flex1"> <view class="title">{{list1[2]&&list1[2].name||''}}</view> <view class="price"> - {{list1[2]&&list1[2].avePrice||''}} + {{list1[2]&&list1[2].avePrice||'-'}} </view> <view class="flex desc" v-if="list1[2]"> <view class="m-l-a m-r-a">{{list1[2]&&list1[2].avePriceDifference<0?'-':'+'}}{{list1[2]&&list1[2].avePriceDifference||''}}</view> @@ -44,7 +44,7 @@ <view class="item flex1"> <view class="title">{{list2[0]&&list2[0].name||''}}</view> <view class="price"> - {{list2[0]&&list2[0].avePrice||''}} + {{list2[0]&&list2[0].avePrice||'-'}} </view> <view class="flex desc" v-if="list2[0]"> <view class="m-l-a m-r-a">{{list2[0]&&list2[0].avePriceDifference<0?'-':'+'}}{{list2[0]&&list2[0].avePriceDifference||''}}</view> @@ -55,7 +55,7 @@ <view class="item flex1"> <view class="title">{{list2[1]&&list2[1].name||''}}</view> <view class="price"> - {{list2[1]&&list2[1].avePrice||''}} + {{list2[1]&&list2[1].avePrice||'-'}} </view> <view class="flex desc" v-if="list2[1]"> <view class="m-l-a m-r-a">{{list2[1]&&list2[1].avePriceDifference<0?'-':'+'}}{{list2[1]&&list2[1].avePriceDifference||''}}</view> @@ -66,7 +66,7 @@ <view class="item flex1"> <view class="title">{{list2[2]&&list2[2].name||''}}</view> <view class="price"> - {{list2[2]&&list2[2].avePrice||''}} + {{list2[2]&&list2[2].avePrice||'-'}} </view> <view class="flex desc" v-if="list2[2]"> <view class="m-l-a m-r-a">{{list2[2]&&list2[2].avePriceDifference<0?'-':'+'}}{{list2[2]&&list2[2].avePriceDifference||''}}</view> diff --git a/pages/login/supplier-login.vue b/pages/login/supplier-login.vue index 427b37b..2806c85 100644 --- a/pages/login/supplier-login.vue +++ b/pages/login/supplier-login.vue @@ -1,487 +1,498 @@ <template> - <view class="main-container login-container img100 relative" style="margin-top: 0rpx;"> - <!-- background-image:url('@/static/images/supplier/login/bg.png') --> + <view class="main-container login-container img100 relative" style="margin-top: 0rpx;"> + <!-- background-image:url('@/static/images/supplier/login/bg.png') --> - <image class="component-bg" - src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/a5/a54508de179a4942918ecb2c5a4aa9f5bg.png" - mode="scaleToFill" /> - <view class="t-login top-bg"> - <view class="nav-title">登录</view> - <view class="login"> - <form class="cl"> - <view class="t-a titles-top"> - <view class="title-1">HELLO</view> - <view class="title-2">欢迎登录<span class="title-3">花满芫</span> - <!-- #ifdef PUB_SUPPLIER --> - <span>供应商管理平台</span> - <!-- #endif --> - <!-- #ifdef PUB_PARTNER --> - <span>合伙人管理平台</span> - <!-- #endif --> - </view> - </view> - <view class="t-a input form-input" v-if="loginType=='pwd'"> - <!-- <input type="text" name="userName" placeholder="请输入账号" v-model="userName" /> --> - <u-input placeholder="请输入账号" :border="false" v-model="userName"></u-input> + <image class="component-bg" + src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/a5/a54508de179a4942918ecb2c5a4aa9f5bg.png" + mode="scaleToFill"/> + <view class="t-login top-bg"> + <view class="nav-title">登录</view> + <view class="login"> + <form class="cl"> + <view class="t-a titles-top"> + <view class="title-1">HELLO</view> + <view class="title-2">欢迎登录<span class="title-3">花满芫</span> + <!-- #ifdef PUB_SUPPLIER --> + <span>供应商管理平台</span> + <!-- #endif --> + <!-- #ifdef PUB_PARTNER --> + <span>合伙人管理平台</span> + <!-- #endif --> + </view> + </view> + <view class="t-a input form-input" v-if="loginType=='pwd'"> + <!-- <input type="text" name="userName" placeholder="请输入账号" v-model="userName" /> --> + <u-input placeholder="请输入账号" :border="false" v-model="userName"></u-input> - </view> - <view class="t-a input form-input" v-if="loginType=='pwd'"> - <!-- <input type="text" :password="true" name="password" placeholder="请输入密码" v-model="password" /> --> - <u-input :password="true" :border="false" placeholder="请输入密码" v-model="password"></u-input> - </view> - <view class="t-a input form-input" v-if="loginType=='code'"> + </view> + <view class="t-a input form-input" v-if="loginType=='pwd'"> + <!-- <input type="text" :password="true" name="password" placeholder="请输入密码" v-model="password" /> --> + <u-input :password="true" :border="false" placeholder="请输入密码" v-model="password"></u-input> + </view> + <view class="t-a input form-input" v-if="loginType=='code'"> - <!-- <input type="text" name="userName" placeholder="请输入手机号" v-model="phoneNumber" /> - <view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()"> - {{getCodeText}} - </view> --> - <u-input placeholder="请输入手机号" :border="false" v-model="phoneNumber"> - <template slot="suffix"> - <view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()"> - {{getCodeText}} - </view> - </template> - </u-input> - </view> + <!-- <input type="text" name="userName" placeholder="请输入手机号" v-model="phoneNumber" /> + <view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()"> + {{getCodeText}} + </view> --> + <u-input placeholder="请输入手机号" :border="false" v-model="phoneNumber"> + <template slot="suffix"> + <view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()"> + {{ getCodeText }} + </view> + </template> + </u-input> + </view> - <view class="t-a form-input" v-if="loginType=='code'"> - <!-- <input type="text" name="userName" placeholder="请输入手机验证码" v-model="smsCode" /> --> - <u-input placeholder="请输入手机验证码" :border="false" v-model="smsCode"></u-input> + <view class="t-a form-input" v-if="loginType=='code'"> + <!-- <input type="text" name="userName" placeholder="请输入手机验证码" v-model="smsCode" /> --> + <u-input placeholder="请输入手机验证码" :border="false" v-model="smsCode"></u-input> - </view> + </view> - <button @tap="login()" class="bottom-button">登 录</button> + <button @tap="login()" class="bottom-button">登 录</button> - <view class="flex"> - <view class="topic-font" v-if="loginType=='pwd'" @click="loginType='code'">手机验证码登录</view> - <view class="topic-font" v-if="loginType=='code'" @click="loginType='pwd'">账号密码登录</view> + <view class="flex"> + <view class="topic-font" v-if="loginType=='pwd'" @click="loginType='code'">手机验证码登录</view> + <view class="topic-font" v-if="loginType=='code'" @click="loginType='pwd'">账号密码登录</view> - <!-- #ifndef PUB_CUSTOMER --> - <view class="topic-font m-l-a m-r-0" @click="toReg">前往注册</view> + <view class="topic-font m-l-a m-r-0" @click="toReg">前往注册</view> - <!-- #endif --> - </view> - </form> - </view> - </view> - </view> + <!-- #ifdef PUB_CUSTOMER --> + <view class="topic-font m-l-a m-r-0" @click="toHome">返回首页</view> + <!-- #endif --> + </view> + + </form> + </view> + </view> + </view> </template> <script> - // import util from '@/utils/util.js' - // import gzmzApi from '@/api/gzmzApi.js' - // import myCache from '@/utils/myCache.js' - export default { - // props: { - // // apitype: 'loginSupplier', - // apitype: { - // type: String, - // default () { - // // #ifdef PUB_SUPPLIER - // return 'loginSupplier' - // // #endif - // // #ifdef PUB_PARTNER - // return 'loginPartner' - // // #endif - // // #ifdef PUB_CUSTOMER - // return 'loginCustomer' - // // #endif - // // return 'loginPartner' - // } - // }, - // }, - data() { - return { - openId: '-1', - userName: '', - password: '', - // userName: '', - // password: '', +// import util from '@/utils/util.js' +// import gzmzApi from '@/api/gzmzApi.js' +// import myCache from '@/utils/myCache.js' +export default { + // props: { + // // apitype: 'loginSupplier', + // apitype: { + // type: String, + // default () { + // // #ifdef PUB_SUPPLIER + // return 'loginSupplier' + // // #endif + // // #ifdef PUB_PARTNER + // return 'loginPartner' + // // #endif + // // #ifdef PUB_CUSTOMER + // return 'loginCustomer' + // // #endif + // // return 'loginPartner' + // } + // }, + // }, + data() { + return { + openId: '-1', + userName: '', + password: '', + // userName: '', + // password: '', - phoneNumber: '', - smsCode: '', + phoneNumber: '', + smsCode: '', - checked: false, - loginType: 'pwd', //pwd和code,密码和验证码登录 - pcfvalue: undefined, - getCodeText: '获取验证码', - getCodeBtnColor: "#20613D", - getCodeisWaiting: false, - Timer: undefined, - // #ifdef PUB_SUPPLIER - apitype: 'loginSupplier', - // #endif - // #ifdef PUB_PARTNER - apitype: 'loginPartner', - // #endif - // #ifdef PUB_CUSTOMER - apitype: 'loginCustomer', - // #endif - // return 'loginPartner' - }; - }, - methods: { - async getCode() { - console.log('getCode') - uni.hideKeyboard() //隐藏已经显示的软键盘,如果软键盘没有显示则不做任何操作。 - if (this.getCodeisWaiting) { - return; - } - if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))) { //校验手机号码是否有误 - this.$message.showToast('请填写正确手机号码') - return false; - } - this.getCodeText = "发送中..." //发送验证码 - this.getCodeisWaiting = true; - this.getCodeBtnColor = "#000" //追加样式,修改颜色 - //示例用定时器模拟请求效果 - //setTimeout(()用于在指定的毫秒数后调用函数或计算表达式 - const { - code - } = await this.$http.request('post', '/api/sms/send/code', { - data: { - tel: this.phoneNumber, - userType: this.apitype.replace("login", "").toLowerCase() - } - }) - if (code == 0) { - uni.showToast({ - title: '验证码已发送', - icon: "none" - }); - this.setTimer(); //调用定时器方法 - } else { - this.getCodeText = "获取验证码" //发送验证码 - this.getCodeisWaiting = false; - this.getCodeBtnColor = "#20613D"; - } - // setTimeout(() => { - // uni.showToast({ - // title: '验证码已发送', - // icon: "none" - // }); //弹出提示框 - // //示例默认1234,生产中请删除这一句。 - // // this.code = '1234'; //发送验证码,进行填入 - // this.setTimer(); //调用定时器方法 - // }, 1000) - }, - //setTimer: 需要每隔一段时间执行一件事的的时候就需要使用SetTimer函数 - setTimer() { - let holdTime = 60; //定义变量并赋值 - this.getCodeText = "重新获取(60)" - //setInterval()是一个实现定时调用的函数,可按照指定的周期(以毫秒计)来调用函数或计算表达式。 - //setInterval方法会不停地调用函数,直到 clearInterval被调用或窗口被关闭。 - this.Timer = setInterval(() => { - if (holdTime <= 0) { - this.getCodeisWaiting = false; - this.getCodeBtnColor = "#20613D"; - this.getCodeText = "获取验证码" - clearInterval(this.Timer); //清除该函数 - return; //返回前面 - } - this.getCodeText = "重新获取(" + holdTime + ")" - holdTime--; - }, 1000) - }, - toReg() { - // uni.switchTab({ - // url: '/pages/index/index' - // }) - var addstr = '' - // #ifdef PUB_PARTNER - addstr = '?source=step' - uni.navigateTo({ - url: '/sub_pages/partner/partner-info/partner-info' + addstr - }) - // #endif - // #ifdef PUB_SUPPLIER - uni.redirectTo({ - url: '/pages/login/supplier-reg' - }) - // #endif + checked: false, + loginType: 'pwd', //pwd和code,密码和验证码登录 + pcfvalue: undefined, + getCodeText: '获取验证码', + getCodeBtnColor: "#20613D", + getCodeisWaiting: false, + Timer: undefined, + // #ifdef PUB_SUPPLIER + apitype: 'loginSupplier', + // #endif + // #ifdef PUB_PARTNER + apitype: 'loginPartner', + // #endif + // #ifdef PUB_CUSTOMER + apitype: 'loginCustomer', + // #endif + // return 'loginPartner' + }; + }, + methods: { + async getCode() { + console.log('getCode') + uni.hideKeyboard() //隐藏已经显示的软键盘,如果软键盘没有显示则不做任何操作。 + if (this.getCodeisWaiting) { + return; + } + if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))) { //校验手机号码是否有误 + this.$message.showToast('请填写正确手机号码') + return false; + } + this.getCodeText = "发送中..." //发送验证码 + this.getCodeisWaiting = true; + this.getCodeBtnColor = "#000" //追加样式,修改颜色 + //示例用定时器模拟请求效果 + //setTimeout(()用于在指定的毫秒数后调用函数或计算表达式 + const { + code + } = await this.$http.request('post', '/api/sms/send/code', { + data: { + tel: this.phoneNumber, + userType: this.apitype.replace("login", "").toLowerCase() + } + }) + if (code == 0) { + uni.showToast({ + title: '验证码已发送', + icon: "none" + }); + this.setTimer(); //调用定时器方法 + } else { + this.getCodeText = "获取验证码" //发送验证码 + this.getCodeisWaiting = false; + this.getCodeBtnColor = "#20613D"; + } + // setTimeout(() => { + // uni.showToast({ + // title: '验证码已发送', + // icon: "none" + // }); //弹出提示框 + // //示例默认1234,生产中请删除这一句。 + // // this.code = '1234'; //发送验证码,进行填入 + // this.setTimer(); //调用定时器方法 + // }, 1000) + }, + //setTimer: 需要每隔一段时间执行一件事的的时候就需要使用SetTimer函数 + setTimer() { + let holdTime = 60; //定义变量并赋值 + this.getCodeText = "重新获取(60)" + //setInterval()是一个实现定时调用的函数,可按照指定的周期(以毫秒计)来调用函数或计算表达式。 + //setInterval方法会不停地调用函数,直到 clearInterval被调用或窗口被关闭。 + this.Timer = setInterval(() => { + if (holdTime <= 0) { + this.getCodeisWaiting = false; + this.getCodeBtnColor = "#20613D"; + this.getCodeText = "获取验证码" + clearInterval(this.Timer); //清除该函数 + return; //返回前面 + } + this.getCodeText = "重新获取(" + holdTime + ")" + holdTime--; + }, 1000) + }, + toHome(){ + uni.redirectTo({ + url: '/pages//pages/home/home' + }) + }, + toReg() { + // uni.switchTab({ + // url: '/pages/index/index' + // }) + var addstr = '' + // #ifdef PUB_PARTNER + addstr = '?source=step' + uni.navigateTo({ + url: '/sub_pages/partner/partner-info/partner-info' + addstr + }) + // #endif + // #ifdef PUB_SUPPLIER + uni.redirectTo({ + url: '/pages/login/supplier-reg' + }) + // #endif + // #ifdef PUB_CUSTOMER + addstr = '?source=step' + uni.navigateTo({ + url: '/sub_pages/customer/customer-info/customer-info' + addstr + }) + // #endif + }, + changeAll(e) { + this.pcfvalue = e.detail.value[0] + }, + async login() { + uni.showLoading({ + title: '登陆中' + }); + var that = this; + if (this.loginType == 'pwd') { + if (!that.userName) { + uni.showToast({ + title: '请输入用户名', + icon: 'none' + }); + return; + } + if (!that.password) { + uni.showToast({ + title: '请输入密码', + icon: 'none' + }); + return; + } + } + if (this.loginType == 'code') { + if (!that.phoneNumber) { + uni.showToast({ + title: '请输入手机号', + icon: 'none' + }); + return; + } + if (!that.smsCode) { + uni.showToast({ + title: '请输入手机验证码', + icon: 'none' + }); + return; + } + } + // if (this.pcfvalue == undefined) { + // util.showMyToast('必须勾选《用户服务协议》及《隐私政策》'); + // return; + // } + let post = { + username: this.userName, + password: this.password, + tel: this.phoneNumber, + smsCode: this.smsCode + // openId: '123456789' + } + // const { + // code + // } = await this.$http.request('get', '/api/login/admin') + const resp = await this.$store.dispatch(this.apitype, post); + // uni.hideLoading() + if (resp.code === 0) { - }, - changeAll(e) { - this.pcfvalue = e.detail.value[0] - }, - async login() { - uni.showLoading({ - title: '登陆中' - }); - var that = this; - if (this.loginType == 'pwd') { - if (!that.userName) { - uni.showToast({ - title: '请输入用户名', - icon: 'none' - }); - return; - } - if (!that.password) { - uni.showToast({ - title: '请输入密码', - icon: 'none' - }); - return; - } - } - if (this.loginType == 'code') { - if (!that.phoneNumber) { - uni.showToast({ - title: '请输入手机号', - icon: 'none' - }); - return; - } - if (!that.smsCode) { - uni.showToast({ - title: '请输入手机验证码', - icon: 'none' - }); - return; - } - } - // if (this.pcfvalue == undefined) { - // util.showMyToast('必须勾选《用户服务协议》及《隐私政策》'); - // return; - // } - let post = { - username: this.userName, - password: this.password, - tel: this.phoneNumber, - smsCode: this.smsCode - // openId: '123456789' - } - // const { - // code - // } = await this.$http.request('get', '/api/login/admin') - const resp = await this.$store.dispatch(this.apitype, post); - // uni.hideLoading() + // myCache.cache("userToken", res.data.accessToken) + // let userRes = await gzmzApi.getMemberInfo(); + // if (userRes.status) { + // myCache.cache("userInfo", JSON.stringify(userRes.data)) + // } + // setTimeout(() => { + // uni.navigateBack(); + // }, 1000); - if (resp.code == 0) { + } else { + // uni.showToast({ + // title: '登录失败!', + // icon: 'none' + // }); + return; + } - // myCache.cache("userToken", res.data.accessToken) - // let userRes = await gzmzApi.getMemberInfo(); - // if (userRes.status) { - // myCache.cache("userInfo", JSON.stringify(userRes.data)) - // } - // setTimeout(() => { - // uni.navigateBack(); - // }, 1000); - - } else { - // uni.showToast({ - // title: '登录失败!', - // icon: 'none' - // }); - return; - } - - }, - tc1(id) { - uni.navigateTo({ - url: '/pages/users/xieyi?id=' + id, - }); - } - } - }; + }, + tc1(id) { + uni.navigateTo({ + url: '/pages/users/xieyi?id=' + id, + }); + } + } +}; </script> <style lang="scss" scoped> - .form-input { - background-color: #f8f7fc; - border-radius: 50rpx; - margin-bottom: 50rpx; - border: 1px solid #e9e9e9; +.form-input { + background-color: #f8f7fc; + border-radius: 50rpx; + margin-bottom: 50rpx; + border: 1px solid #e9e9e9; - /deep/ .u-input { - padding-left: 60rpx !important; - padding-right: 40rpx !important; - } + /deep/ .u-input { + padding-left: 60rpx !important; + padding-right: 40rpx !important; + } - /deep/ input { - height: 70rpx; - line-height: 70rpx; + /deep/ input { + height: 70rpx; + line-height: 70rpx; - } + } - } +} </style> <style lang="scss" scoped> - @import './login.scss'; +@import './login.scss'; - .main-container { - margin: 20px 0; - } +.main-container { + margin: 20px 0; +} - .img-a { - position: absolute; - width: 100%; - top: -150rpx; - right: 0; - } +.img-a { + position: absolute; + width: 100%; + top: -150rpx; + right: 0; +} - .img-b { - position: absolute; - width: 50%; - bottom: 0; - left: -120rpx; - } +.img-b { + position: absolute; + width: 50%; + bottom: 0; + left: -120rpx; +} - .to-home { - margin-top: 30rpx; - font-size: 30rpx; - color: #5af; - display: flex; - flex-direction: row-reverse; - } +.to-home { + margin-top: 30rpx; + font-size: 30rpx; + color: #5af; + display: flex; + flex-direction: row-reverse; +} - .t-login { - width: 100%; - margin: 0 auto; - font-size: 28rpx; - color: #000; - } +.t-login { + width: 100%; + margin: 0 auto; + font-size: 28rpx; + color: #000; +} - .t-login .bg { - width: 100%; - position: relative; - } +.t-login .bg { + width: 100%; + position: relative; +} - .t-login .login { - width: 650rpx; - margin: 60rpx auto; - margin-top: 0rpx; - font-size: 28rpx; - color: #000; - } +.t-login .login { + width: 650rpx; + margin: 60rpx auto; + margin-top: 0rpx; + font-size: 28rpx; + color: #000; +} - .t-login button { - font-size: 28rpx; - background: #5677fc; - color: #fff; - height: 90rpx; - line-height: 90rpx; - border-radius: 50rpx; - box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2); - } +.t-login button { + font-size: 28rpx; + background: #5677fc; + color: #fff; + height: 90rpx; + line-height: 90rpx; + border-radius: 50rpx; + box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2); +} - .t-login input { - padding: 0 20rpx 0 60rpx; - height: 90rpx; - line-height: 90rpx; - margin-bottom: 50rpx; - background: #f8f7fc; - border: 1px solid #e9e9e9; - font-size: 28rpx; - border-radius: 50rpx; - } +.t-login input { + padding: 0 20rpx 0 60rpx; + height: 90rpx; + line-height: 90rpx; + margin-bottom: 50rpx; + background: #f8f7fc; + border: 1px solid #e9e9e9; + font-size: 28rpx; + border-radius: 50rpx; +} - .t-login .t-a { - position: relative; +.t-login .t-a { + position: relative; - .get-code { - // position: absolute; - // right: 40rpx; - // top: 25rpx; - } - } + .get-code { + // position: absolute; + // right: 40rpx; + // top: 25rpx; + } +} - .t-login .t-a .icon { - width: 40rpx; - height: 40rpx; - position: absolute; - left: 24rpx; - top: 14rpx; - margin-right: 20rpx; - } +.t-login .t-a .icon { + width: 40rpx; + height: 40rpx; + position: absolute; + left: 24rpx; + top: 14rpx; + margin-right: 20rpx; +} - .t-login .t-a .line { - width: 2rpx; - height: 40rpx; - background-color: #dedede; - position: absolute; - top: 28rpx; - left: 98rpx; - } +.t-login .t-a .line { + width: 2rpx; + height: 40rpx; + background-color: #dedede; + position: absolute; + top: 28rpx; + left: 98rpx; +} - .t-login .t-b { - text-align: left; - font-size: 46rpx; - color: #000; - padding: 300rpx 0 30rpx 0; - font-weight: bold; - } +.t-login .t-b { + text-align: left; + font-size: 46rpx; + color: #000; + padding: 300rpx 0 30rpx 0; + font-weight: bold; +} - .t-login .t-b2 { - text-align: left; - font-size: 32rpx; - color: #aaaaaa; - padding: 0rpx 0 120rpx 0; - } +.t-login .t-b2 { + text-align: left; + font-size: 32rpx; + color: #aaaaaa; + padding: 0rpx 0 120rpx 0; +} - .t-login .t-c { - position: absolute; - right: 22rpx; - top: 22rpx; - background: #5677fc; - color: #fff; - font-size: 24rpx; - border-radius: 50rpx; - height: 50rpx; - line-height: 50rpx; - padding: 0 25rpx; - z-index: 999; - } +.t-login .t-c { + position: absolute; + right: 22rpx; + top: 22rpx; + background: #5677fc; + color: #fff; + font-size: 24rpx; + border-radius: 50rpx; + height: 50rpx; + line-height: 50rpx; + padding: 0 25rpx; + z-index: 999; +} - .t-login .t-d { - text-align: center; - color: #999; - margin: 80rpx 0; - } +.t-login .t-d { + text-align: center; + color: #999; + margin: 80rpx 0; +} - .t-login .t-e { - text-align: center; - width: 250rpx; - margin: 80rpx auto 0; - } +.t-login .t-e { + text-align: center; + width: 250rpx; + margin: 80rpx auto 0; +} - .t-login .t-g { - float: left; - width: 50%; - } +.t-login .t-g { + float: left; + width: 50%; +} - .t-login .t-e image { - width: 50rpx; - height: 50rpx; - } +.t-login .t-e image { + width: 50rpx; + height: 50rpx; +} - .t-login .t-f { - text-align: center; - margin: 200rpx 0 0 0; - color: #666; - } +.t-login .t-f { + text-align: center; + margin: 200rpx 0 0 0; + color: #666; +} - .t-login .t-f text { - margin-left: 20rpx; - color: #aaaaaa; - font-size: 27rpx; - } +.t-login .t-f text { + margin-left: 20rpx; + color: #aaaaaa; + font-size: 27rpx; +} - // .t-login .uni-input-placeholder { - // color: #000; - // } +// .t-login .uni-input-placeholder { +// color: #000; +// } - .cl { - zoom: 1; - } +.cl { + zoom: 1; +} - .cl:after { - clear: both; - display: block; - visibility: hidden; - height: 0; - content: '\20'; - } +.cl:after { + clear: both; + display: block; + visibility: hidden; + height: 0; + content: '\20'; +} </style> \ No newline at end of file diff --git a/pages/login/supplier-reg.vue b/pages/login/supplier-reg.vue index 0038663..48fcb9d 100644 --- a/pages/login/supplier-reg.vue +++ b/pages/login/supplier-reg.vue @@ -1,534 +1,546 @@ <template> - <view> - <view v-if="source==='step'" style="padding: 20rpx 0rpx;color: red;;background-color: #e6e6e6;"> - <view style="padding: 20rpx;text-align: center;background-color: #fff;">仅限花满芫合伙人入驻</view> - <view v-if="source==='step'" class="" style="background-color: #fff;margin-top: 20rpx;padding: 20rpx;"> - <u-steps current="1"> - <u-steps-item title="信息填写" class="u-steps-item"> - </u-steps-item> - <u-steps-item title="提交申请" class="u-steps-item"></u-steps-item> - </u-steps> - </view> - </view> - + <view> + <view v-if="source==='step'" style="padding: 20rpx 0rpx;color: red;;background-color: #e6e6e6;"> + <!-- #ifdef PUB_PARTNER --> + <view style="padding: 20rpx;text-align: center;background-color: #fff;">仅限花满芫合伙人入驻</view> + <!-- #endif -->e - <view class="main-container login-container img100 relative" style="margin-top: 0rpx;"> - <image class="component-bg" - src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/a5/a54508de179a4942918ecb2c5a4aa9f5bg.png" - mode="scaleToFill" /> + <view v-if="source==='step'" class="" style="background-color: #fff;margin-top: 20rpx;padding: 20rpx;"> + <u-steps current="1"> + <u-steps-item title="信息填写" class="u-steps-item"> + </u-steps-item> + <u-steps-item title="提交申请" class="u-steps-item"></u-steps-item> + </u-steps> + </view> + </view> - <view class="t-login top-bg"> + <view class="main-container login-container img100 relative" style="margin-top: 0rpx;"> + <image class="component-bg" + src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/a5/a54508de179a4942918ecb2c5a4aa9f5bg.png" + mode="scaleToFill"/> - <view class="nav-title" v-if="source!=='step'" :style="{'padding-top':source==='step'?'60rpx':'unset' + + <view class="t-login top-bg"> + + <view class="nav-title" v-if="source!=='step'" :style="{'padding-top':source==='step'?'60rpx':'unset' ,'padding-bottom':source==='step'?'80rpx':'unset'}"> - <view> - 注册 - </view> - </view> - <view class="login" style="padding-top: 40rpx;"> - <form class="cl"> - <view class="t-a titles-top"> - <view class="title-1">HELLO</view> - <view class="title-2">欢迎入驻<span class="title-3">花满芫</span></view> - </view> + <view> + 注册 + </view> + </view> + <view class="login" style="padding-top: 40rpx;"> + <form class="cl"> + <view class="t-a titles-top"> + <view class="title-1">HELLO</view> + <view class="title-2">欢迎入驻<span class="title-3">花满芫</span></view> + </view> - <view class="t-a form-input" v-if="loginType=='code'"> - <u-input placeholder="请输入手机号" :border="false" v-model="phoneNumber"> - <template slot="suffix"> - <view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()"> - {{getCodeText}} - </view> - </template> - </u-input> + <view class="t-a form-input" v-if="loginType=='code'"> + <u-input placeholder="请输入手机号" :border="false" v-model="phoneNumber"> + <template slot="suffix"> + <view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()"> + {{ getCodeText }} + </view> + </template> + </u-input> - <!-- <u-input type="text" name="userName" placeholder="请输入手机号" v-model="phoneNumber" - style="position: relative;z-index: 1;" /> --> + <!-- <u-input type="text" name="userName" placeholder="请输入手机号" v-model="phoneNumber" + style="position: relative;z-index: 1;" /> --> - </view> + </view> - <view class="t-a form-input" v-if="loginType=='code'"> - <!-- <input type="text" name="userName" placeholder="请输入手机验证码" v-model="smsCode" - style="position: relative;z-index: 1;" /> --> - <u-input placeholder="请输入手机验证码" :border="false" v-model="smsCode"></u-input> + <view class="t-a form-input" v-if="loginType=='code'"> + <!-- <input type="text" name="userName" placeholder="请输入手机验证码" v-model="smsCode" + style="position: relative;z-index: 1;" /> --> + <u-input placeholder="请输入手机验证码" :border="false" v-model="smsCode"></u-input> - </view> - <view class="t-a form-input" v-if="loginType=='code'"> - <!-- <input type="text" :password="true" name="password" placeholder="请输入密码" v-model="password" /> --> + </view> + <view class="t-a form-input" v-if="loginType=='code'"> + <!-- <input type="text" :password="true" name="password" placeholder="请输入密码" v-model="password" /> --> - <u-input :password="true" :border="false" placeholder="请输入密码" v-model="password"></u-input> - </view> + <u-input :password="true" :border="false" placeholder="请输入密码" v-model="password"></u-input> + </view> - <button @tap="login()" class="bottom-button">注 册</button> + <button @tap="login()" class="bottom-button">注 册</button> - <view class="flex"> - <view class="topic-font m-l-0 m-r-a" @click="backInfoPage" v-if="source==='step'">返回填写</view> - <view class="topic-font m-l-a m-r-0" @click="toLogin">前往登录</view> - </view> - <view class="flex flex-wrap-normal" - style="position: fixed;bottom: 40rpx;left: 40rpx;right: 40rpx;" v-if="false"> - <view :style="{'margin-top': '8rpx','margin-right': '12rpx','font-size':'24rpx'}" - @click="protocal=!protocal" class="component-radio" :class="[protocal?'cur':'']"> + <view class="flex"> + <view class="topic-font m-l-0 m-r-a" @click="backInfoPage" v-if="source==='step'">返回上一步</view> + <view class="topic-font m-l-a m-r-0" @click="toLogin">前往登录</view> - </view> - <view class="topic-gray" @click="toProtocol">请仔细阅读《花满芫合伙人供应商入口小程序隐私保护指引》如您同意该指引,请勾选开始使用本小程序 - </view> - </view> - </form> - </view> - </view> - </view> - </view> + </view> + <view class="flex flex-wrap-normal" + style="position: fixed;bottom: 40rpx;left: 40rpx;right: 40rpx;" v-if="false"> + <view :style="{'margin-top': '8rpx','margin-right': '12rpx','font-size':'24rpx'}" + @click="protocal=!protocal" class="component-radio" :class="[protocal?'cur':'']"> + + </view> + <view class="topic-gray" @click="toProtocol">请仔细阅读《花满芫合伙人供应商入口小程序隐私保护指引》如您同意该指引,请勾选开始使用本小程序 + </view> + </view> + </form> + </view> + </view> + </view> + </view> </template> <script> - // import util from '@/utils/util.js' - // import gzmzApi from '@/api/gzmzApi.js' - // import myCache from '@/utils/myCache.js' - export default { - data() { - return { - openId: '-1', +// import util from '@/utils/util.js' +// import gzmzApi from '@/api/gzmzApi.js' +// import myCache from '@/utils/myCache.js' +export default { + data() { + return { + openId: '-1', - userName: '', - password: '', + userName: '', + password: '', - phoneNumber: '', - smsCode: '', + phoneNumber: '', + smsCode: '', - checked: false, - loginType: 'code', //pwd和code,密码和验证码登录 - pcfvalue: undefined, - getCodeText: '获取验证码', - getCodeBtnColor: "#20613D", - getCodeisWaiting: false, - Timer: undefined, - protocal: false, - source: '', - // #ifdef PUB_SUPPLIER - apitype: 'supplier', - // #endif - // #ifdef PUB_PARTNER - apitype: 'partner', - // #endif + checked: false, + loginType: 'code', //pwd和code,密码和验证码登录 + pcfvalue: undefined, + getCodeText: '获取验证码', + getCodeBtnColor: "#20613D", + getCodeisWaiting: false, + Timer: undefined, + protocal: false, + source: '', + // #ifdef PUB_SUPPLIER + apitype: 'supplier', + // #endif + // #ifdef PUB_PARTNER + apitype: 'partner', + // #endif + // #ifdef PUB_CUSTOMER + apitype: 'customer', + // #endif - }; - }, - onLoad(options) { - this.source = options.source || '' - }, - methods: { - backInfoPage(){ - console.log('backInfoPage') - uni.navigateBack() - }, - toProtocol() { - uni.navigateTo({ - url: '/sub_pages/supplier/protocol' - }) - }, - async getCode() { - // await this.$message.confirm('是否同意入驻协议') - // this.protocal = true - console.log('getCode') - setTimeout(() => { - uni.hideKeyboard() //隐藏已经显示的软键盘,如果软键盘没有显示则不做任何操作。 - }, 200) + }; + }, + onLoad(options) { + this.source = options.source || '' + }, + methods: { + backInfoPage() { + console.log('backInfoPage') + uni.navigateBack() + }, + toProtocol() { + uni.navigateTo({ + url: '/sub_pages/supplier/protocol' + }) + }, + async getCode() { + // await this.$message.confirm('是否同意入驻协议') + // this.protocal = true + console.log('getCode') + setTimeout(() => { + uni.hideKeyboard() //隐藏已经显示的软键盘,如果软键盘没有显示则不做任何操作。 + }, 200) - if (this.getCodeisWaiting) { - return; - } - if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))) { //校验手机号码是否有误 - uni.showToast({ - title: '请填写正确手机号码', - icon: "none" - }); - return false; - } - this.getCodeText = "发送中..." //发送验证码 - this.getCodeisWaiting = true; - this.getCodeBtnColor = "#000" //追加样式,修改颜色 - //示例用定时器模拟请求效果 - //setTimeout(()用于在指定的毫秒数后调用函数或计算表达式 - const { - code - } = await this.$http.request('post', '/api/sms/send/code', { - data: { - tel: this.phoneNumber, - userType: this.apitype - } - }) - if (code == 0) { - uni.showToast({ - title: '验证码已发送', - icon: "none" - }); - this.setTimer(); //调用定时器方法 - } else { - this.getCodeText = "获取验证码" //发送验证码 - this.getCodeisWaiting = false; - this.getCodeBtnColor = "#20613D"; - } - // setTimeout(() => { - // //弹出提示框 - // //示例默认1234,生产中请删除这一句。 - // // this.code = '1234'; //发送验证码,进行填入 + if (this.getCodeisWaiting) { + return; + } + if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))) { //校验手机号码是否有误 + uni.showToast({ + title: '请填写正确手机号码', + icon: "none" + }); + return false; + } + this.getCodeText = "发送中..." //发送验证码 + this.getCodeisWaiting = true; + this.getCodeBtnColor = "#000" //追加样式,修改颜色 + //示例用定时器模拟请求效果 + //setTimeout(()用于在指定的毫秒数后调用函数或计算表达式 + const { + code + } = await this.$http.request('post', '/api/sms/send/code', { + data: { + tel: this.phoneNumber, + userType: this.apitype + } + }) + if (code === 0) { + uni.showToast({ + title: '验证码已发送', + icon: "none" + }); + this.setTimer(); //调用定时器方法 + } else { + this.getCodeText = "获取验证码" //发送验证码 + this.getCodeisWaiting = false; + this.getCodeBtnColor = "#20613D"; + } + // setTimeout(() => { + // //弹出提示框 + // //示例默认1234,生产中请删除这一句。 + // // this.code = '1234'; //发送验证码,进行填入 - // }, 1000) - }, - //setTimer: 需要每隔一段时间执行一件事的的时候就需要使用SetTimer函数 - setTimer() { - let holdTime = 60; //定义变量并赋值 - this.getCodeText = "重新获取(60)" - //setInterval()是一个实现定时调用的函数,可按照指定的周期(以毫秒计)来调用函数或计算表达式。 - //setInterval方法会不停地调用函数,直到 clearInterval被调用或窗口被关闭。 - this.Timer = setInterval(() => { - if (holdTime <= 0) { - this.getCodeisWaiting = false; - this.getCodeBtnColor = "#20613D"; - this.getCodeText = "获取验证码" - clearInterval(this.Timer); //清除该函数 - return; //返回前面 - } - this.getCodeText = "重新获取(" + holdTime + ")" - holdTime--; - }, 1000) - }, - toLogin() { - uni.redirectTo({ - url: '/pages/login/supplier-login' - }) + // }, 1000) + }, + //setTimer: 需要每隔一段时间执行一件事的的时候就需要使用SetTimer函数 + setTimer() { + let holdTime = 60; //定义变量并赋值 + this.getCodeText = "重新获取(60)" + //setInterval()是一个实现定时调用的函数,可按照指定的周期(以毫秒计)来调用函数或计算表达式。 + //setInterval方法会不停地调用函数,直到 clearInterval被调用或窗口被关闭。 + this.Timer = setInterval(() => { + if (holdTime <= 0) { + this.getCodeisWaiting = false; + this.getCodeBtnColor = "#20613D"; + this.getCodeText = "获取验证码" + clearInterval(this.Timer); //清除该函数 + return; //返回前面 + } + this.getCodeText = "重新获取(" + holdTime + ")" + holdTime--; + }, 1000) + }, + toLogin() { + uni.redirectTo({ + url: '/pages/login/supplier-login' + }) - }, - changeAll(e) { - this.pcfvalue = e.detail.value[0] - }, - async login() { - uni.showLoading({ - title: '登陆中' - }); - var that = this; - if (!that.phoneNumber) { - uni.showToast({ - title: '请输入手机号', - icon: 'none' - }); - return; - } - if (!that.smsCode) { - uni.showToast({ - title: '请输入手机验证码', - icon: 'none' - }); - return; - } - if (!that.password) { - uni.showToast({ - title: '请输入密码', - icon: 'none' - }); - return; - } - // if (this.pcfvalue == undefined) { - // util.showMyToast('必须勾选《用户服务协议》及《隐私政策》'); - // return; - // } - let post = { - tel: this.phoneNumber, - smsCode: this.smsCode, - password: this.password, - type: this.apitype - // openId: '123456789' - } - if (this.source == 'step') { - var tjson = this.$storage.getItem('cache_partner_info') + }, + changeAll(e) { + this.pcfvalue = e.detail.value[0] + }, + async login() { + uni.showLoading({ + title: '登陆中' + }); + var that = this; + if (!that.phoneNumber) { + uni.showToast({ + title: '请输入手机号', + icon: 'none' + }); + return; + } + if (!that.smsCode) { + uni.showToast({ + title: '请输入手机验证码', + icon: 'none' + }); + return; + } + if (!that.password) { + uni.showToast({ + title: '请输入密码', + icon: 'none' + }); + return; + } + // if (this.pcfvalue == undefined) { + // util.showMyToast('必须勾选《用户服务协议》及《隐私政策》'); + // return; + // } + let post = { + tel: this.phoneNumber, + smsCode: this.smsCode, + password: this.password, + type: this.apitype + // openId: '123456789' + } + if (this.source === 'step') { + var tjson = '' + // #ifdef PUB_PARTNER + tjson = this.$storage.getItem('cache_partner_info') + // #endif + // #ifdef PUB_CUSTOMER + this.$storage.getItem('cache_customer_info') + // #endif - if (!tjson) { - this.$message.showToast('没有合伙人信息请返回重新填写') - return - } - var dto = JSON.parse(tjson) - post.dto = dto - } + if (!tjson) { + this.$message.showToast('没有填写用户信息请返回重新填写') + return + } + var dto = JSON.parse(tjson) + post.dto = dto + } - // const { - // code - // } = await this.$http.request('get', '/api/login/admin') - const resp = await this.$store.dispatch('regUser', post); - // uni.hideLoading() + // const { + // code + // } = await this.$http.request('get', '/api/login/admin') + const resp = await this.$store.dispatch('regUser', post); + // uni.hideLoading() - if (resp.code == 0) { + if (resp.code === 0) { - // myCache.cache("userToken", res.data.accessToken) - // let userRes = await gzmzApi.getMemberInfo(); - // if (userRes.status) { - // myCache.cache("userInfo", JSON.stringify(userRes.data)) - // } - uni.showToast({ - title: '注册成功!', - icon: 'none' - }); - setTimeout(() => { - this.toLogin() - }, 1000); - // if (this.source == 'step') { - // // cache_partner_info - // var tjson = this.$storage.getItem('cache_partner_info') - // if (tjson) { - // var dto = JSON.parse(tjson) + // myCache.cache("userToken", res.data.accessToken) + // let userRes = await gzmzApi.getMemberInfo(); + // if (userRes.status) { + // myCache.cache("userInfo", JSON.stringify(userRes.data)) + // } + uni.showToast({ + title: '注册成功!', + icon: 'none' + }); + setTimeout(() => { + this.toLogin() + }, 1000); + // if (this.source == 'step') { + // // cache_partner_info + // var tjson = this.$storage.getItem('cache_partner_info') + // if (tjson) { + // var dto = JSON.parse(tjson) - // this.$message.showLoading() - // const re = await this.$http.request('post', '/api/partner/addOrUpdate', { - // data: dto - // }) - // this.$message.hideLoading() - // if (re.code == 2000 || re.code == 0) { - // this.$storage.removeItem('cache_partner_info') + // this.$message.showLoading() + // const re = await this.$http.request('post', '/api/partner/addOrUpdate', { + // data: dto + // }) + // this.$message.hideLoading() + // if (re.code == 2000 || re.code == 0) { + // this.$storage.removeItem('cache_partner_info') - // this.toLogin() - // } else { - // this.$message.showToast('合伙人信息失效,请登录后重新填写提交审核') - // setTimeout(() => { - // this.toLogin() - // }, 1000); - // } + // this.toLogin() + // } else { + // this.$message.showToast('合伙人信息失效,请登录后重新填写提交审核') + // setTimeout(() => { + // this.toLogin() + // }, 1000); + // } + // } else { + // this.$message.showToast('合伙人信息失效,请登录后重新填写提交审核') + // setTimeout(() => { + // this.toLogin() + // }, 1000); + // } - // } else { - // this.$message.showToast('合伙人信息失效,请登录后重新填写提交审核') - // setTimeout(() => { - // this.toLogin() - // }, 1000); - // } - - // } else { - // setTimeout(() => { - // this.toLogin() - // }, 1000); - // } + // } else { + // setTimeout(() => { + // this.toLogin() + // }, 1000); + // } - } else { - // uni.showToast({ - // title: '登录失败!', - // icon: 'none' - // }); - return - } + } else { + // uni.showToast({ + // title: '登录失败!', + // icon: 'none' + // }); + return + } - }, - tc1(id) { - uni.navigateTo({ - url: '/pages/users/xieyi?id=' + id, - }); - } - } - }; + }, + tc1(id) { + uni.navigateTo({ + url: '/pages/users/xieyi?id=' + id, + }); + } + } +}; </script> <style lang="scss" scoped> - .form-input { - background-color: #f8f7fc; - border-radius: 50rpx; - margin-bottom: 50rpx; - border: 1px solid #e9e9e9; +.form-input { + background-color: #f8f7fc; + border-radius: 50rpx; + margin-bottom: 50rpx; + border: 1px solid #e9e9e9; - /deep/ .u-input { - padding-left: 60rpx !important; - padding-right: 40rpx !important; - } + /deep/ .u-input { + padding-left: 60rpx !important; + padding-right: 40rpx !important; + } - /deep/ input { - height: 70rpx; - line-height: 70rpx; + /deep/ input { + height: 70rpx; + line-height: 70rpx; - } + } - } +} </style> <style lang="scss" scoped> - @import '@/pages/login/login.scss'; +@import '@/pages/login/login.scss'; - .main-container { - margin: 20px 0; - } +.main-container { + margin: 20px 0; +} - .img-a { - position: absolute; - width: 100%; - top: -150rpx; - right: 0; - } +.img-a { + position: absolute; + width: 100%; + top: -150rpx; + right: 0; +} - .img-b { - position: absolute; - width: 50%; - bottom: 0; - left: -120rpx; - } +.img-b { + position: absolute; + width: 50%; + bottom: 0; + left: -120rpx; +} - .to-home { - margin-top: 30rpx; - font-size: 30rpx; - color: #5af; - display: flex; - flex-direction: row-reverse; - } +.to-home { + margin-top: 30rpx; + font-size: 30rpx; + color: #5af; + display: flex; + flex-direction: row-reverse; +} - .t-login { - width: 100%; - margin: 0 auto; - font-size: 28rpx; - color: #000; - } +.t-login { + width: 100%; + margin: 0 auto; + font-size: 28rpx; + color: #000; +} - .t-login .bg { - width: 100%; - position: relative; - } +.t-login .bg { + width: 100%; + position: relative; +} - .t-login .login { - width: 650rpx; - margin: 60rpx auto; - margin-top: 0rpx; - font-size: 28rpx; - color: #000; - } +.t-login .login { + width: 650rpx; + margin: 60rpx auto; + margin-top: 0rpx; + font-size: 28rpx; + color: #000; +} - .t-login button { - font-size: 28rpx; - background: #5677fc; - color: #fff; - height: 90rpx; - line-height: 90rpx; - border-radius: 50rpx; - box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2); - } +.t-login button { + font-size: 28rpx; + background: #5677fc; + color: #fff; + height: 90rpx; + line-height: 90rpx; + border-radius: 50rpx; + box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2); +} - .t-login input { - padding: 0 20rpx 0 60rpx; - height: 90rpx; - line-height: 90rpx; - margin-bottom: 50rpx; - background: #f8f7fc; - border: 1px solid #e9e9e9; - font-size: 28rpx; - border-radius: 50rpx; - } +.t-login input { + padding: 0 20rpx 0 60rpx; + height: 90rpx; + line-height: 90rpx; + margin-bottom: 50rpx; + background: #f8f7fc; + border: 1px solid #e9e9e9; + font-size: 28rpx; + border-radius: 50rpx; +} - .t-login .t-a { - position: relative; +.t-login .t-a { + position: relative; - .get-code { - // position: absolute; - // right: 0rpx; - // top: 0rpx; - // z-index: 99; - // padding-top: 25rpx; - // bottom: 0; - // padding-right: 40rpx; - // padding-left: 20rpx; - } - } + .get-code { + // position: absolute; + // right: 0rpx; + // top: 0rpx; + // z-index: 99; + // padding-top: 25rpx; + // bottom: 0; + // padding-right: 40rpx; + // padding-left: 20rpx; + } +} - .t-login .t-a .icon { - width: 40rpx; - height: 40rpx; - position: absolute; - left: 24rpx; - top: 14rpx; - margin-right: 20rpx; - } +.t-login .t-a .icon { + width: 40rpx; + height: 40rpx; + position: absolute; + left: 24rpx; + top: 14rpx; + margin-right: 20rpx; +} - .t-login .t-a .line { - width: 2rpx; - height: 40rpx; - background-color: #dedede; - position: absolute; - top: 28rpx; - left: 98rpx; - } +.t-login .t-a .line { + width: 2rpx; + height: 40rpx; + background-color: #dedede; + position: absolute; + top: 28rpx; + left: 98rpx; +} - .t-login .t-b { - text-align: left; - font-size: 46rpx; - color: #000; - padding: 300rpx 0 30rpx 0; - font-weight: bold; - } +.t-login .t-b { + text-align: left; + font-size: 46rpx; + color: #000; + padding: 300rpx 0 30rpx 0; + font-weight: bold; +} - .t-login .t-b2 { - text-align: left; - font-size: 32rpx; - color: #aaaaaa; - padding: 0rpx 0 120rpx 0; - } +.t-login .t-b2 { + text-align: left; + font-size: 32rpx; + color: #aaaaaa; + padding: 0rpx 0 120rpx 0; +} - .t-login .t-c { - position: absolute; - right: 22rpx; - top: 22rpx; - background: #5677fc; - color: #fff; - font-size: 24rpx; - border-radius: 50rpx; - height: 50rpx; - line-height: 50rpx; - padding: 0 25rpx; - z-index: 999; - } +.t-login .t-c { + position: absolute; + right: 22rpx; + top: 22rpx; + background: #5677fc; + color: #fff; + font-size: 24rpx; + border-radius: 50rpx; + height: 50rpx; + line-height: 50rpx; + padding: 0 25rpx; + z-index: 999; +} - .t-login .t-d { - text-align: center; - color: #999; - margin: 80rpx 0; - } +.t-login .t-d { + text-align: center; + color: #999; + margin: 80rpx 0; +} - .t-login .t-e { - text-align: center; - width: 250rpx; - margin: 80rpx auto 0; - } +.t-login .t-e { + text-align: center; + width: 250rpx; + margin: 80rpx auto 0; +} - .t-login .t-g { - float: left; - width: 50%; - } +.t-login .t-g { + float: left; + width: 50%; +} - .t-login .t-e image { - width: 50rpx; - height: 50rpx; - } +.t-login .t-e image { + width: 50rpx; + height: 50rpx; +} - .t-login .t-f { - text-align: center; - margin: 200rpx 0 0 0; - color: #666; - } +.t-login .t-f { + text-align: center; + margin: 200rpx 0 0 0; + color: #666; +} - .t-login .t-f text { - margin-left: 20rpx; - color: #aaaaaa; - font-size: 27rpx; - } +.t-login .t-f text { + margin-left: 20rpx; + color: #aaaaaa; + font-size: 27rpx; +} - .t-login .uni-input-placeholder { - color: #000; - } +.t-login .uni-input-placeholder { + color: #000; +} - .cl { - zoom: 1; - } +.cl { + zoom: 1; +} - .cl:after { - clear: both; - display: block; - visibility: hidden; - height: 0; - content: '\20'; - } +.cl:after { + clear: both; + display: block; + visibility: hidden; + height: 0; + content: '\20'; +} </style> \ No newline at end of file diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue index 855d5bb..a0ab487 100644 --- a/pages/user/supplier-user.vue +++ b/pages/user/supplier-user.vue @@ -32,8 +32,9 @@ </view> <view class="t2">{{ currentInfo.tel || '暂无电话' }}</view> </view> - <view class="name" v-if="!currentInfo.id" open-type="getUserInfo" @click.stop="getUserProfile" + <view class="name" v-if="!currentInfo.id" open-type="getUserInfo" @click.stop="toCustomerLogin" style="font-size: 48rpx;margin-top: 16rpx;"> + <!-- getUserProfile --> {{ '点击登陆' }} </view> <image class="icon-setting" src="../../static/common/icon-setting.png" mode="aspectFit"></image> @@ -138,7 +139,7 @@ </view> <!-- #endif --> <view class="user-utils m-20"> - <view class="user-util m-t-12 flex" @click="goto('/pages/user/user-info/user-info',true)"> + <view class="user-util m-t-12 flex" @click="goto('/sub_pages/customer/customer-info/customer-info',true)"> <view class="title">个人信息</view> <view class="right-icon"> <uni-icons type="right"></uni-icons> @@ -172,7 +173,7 @@ <view class="name" @click="callTel"> 客服电话 : <span class="topic-gray">{{ tel }}</span> </view> - <view class="right-icon" open-type="contact"> + <view class="right-icon" open-type="contact"> <uni-icons type="right"></uni-icons> </view> </view> @@ -302,9 +303,12 @@ uni.makePhoneCall({ phoneNumber: this.tel //仅为示例 }); - } - - + }, + toCustomerLogin() { + uni.navigateTo({ + url: '/pages/login/supplier-login' + }) + }, } } </script> diff --git a/pages/user/user-info/user-info.vue b/pages/user/user-info/user-info.vue index 7f90ded..59f6e29 100644 --- a/pages/user/user-info/user-info.vue +++ b/pages/user/user-info/user-info.vue @@ -60,7 +60,7 @@ </template> <script> - const appId = 'wxafc5aaa0fc79532b'; //需要替换成实际的 + const appId = 'wx1441324401626290'; //需要替换成实际的 import WXBizDataCrypt from '@/plugins/WXBizDataCrypt.js'; import { mapState diff --git a/store/index.js b/store/index.js index 7406b20..8a6aef8 100644 --- a/store/index.js +++ b/store/index.js @@ -380,7 +380,7 @@ } }) console.log('resp', resp) - if (resp && resp.code == 0) { + if (resp && resp.code === 0) { storage.setItem('token', resp.data.access_token) commit("updateLogin", true) await dispatch('getCurrentInfo') @@ -396,7 +396,7 @@ }, submitShopping: async function ({commit, dispatch}, data) { - const resp = await http.request('post', '/api/api/customer/flower/cart/change-num', { + const resp = await http.request('post', '/api/customer/flower/cart/change-num', { data: { id: data.id, num: 1 diff --git a/sub_pages/customer/customer-info/customer-info.vue b/sub_pages/customer/customer-info/customer-info.vue new file mode 100644 index 0000000..e89a270 --- /dev/null +++ b/sub_pages/customer/customer-info/customer-info.vue @@ -0,0 +1,373 @@ +<template> + <view class="container-page" style="padding: 0rpx;"> + <view v-if="source==='step'" class="m-t-20"> + <u-steps current="0"> + <u-steps-item title="信息填写" class="u-steps-item" style="font-size: 28rpx;"> + </u-steps-item> + <u-steps-item title="提交申请" class="u-steps-item"></u-steps-item> + </u-steps> + </view> + <view class="p20"> + <view class="form-item before-line"> + <view class="label required">店铺名称</view> + <view class="m-l-a m-r-0 flex"> + <input v-model="dto.name" placeholder="请输入联系人姓名" + style="margin-top: 16px;text-align: right;"></input> + + </view> + </view> + + + + <view class="form-item before-line"> + <view class="label ">地区</view> + + <view class="m-l-a m-r-0 flex " :class="[!dto['province']?'desc-gray':'']"> + <uni-data-picker :area="true" @change="(e)=>{PickArea(dto,e)}" placeholder="" + :localdata="regionDataPlus"> + {{ dto['province'] || '请选择' }}{{ dto['city'] && ('/' + dto['city']) || '' }}{{ + dto['region'] && ('/' + dto['region']) || '' + }} + </uni-data-picker> + <u-icon class="m-l-a" name="arrow-right"></u-icon> + </view> + + </view> + <view class="form-item before-line"> + <view class="label ">地址</view> + <view class="m-l-a m-r-0 flex"> + <input v-model="dto.address" placeholder="请输入地址" + style="margin-top: 16px;text-align: right;"></input> + + </view> + </view> + <view class="form-item before-line"> + <view class="label ">店铺简介</view> + <view class="m-l-a m-r-0 flex1"> + <view class="m-t-12 m-b-12"> + <u-textarea v-model="dto.description" placeholder="请输入店铺简介"> + + </u-textarea> + </view> +<!-- <input v-model="dto.description" placeholder="请输入地址"--> +<!-- style="margin-top: 16px;text-align: right;"></input>--> + + </view> + </view> + + + <view class="form-item before-line m-t-20" @click="uploadIcon"> + <view class="label ">上传店铺封面</view> + <view class="m-l-a m-r-0 flex m-b-12"> + <view class="component-button-upload"> + + </view> + + </view> + </view> + + <view class="flex p20" style="padding-top: 0rpx;padding-bottom: 10rpx" + v-if="dto.cover"> + <view class="m-t-12 m-r-10"> + <image class="banner-img" :src="dto.cover" @click.stop="previewImg(dto.cover)"> + + </image> + <view class="t-red text-center" @click.stop="dto.cover=''">删除</view> + </view> + </view> + + + <view class="button-green-1 m-t-20 button-fixed-bottom before-line " @click="submit"> + {{source==='step'?'下一步':'更新'}} + + </view> + + </view> + + <view style="min-height: 200rpx;"> + + </view> + + </view> +</template> + +<script> +import environments from '@/environments' + +import { + mapState +} from 'vuex' + +export default { + + data() { + return { + id: '', + source: '', + + refresh: false, + api: '', + dto: { + cover: '', + address: '', + id: '', + userId: '', + name: '', + description: '', + province: '', + city: '', + region: '', + }, + requireFields: [ + + { + name: '店铺名称', + key: 'name' + } + ], + regionDataPlus: [], + } + }, + onLoad(options) { + //判断是不是来自登录步骤,是等话需要从缓存里面拿信息 + this.source = options.source || '' + + if (this.source === 'step') { + var tjson = this.$storage.getItem('cache_customer_info') + if (tjson) { + this.dto = { + ...this.dto, + ...JSON.parse(tjson) + } + } + } else { + this.getCurrentInfo() + } + + this.init_area() + + + }, + + methods: { + PickArea(item, e) { + console.log('PickArea', item, e) + if (e.detail.value) { + this.dto.province = '' + this.dto.city = '' + this.dto.region = '' + if (e.detail.value.length <= 3) { + if (!!e.detail.value[0]) + this.dto.province = e.detail.value[0].value + if (!!e.detail.value[1]) + this.dto.city = e.detail.value[1].value + if (!!e.detail.value[2]) + this.dto.region = e.detail.value[2].value + } else { + //说明有重复的 + var plusnum = e.detail.value.length - 3 + if (!!e.detail.value[plusnum + 0]) + this.dto.province = e.detail.value[plusnum + 0].value + if (!!e.detail.value[plusnum + 1]) + this.dto.city = e.detail.value[plusnum + 1].value + if (!!e.detail.value[plusnum + 2]) + this.dto.region = e.detail.value[plusnum + 2].value + } + + this.$forceUpdate() + + } + }, + async init_area() { + const res = await this.$http.request('get', '/api/pub/china/area/json') + // console.log('area', JSON.parse(res.data)) + this.regionDataPlus = res.data && JSON.parse(res.data.replaceAll('code', 'value').replaceAll('name', + 'text')) || [] + }, + + + async getCurrentInfo() { + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('get', "/api/current/customer", {}) + if (code === 0) { + this.dto = { + ...data, + + } + this.dto.userId = this.currentInfo.id + + } + + this.$message.hideLoading() + }, + async submit() { + for (var field of this.requireFields) { + if (!this.dto[field.key]) { + this.$message.showToast(`${field.name}信息未填写`) + return + } + } + await this.$message.confirm(`是否确定提交更新信息`) + if (this.source === 'step') { + //先保存下来,进入下一步,然后注册成功后再保存 + this.$storage.setItem("cache_customer_info", JSON.stringify({ + ...this.dto + })) + + uni.navigateTo({ + url: '/pages/login/supplier-reg?source=step' + }) + + } else { + var dto = { + ...this.dto, + } + this.$message.showLoading() + const re = await this.$http.request('post', '/api/customer/addOrUpdate', { + data: dto + }) + this.$message.hideLoading() + if (re.code == 2000 || re.code == 0) { + this.$message.showToast('操作成功') + this.$store.dispatch('getCurrentInfo') + this.backpage() + } else { + console.log('error re', re) + if (re.code === 30000 && Array.isArray(re.msg)) { + this.$message.showToast('字段未填写完整') + } + } + } + + }, + + + uploadIcon() { + const that = this + uni.chooseImage({ + count: 1, // 最多可以选择的图片张数,默认9 + sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有 + sourceType: ['camera', 'album'], //album 从相册选图,camera 使用相机,默认二者都有。如需直接开相机或直接选相册,请只使用一个选项 + success: function ({ + errMsg, + tempFiles + }) { + if (errMsg === 'chooseImage:ok') { + if (tempFiles[0].size > 1024 * 1024 * 5) { + that.$message.confirm('图片最多支持5M大小,超出大小限制') + return + } + that.$message.showLoading() + that.$http.upload(tempFiles[0].path).then(async res => { + var pic = res.data && res.data.length > 0 && res.data[ + 0] || {} + that.$message.hideLoading() + that.dto.cover = (pic || {}).url || '' + console.log('pic',that.dto) + + that.$forceUpdate() + }).catch(res => { + that.$message.hideLoading() + + }) + } + } + }) + }, + + }, + computed: { + ...mapState(['currentInfo']) + }, + components: {} +} +</script> + +<style lang="scss" scoped> +.banner-img { + width: 96rpx; + height: 96rpx; + border-radius: 4rpx; + border: 2rpx dashed #CECECE; +} + +.form-item { + // padding: 40rpx; + border-bottom: 2rpx solid #F3F3F3; + display: flex; + // height: 100px; + + .label { + width: 300rpx; + line-height: 60px; + + } + + .flex { + line-height: 60px; + + .flex1 { + flex: 1; + text-align: center; + color: var(--selfblue) + } + + + } +} + +.form-item.bottom-border-no { + border-bottom: none; +} + +.container-page { + padding: 40rpx; + background-color: #FFFFFF; + // min-height: calc(100vh - 80rpx); + min-height: 100vh; +} + +.style { + width: fit-content; + margin: 0 auto; + line-height: 64rpx; + border-radius: 8rpx; + padding-left: 20rpx; + padding-right: 20rpx; + // padding-top: 5rpx; + // padding-bottom: 5rpx; + border: 2rpx solid var(--selfblue); + background-color: var(--selfbluebg); + min-width: 100rpx; +} + + +.style-1 { + border: 1px solid rgb(122, 187, 255); + border: 1px solid #409EFF; + color: #409EFF; + background-color: rgb(240, 247, 255); +} + +.style-2 { + border: 1px solid rgb(255, 184, 78); + border: 1px solid #FE9044; + color: #FE9044; + background-color: rgb(255, 247, 235); +} + +.style-3 { + border: 1px solid #19be6b; + color: #19be6b; + background-color: rgb(231, 244, 238); +} + +.style-4 { + border: 1px solid #F56c6c; + color: #F56c6c; + background-color: rgb(254, 243, 243); +} +</style> \ No newline at end of file diff --git a/sub_pages/customer/shopping/confirm.vue b/sub_pages/customer/shopping/confirm.vue index aee9080..86c51b8 100644 --- a/sub_pages/customer/shopping/confirm.vue +++ b/sub_pages/customer/shopping/confirm.vue @@ -186,18 +186,22 @@ <view class="form-item p10"> <view class="label">特殊需求</view> - <view class="m-l-a m-r-0 flex text-right"> - <u-textarea v-model="dto.remarks" placeholder="请输入特殊需求"> + <view class="m-l-a m-r-0 flex1 text-right"> + <view class="m-t-12 m-b-12"> + <u-textarea v-model="dto.remarks" placeholder="请输入特殊需求"> - </u-textarea> + </u-textarea> + </view> </view> </view> <view class="form-item p10"> <view class="label">留言</view> - <view class="m-l-a m-r-0 flex text-right"> - <u-textarea v-model="dto.remarks" placeholder="填写内容需与卖家协商并确认"> + <view class="m-l-a m-r-0 flex1 text-right"> + <view class="m-t-12 m-b-12"> + <u-textarea v-model="dto.remarks" placeholder="填写内容需与卖家协商并确认"> - </u-textarea> + </u-textarea> + </view> </view> </view> diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue index 96f93dd..749d2e4 100644 --- a/sub_pages/customer/shopping/shopping.vue +++ b/sub_pages/customer/shopping/shopping.vue @@ -106,161 +106,161 @@ }) return totalprice.toFixed(2) }, - methods: { - async submitPay() { - // order/confirm/info - var arr = [] - for (var j = 0; j < this.list.flowerList; j++) { + }, + methods: { + async submitPay() { + // order/confirm/info + var arr = [] + for (var j = 0; j < this.list.flowerList; j++) { - if (this.ids.indexOf(this.list.flowerList[j].id) >= 0) { - arr.push({ - id: this.list.flowerList[j].id, - num: this.list.flowerList[j].num - }) - } - } - if (this.arr.length < 1) { - return - } - this.$message.showLoading() - const {code, data} = await http.request('post', '/api/api/customer/order/confirm/info', { - data: { - flowers: arr, - } - } - ) - this.$message.hideLoading() - if (code === 0) { - uni.navigateTo({ - url: '/sub_pages/customer/shopping/confirm?dto=' + +encodeURIComponent(JSON.stringify(data)) + if (this.ids.indexOf(this.list.flowerList[j].id) >= 0) { + arr.push({ + id: this.list.flowerList[j].id, + num: this.list.flowerList[j].num }) } - }, - async clickSwipeButton(item) { - //删除商品,重新加载数据? - - this.$message.showLoading() - const {code} = await http.request('post', '/api/api/customer/flower/cart/change-num', { - data: { - id: dto.id, - num: addnum - } + } + if (this.arr.length < 1) { + return + } + this.$message.showLoading() + const {code, data} = await http.request('post', '/api/api/customer/order/confirm/info', { + data: { + flowers: arr, } - ) - this.$message.hideLoading() - if (code === 0) { - if (this.ids.indexOf(item.id) >= 0) { - this.ids.splice(this.ids.indexOf(item.id), 1) } - for (var i = 0; i < this.list.length; i++) { - if (this.list[i].id === dto.supplierId) { - this.list[i].splice(i, 1) - if (this.list.flowerList.length === 1) { - if (this.ids.indexOf(this.list[i].id) >= 0) { - this.ids.splice(this.ids.indexOf(this.list[i].id), 1) + ) + this.$message.hideLoading() + if (code === 0) { + uni.navigateTo({ + url: '/sub_pages/customer/shopping/confirm?dto=' + +encodeURIComponent(JSON.stringify(data)) + }) + } + }, + async clickSwipeButton(item) { + //删除商品,重新加载数据? + + this.$message.showLoading() + const {code} = await http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: dto.id, + num: addnum + } + } + ) + this.$message.hideLoading() + if (code === 0) { + if (this.ids.indexOf(item.id) >= 0) { + this.ids.splice(this.ids.indexOf(item.id), 1) + } + for (var i = 0; i < this.list.length; i++) { + if (this.list[i].id === dto.supplierId) { + this.list[i].splice(i, 1) + if (this.list.flowerList.length === 1) { + if (this.ids.indexOf(this.list[i].id) >= 0) { + this.ids.splice(this.ids.indexOf(this.list[i].id), 1) + } + this.list[i].flowerList.splice(0, 1) + this.list.splice(i, 1) + } else { + //只需要清楚这个元素 + var k = -1 + for (var j = 0; j < this.list[i].flowerList.length; j++) { + if (this.list[i][j].id === item.id) { + k = j; + break } - this.list[i].flowerList.splice(0, 1) - this.list.splice(i, 1) - } else { - //只需要清楚这个元素 - var k = -1 - for (var j = 0; j < this.list[i].flowerList.length; j++) { - if (this.list[i][j].id === item.id) { - k = j; - break - } - } - this.list[i].flowerList.splice(k, 1) } - break + this.list[i].flowerList.splice(k, 1) } + break } - } - }, - - selectAll() { - console.log('selectAll', this.checkall) - if (this.checkall) { - this.ids = [] - this.checkall = false - // this.$forceUpdate() - } else { - this.list.forEach(dto => { - if (this.ids.indexOf(dto.id) < 0) { - this.ids.push(dto.id) - } - dto.flowerList.forEach(item => { - if (this.ids.indexOf(item.id) < 0) { - this.ids.push(item.id) - } - }) - }) - this.checkall = true - } - }, - changeItem(dto, type) { - if (type === 'supplier') { - //全选上 - if (this.ids.indexOf(dto.id) < 0) { - this.ids.push(dto.id) - dto.flowerList.forEach(item => { - if (this.ids.indexOf(item.id) < 0) { - this.ids.push(item.id) - } - }) - } else { - this.checkall = false - this.ids.splice(this.ids.indexOf(dto.id), 1) - dto.flowerList.forEach(item => { - this.ids.splice(this.ids.indexOf(item.id), 1) - }) - } - - } else { - //更换个人的 - if (this.ids.indexOf(dto.id) < 0) { - this.ids.push(dto.id) - } else { - this.checkall = false - - if (this.ids.indexOf(dto.supplierId) >= 0) { - this.ids.splice(this.ids.indexOf(dto.supplierId), 1) - } - } - - } - }, - async addnum(dto, addnum) { - if (dto.num + addnum >= 0) { - - } else { - return - } - this.$message.showLoading() - const {code} = await http.request('post', '/api/api/customer/flower/cart/change-num', { - data: { - id: dto.id, - num: addnum - } - } - ) - this.$message.hideLoading() - if (code === 0) { - dto.num += addnum - } - }, - async init() { - this.$message.showLoading() - await this.$store.dispatch('sign_clear', 'shopping'); - const {code, data} = await this.$http.request('get', '/api/customer/flower/cart/list', {}) - this.$message.hideLoading() - this.list = [] - if (code === 0) { - this.list = data.list || [] - } } }, + + selectAll() { + console.log('selectAll', this.checkall) + if (this.checkall) { + this.ids = [] + this.checkall = false + // this.$forceUpdate() + } else { + this.list.forEach(dto => { + if (this.ids.indexOf(dto.id) < 0) { + this.ids.push(dto.id) + } + dto.flowerList.forEach(item => { + if (this.ids.indexOf(item.id) < 0) { + this.ids.push(item.id) + } + }) + }) + this.checkall = true + } + }, + changeItem(dto, type) { + if (type === 'supplier') { + //全选上 + if (this.ids.indexOf(dto.id) < 0) { + this.ids.push(dto.id) + dto.flowerList.forEach(item => { + if (this.ids.indexOf(item.id) < 0) { + this.ids.push(item.id) + } + }) + } else { + this.checkall = false + this.ids.splice(this.ids.indexOf(dto.id), 1) + dto.flowerList.forEach(item => { + this.ids.splice(this.ids.indexOf(item.id), 1) + }) + } + + } else { + //更换个人的 + if (this.ids.indexOf(dto.id) < 0) { + this.ids.push(dto.id) + } else { + this.checkall = false + + if (this.ids.indexOf(dto.supplierId) >= 0) { + this.ids.splice(this.ids.indexOf(dto.supplierId), 1) + } + } + + } + }, + async addnum(dto, addnum) { + if (dto.num + addnum >= 0) { + + } else { + return + } + this.$message.showLoading() + const {code} = await http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: dto.id, + num: addnum + } + } + ) + this.$message.hideLoading() + if (code === 0) { + dto.num += addnum + } + }, + async init() { + this.$message.showLoading() + await this.$store.dispatch('sign_clear', 'shopping'); + const {code, data} = await this.$http.request('get', '/api/customer/flower/cart/list', {}) + this.$message.hideLoading() + this.list = [] + if (code === 0) { + this.list = data.list || [] + + } + } } } </script> diff --git a/sub_pages/customer/trade/list.vue b/sub_pages/customer/trade/list.vue index 1af11b2..fa24afc 100644 --- a/sub_pages/customer/trade/list.vue +++ b/sub_pages/customer/trade/list.vue @@ -303,7 +303,7 @@ return } this.$message.showLoading() - const {code} = await http.request('post', '/api/api/customer/flower/cart/change-num', { + const {code} = await http.request('post', '/api/customer/flower/cart/change-num', { data: { id: item.id, num: addnum diff --git a/sub_pages/partner/partner-info/partner-info.vue b/sub_pages/partner/partner-info/partner-info.vue index 6b41f30..1d88b3b 100644 --- a/sub_pages/partner/partner-info/partner-info.vue +++ b/sub_pages/partner/partner-info/partner-info.vue @@ -65,7 +65,7 @@ <view class="form-item before-line m-t-20" @click="uploadIcon('idCards')"> <view class="label required">上传身份证正反面</view> <view class="m-l-a m-r-0 flex"> - <view class="component-button-upload" @click="uploadIcon('idCards')"> + <view class="component-button-upload"> </view> -- Gitblit v1.9.3