diff --git a/api/user.js b/api/user.js index 4e9c57d..c0d94dd 100644 --- a/api/user.js +++ b/api/user.js @@ -141,4 +141,8 @@ export const getCreateLists = (data) => { export const getloginSms = (data) => { return request.post('/user/user/login_sms', data); +} + +export const getReportingSms = (data) => { + return request.post('/user/user/reporting_sms', data); } \ No newline at end of file diff --git a/components/goodPopup.vue b/components/goodPopup.vue index 3ce66f7..6736a34 100644 --- a/components/goodPopup.vue +++ b/components/goodPopup.vue @@ -28,14 +28,14 @@ </view> <view style="color: #F55726;" v-else>¥ {{ subtotal }}</view> </view> - <view v-if="datas.is_bulk" class="row"> + <view v-if="datas.is_bulk" class="row" style="height: 100rpx;"> <view>购买重量<text style="color: #F55726;">*</text></view> <view style="flex: 1;"> <up-input v-model="datas.cart_num" :cursorSpacing='120' type="digit" border="none" placeholder="请输入购买重量" inputAlign="right"></up-input> </view> </view> - <view v-else class="row"> + <view v-else class="row" style="height: 100rpx;"> <view>购买数量<text style="color: #F55726;">*</text></view> <view style="flex: 1;"> <up-input ref='foucs1' v-model="datas.cart_num" :cursorSpacing='120' type="digit" border="none" diff --git a/pageQuota/vipUser/index.vue b/pageQuota/vipUser/index.vue index d052115..fae1506 100644 --- a/pageQuota/vipUser/index.vue +++ b/pageQuota/vipUser/index.vue @@ -59,7 +59,20 @@ suffixIcon='arrow-down'></up-input> </view> </up-form-item> + <up-form-item label=""> + <view style="width: 100%;display: flex;align-items: center;justify-content: space-between;"> + <view class=""> + <up-input v-model="formData.code" border="none" prefixIcon="tags" placeholder="请输入验证码" + :customStyle="{background:'#F3F3F3',padding:'20rpx', + 'border-radius':'30rpx' + }" :placeholderStyle="{color:'#444444'}" :prefixIconStyle="{'margin-right':'40rpx'}"></up-input> + </view> + <text class='btn-text' style="color: grey;" v-if='cutDown'>重新获取({{cutDown}})</text> + <text @click="getCode" class='btn-text' v-else> {{flag?'获取验证码':'重新获取' }} </text> + + </view> + </up-form-item> </up-form> <view class="store-info"> @@ -67,8 +80,6 @@ </view> </view> <view class="submit-btn" @click="submit"> - <!-- <up-button text="完成并收款" size='large' :customStyle="{height:'100rpx',fontSize:'50rpx'}" @click="submit" - shape="circle" color="#50C758"></up-button> --> <view style='width: 710rpx;height: 100rpx;text-align: center;line-height: 100rpx;text-align: center;color: white;background-color: #33B83A;border-radius: 50rpx;font-size:40rpx ;'> {{Role==1?'完成并收款':'完成'}} @@ -193,7 +204,8 @@ getStoreByPhone, getUserLabel, getUserShip, - getCreateLists + getCreateLists, + getReportingSms } from "@/api/user.js" import Push from "@/utils/push.js" import { @@ -204,51 +216,6 @@ config } from "@/config/app.js" - - // scoket - let timer = null - const userInfo = useUserStore().userInfo; - const connection = new Push({ - url: config.WSS_URL, // websocket地址 - app_key: '2ce3ce22329517213caa7dad261f5695', - }); - - // 浏览器监听user-1 - const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}`); - - user_channel.on('message', function(data) { - console.log("收到消息--", data); - try { - if (timer) clearTimeout(timer); - uni.hideLoading() - currentTab.value = 2 - formData.real_name = '' - formData.mobile = '' - formData.address = '' - formData.label_name = '' - formData.city = '' - formData.area = '' - formData.street = '' - formData.village = '' - formData.brigade = '' - currentAddressIndex.value = 0 - tabsList.forEach(item => { - item.name = '请选择' - }) - getLists() - getCount() - - } catch (error) { - - } - }); - // 断线事件 - user_channel.on('close', function() { - - }); - // scoket结束 - - const showPop1 = ref(false) const Role = ref('') const range = ref({}) @@ -266,15 +233,14 @@ }).catch(err => { uni.$u.toast('未查到店铺信息,请检查手机号码') }) - } - // 用户选择的门店信息 let STORE_INFO = reactive({ id: "" }) + // 门店手机号保留一天 const setPhoneOneDay = () => { if (uni.getStorageSync('VIP_PHONE')) return; const currentDate = new Date(); @@ -285,7 +251,6 @@ phone: storePhone.value })); } - const getPhoneOneDay = () => { if (uni.getStorageSync('VIP_PHONE')) { let data = JSON.parse(uni.getStorageSync('VIP_PHONE')) @@ -296,25 +261,48 @@ } } } + // 手机保留一天结束 + // 验证码 + const cutDown = ref(0) + const flag = ref(true) + const code = ref('') + const checkPhone = (phone) => { + const regex = /^1[3-9]\d{9}$/; + return regex.test(formData.mobile) ? true : false + } + const getCode = async () => { + if (!checkPhone(formData.mobile)) return uni.$u.toast('请输入正确的手机号') + await getReportingSms({ + account: formData.mobile + }) + flag.value = false + cutDown.value = 60 + let timer = setInterval(() => { + cutDown.value-- + if (cutDown.value <= 0) clearInterval(timer) + }, 1000) + } + // 验证码结束 const currentTab = ref(1) const formData = reactive({ store_id: STORE_INFO.id, - mobile: "", + mobile: "19130550023", province: 510000, city: '', area: "", street: "", village: "", brigade: "", - real_name: "", + real_name: "赵明军", auth_code: "", address: "", label_name: "", label_id: "", - user_ship: '' + user_ship: '', + code: '8888' }) const conformRole = (e) => { @@ -337,7 +325,6 @@ const addressTbasChange = (e) => { currentAddressIndex.value = e.index } - const addressList = reactive({ city: [], area: [], @@ -345,7 +332,6 @@ village: [], brigade: [] }) - const addressLiClick = async (i, item) => { if (i == 0) { formData.city = item.city_code @@ -392,7 +378,6 @@ .name return currentAddressIndex.value++ } - const getCityList = async () => { let res = await cityListApi({ province_code: formData.province @@ -422,9 +407,30 @@ }, ]); + + + // 支付相关 + // scoket + let timer = null + const userInfo = useUserStore().userInfo; + const connection = new Push({ + url: config.WSS_URL, // websocket地址 + app_key: '2ce3ce22329517213caa7dad261f5695', + }); + + // 浏览器监听user-1 + const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}`); + user_channel.on('message', function(data) { + console.log("收到消息--", data); + try { + if (timer) clearTimeout(timer); + paySuccessToTabs2() + } catch (error) {} + }); const submit = async () => { if (!formData.real_name) return uni.$u.toast('请填写真实姓名'); if (!formData.mobile) return uni.$u.toast('请填写电话号码'); + if (!formData.code) return uni.$u.toast('请输入短信验证码'); uni.showLoading({ title: '支付中...' }); @@ -469,26 +475,53 @@ getCount() }) } - } - const rePay = (item) => { uni.scanCode({ success: function(res) { + uni.showLoading({ + title: '支付中...' + }); reVipRechargeApi({ id: item.id, auth_code: res.result }).then(res => { - uni.$u.toast('操作成功'); - getCount() - getLists() + timer = setTimeout(() => { + uni.hideLoading(); + uni.$u.toast('支付超时'); + }, 30000) }) } }); - } + // 支付成功后清除formData并且切换tabs2 + const paySuccessToTabs2 = () => { + uni.hideLoading() + uni.showToast({ + title: '支付成功', + duration: 2000, + success() { + currentTab.value = 2 + formData.real_name = '' + formData.mobile = '' + formData.address = '' + formData.label_name = '' + formData.city = '' + formData.area = '' + formData.street = '' + formData.village = '' + formData.brigade = '' + currentAddressIndex.value = 0 + tabsList.forEach(item => { + item.name = '请选择' + }) + getLists() + getCount() + } + }); + } // 邀请用户数 const count = ref(0) @@ -687,4 +720,13 @@ .slot-content { padding-bottom: 50rpx; } + + .code-btn { + display: flex; + align-items: center; + } + + .btn-text { + color: #20B128; + } </style> \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index d497af0..de72004 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -120,6 +120,9 @@ // 微信公众号绑定 const officialCode = () => { + console.log("jinfas") + return + uni.navigateTo({ url: `/pages/code/code?id=${userStore.userInfo.id}`, success: () => { @@ -168,7 +171,6 @@ } else { userStore.setUserInfo(res.data); //再次登录 已有手机号 判断是否员工 - //身份授权成功 核销人员 if (res.data.is_staff == 1) { userStore.setUserInfo(res.data); diff --git a/pagesOrder/setPayPassword/index.vue b/pagesOrder/setPayPassword/index.vue index c113ac9..7cbcee1 100644 --- a/pagesOrder/setPayPassword/index.vue +++ b/pagesOrder/setPayPassword/index.vue @@ -85,10 +85,12 @@ form.password.length < 6 ? form.password += e : showKeyBorad.value = false + if (form.password.length == 6) showKeyBorad.value = false; } else { form.rePassword.length < 6 ? form.rePassword += e : showKeyBorad.value = false + if (form.rePassword.length == 6) showKeyBorad.value = false; } } @@ -102,10 +104,9 @@ // 键盘事件结束 - - const submit = async () => { if (!form.code) return uni.$u.toast('请输入验证码'); + if (form.password.length < 6) return uni.$u.toast('请输入6位数密码'); if (form.password !== form.rePassword) return uni.$u.toast('两次密码不一致'); await setPayPassword({ ...form diff --git a/pagesOrder/settle/settle.vue b/pagesOrder/settle/settle.vue index 4dc095a..d82ee71 100644 --- a/pagesOrder/settle/settle.vue +++ b/pagesOrder/settle/settle.vue @@ -77,50 +77,6 @@ </view> </view> </view> - <view class="m-card good-info"> - <view class="head-title">支付方式</view> - <view class="row"> - <view class="icon-text"> - <up-icon name="weixin-circle-fill" color="#20b128" size="22"></up-icon> - <text style="margin-left: 20rpx;font-size: 26rpx;">微信支付</text> - </view> - <view class="icon" @click="onChoosePaytype(7)"> - <image v-if="pay_type == 7" src="@/static/icon/check.png" /> - <image v-if="pay_type != 7 || pay_type == 3 || pay_type == 18 || !pay_type" - src="@/static/icon/n-check.png" /> - </view> - </view> - - <view class="row" - v-if="userInfo.user_ship == 4 || userInfo.user_ship == 5 || userInfo.user_ship == 6 || userInfo.user_ship == 1"> - <!-- <view class="row"> --> - <view class="icon-text"> - <image src="@/static/icon/YEZF.png" style="width:40rpx;height: 40rpx;" /> - <text style="margin-left: 20rpx;font-size: 26rpx;">余额支付</text> - <text style="margin-left: 20rpx;font-size: 22rpx;color: #FFB76D;">( 可用¥{{userInfo.now_money}} - )</text> - </view> - <view class="icon" @click="onChoosePaytype(3)"> - <image v-if="pay_type == 3" src="@/static/icon/check.png" /> - <image v-if="pay_type != 3 || pay_type == 7 || pay_type == 18 || !pay_type" - src="@/static/icon/n-check.png" /> - </view> - </view> - - <view class="row" v-if="userInfo.user_ship == 1"> - <view class="icon-text"> - <image src="@/static/icon/cgkzf.png" style="width:40rpx;height: 40rpx;" /> - <text style="margin-left: 20rpx;font-size: 26rpx;">采购款支付</text> - <text style="margin-left: 20rpx;font-size: 22rpx;color: #1296DB;">( 可用¥{{userInfo.purchase_funds}} - )</text> - </view> - <view class="icon" @click="onChoosePaytype(18)"> - <image v-if="pay_type == 18" src="@/static/icon/check.png" /> - <image v-if="pay_type != 18 || pay_type == 3 || pay_type == 7 || !pay_type" - src="@/static/icon/n-check.png" /> - </view> - </view> - </view> <view class="m-card order-remark"> <view class="head-title"> @@ -130,22 +86,77 @@ <up-textarea style="background-color: #F6F6F6;" v-model="formData.remark" placeholder="暂无备注内容" :height="40"></up-textarea> </view> - <view style="width: 100%;height: 200rpx;"></view> - <view class="fiexd-btn-box" style="z-index: 999;"> - <view class="tips"> - <view style="margin-right: 20rpx;">共 {{ cartList.length }} 款</view> - <view class="all"> - <text style="color: #000;">合计: </text> - <text>¥</text> - <block v-if="orderInfo.total_price"> - <text style="font-size: 32rpx;font-weight: bold;">{{ c_price(orderInfo.pay_price, 0) }}</text> - <text>.{{ c_price(orderInfo.pay_price, 1) }}</text> - </block> + <view style="width: 100%;height: 500rpx;"></view> + <view class="fiexd-bottom" style="z-index: 999;"> + <view class="pay-type-bottom"> + <view class=" good-info"> + <view class="head-title">支付方式</view> + <view class="row"> + <view class="icon-text"> + <up-icon name="weixin-circle-fill" color="#20b128" size="22"></up-icon> + <text style="margin-left: 20rpx;font-size: 26rpx;">微信支付</text> + </view> + <view class="icon" @click="onChoosePaytype(7)"> + <image v-if="pay_type == 7" src="@/static/icon/check.png" /> + <image v-if="pay_type != 7 || pay_type == 3 || pay_type == 18 || !pay_type" + src="@/static/icon/n-check.png" /> + </view> + </view> + + <view class="row" + v-if="userInfo.user_ship == 4 || userInfo.user_ship == 5 || userInfo.user_ship == 6 || userInfo.user_ship == 1"> + <!-- <view class="row"> --> + <view class="icon-text"> + <image src="@/static/icon/YEZF.png" style="width:40rpx;height: 40rpx;" /> + <text style="margin-left: 20rpx;font-size: 26rpx;">余额支付</text> + <text style="margin-left: 20rpx;font-size: 22rpx;color: #FFB76D;">( + 可用¥{{userInfo.now_money}} + )</text> + </view> + <view class="icon" @click="onChoosePaytype(3)"> + <image v-if="pay_type == 3" src="@/static/icon/check.png" /> + <image v-if="pay_type != 3 || pay_type == 7 || pay_type == 18 || !pay_type" + src="@/static/icon/n-check.png" /> + </view> + </view> + + <view class="row" v-if="userInfo.user_ship == 1"> + <view class="icon-text"> + <image src="@/static/icon/cgkzf.png" style="width:40rpx;height: 40rpx;" /> + <text style="margin-left: 20rpx;font-size: 26rpx;">采购款支付</text> + <text style="margin-left: 20rpx;font-size: 22rpx;color: #1296DB;">( + 可用¥{{userInfo.purchase_funds}} + )</text> + </view> + <view class="icon" @click="onChoosePaytype(18)"> + <image v-if="pay_type == 18" src="@/static/icon/check.png" /> + <image v-if="pay_type != 18 || pay_type == 3 || pay_type == 7 || !pay_type" + src="@/static/icon/n-check.png" /> + </view> + </view> </view> </view> - <view style="width: 200rpx;"> - <up-button color="#20B128" shape="circle" @click="submitOrder" :throttleTime="1000">预付款提交</up-button> + + + <view class="submit-row"> + <view class="tips"> + <view style="margin-right: 20rpx;">共 {{ cartList.length }} 款</view> + <view class="all"> + <text style="color: #000;">合计: </text> + <text>¥</text> + <block v-if="orderInfo.total_price"> + <text + style="font-size: 32rpx;font-weight: bold;">{{ c_price(orderInfo.pay_price, 0) }}</text> + <text>.{{ c_price(orderInfo.pay_price, 1) }}</text> + </block> + </view> + </view> + <view style="width: 200rpx;"> + <up-button color="#20B128" shape="circle" @click="submitOrder" + :throttleTime="1000">预付款提交</up-button> + </view> </view> + </view> <addressPopup ref="addressRef" :show="showAddress" :list="addressList" @close="showAddress = false" @@ -641,4 +652,32 @@ color: white; } } + + .fiexd-bottom { + position: fixed; + bottom: 0; + left: 0; + // height: calc(constant(safe-area-inset-bottom) + 120rpx); + /* 适用于iOS设备 */ + // height: calc(env(safe-area-inset-bottom) + 120rpx); + /* 适用于Android设备 */ + width: 100%; + box-sizing: border-box; + background-color: #fff; + padding: 20rpx; + padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx); + /* 适用于iOS设备 */ + padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx); + /* 适用于Android设备 */ + + .submit-row { + display: flex; + justify-content: space-between; + align-items: center; + } + + .pay-type-bottom { + margin-bottom: 50rpx; + } + } </style> \ No newline at end of file