This commit is contained in:
zmj 2024-06-25 15:34:24 +08:00
parent 002937f5a2
commit e5d13a791f
6 changed files with 213 additions and 125 deletions

View File

@ -142,3 +142,7 @@ 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);
}

View File

@ -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"

View File

@ -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)
})
}
});
}
// formDatatabs2
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>

View File

@ -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);

View File

@ -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

View File

@ -77,7 +77,19 @@
</view>
</view>
</view>
<view class="m-card good-info">
<view class="m-card order-remark">
<view class="head-title">
<text>订单备注</text>
<text>0/200</text>
</view>
<up-textarea style="background-color: #F6F6F6;" v-model="formData.remark" placeholder="暂无备注内容"
:height="40"></up-textarea>
</view>
<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">
@ -97,7 +109,8 @@
<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 style="margin-left: 20rpx;font-size: 22rpx;color: #FFB76D;">(
可用¥{{userInfo.now_money}}
)</text>
</view>
<view class="icon" @click="onChoosePaytype(3)">
@ -111,7 +124,8 @@
<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 style="margin-left: 20rpx;font-size: 22rpx;color: #1296DB;">(
可用¥{{userInfo.purchase_funds}}
)</text>
</view>
<view class="icon" @click="onChoosePaytype(18)">
@ -121,33 +135,30 @@
</view>
</view>
</view>
</view>
<view class="m-card order-remark">
<view class="head-title">
<text>订单备注</text>
<text>0/200</text>
</view>
<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="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
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>
<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"
@change="changeAddress" />
<shopListPopupVue ref="shopRef" :show="shopListShow" :list="merchantList" @close="shopListShow = 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>