Fix(订单):[#3256]商详页直接进入提交订单页面,默认地址显示为上一次购买商品时选择的地址信息

This commit is contained in:
lifizer
2025-07-17 09:52:58 +08:00
parent 588fd5e687
commit 57c62416c5
2 changed files with 239 additions and 245 deletions
+8
View File
@@ -3,6 +3,14 @@
* */ * */
import request from "@/utils/request"; import request from "@/utils/request";
/**
* 获取默认地址
* @returns {*}
*/
export function getAddressDefaultSelected() {
return request.get("/address/defaultSelected")
}
/** /**
* 通过购物车 id 获取订单信息 * 通过购物车 id 获取订单信息
* @param cartId * @param cartId
+150 -164
View File
@@ -1,15 +1,16 @@
<template> <template>
<view class="order-submission" style="padding: 30rpx;"> <view class="order-submission" style="padding: 30rpx;">
<view class="allAddress" style="background-color: #f6f6f6;"> <view class="allAddress" style="background-color: #f6f6f6;">
<view <view
v-if="shipping_type === 0"
class="address acea-row v12-align-start" class="address acea-row v12-align-start"
style="flex-wrap: nowrap;margin: 0 0 30rpx 0;border-radius: 16rpx;" style="flex-wrap: nowrap;margin: 0 0 30rpx 0;border-radius: 16rpx;"
v-if="shipping_type === 0"
@click="addressTap" @click="addressTap"
> >
<image style="flex-shrink: 0;width: 36rpx;height: 36rpx;margin-right: 20rpx;" <image
:src="webUrl+'/orderIcon/map.png'" mode=""></image> :src="webUrl+'/orderIcon/map.png'"
style="flex-shrink: 0;width: 36rpx;height: 36rpx;margin-right: 20rpx;"
/>
<view class="acea-row row-between-wrapper" style="flex-wrap: nowrap;flex-grow: 1;"> <view class="acea-row row-between-wrapper" style="flex-wrap: nowrap;flex-grow: 1;">
<view class="addressCon" v-if="addressInfo.realName"> <view class="addressCon" v-if="addressInfo.realName">
<view class="more-t"> <view class="more-t">
@@ -25,32 +26,35 @@
</view> </view>
</view> </view>
</view> </view>
<div style="flex-wrap: nowrap;" class="address acea-row row-middle" v-else @click="showStoreList"> <div
v-else
<image style="flex-shrink: 0;width: 48rpx;height: 48rpx;margin-right: 20rpx;" style="flex-wrap: nowrap;"
:src="webUrl+'/20230304135530688212.png'" mode=""></image> class="address acea-row row-middle"
@click="showStoreList"
>
<image
:src="webUrl+'/20230304135530688212.png'"
style="flex-shrink: 0;width: 48rpx;height: 48rpx;margin-right: 20rpx;"
/>
<view class="acea-row row-between-wrapper" style="flex-wrap: nowrap;flex-grow: 1;"> <view class="acea-row row-between-wrapper" style="flex-wrap: nowrap;flex-grow: 1;">
<div class="addressCon"> <div class="addressCon">
<div class="name"> <div class="name">
{{ isNullOrEmpty(storeItems) ? systemStore.name : storeItems.name }} {{ isNullOrEmpty(storeItems) ? systemStore.name : storeItems.name }}
<span <span class="phone">{{ isNullOrEmpty(storeItems) ? systemStore.phone : storeItems.phone }}</span>
class="phone"
>{{ isNullOrEmpty(storeItems) ? systemStore.phone : storeItems.phone }}</span>
</div> </div>
<div>{{ isNullOrEmpty(storeItems) ? systemStore.address : storeItems.address }}</div> <div>{{ isNullOrEmpty(storeItems) ? systemStore.address : storeItems.address }}</div>
</div> </div>
<div class="iconfont icon-jiantou"></div> <div class="iconfont icon-jiantou"></div>
</view> </view>
</div> </div>
</view> </view>
<OrderGoods
<OrderGoods :evaluate="0" :cartInfo="orderGroupInfo.cartInfo" title="商品信息"></OrderGoods> :evaluate="0"
:cartInfo="orderGroupInfo.cartInfo"
title="商品信息"
/>
<view class="wrapper" style="margin:0;border-radius:0 0 20rpx 20rpx"> <view class="wrapper" style="margin:0;border-radius:0 0 20rpx 20rpx">
<view v-if="shipping_type === 0" class="v12-pa-2 acea-row row-between-wrapper" style="flex-wrap: nowrap;">
<view class="v12-pa-2 acea-row row-between-wrapper" style="flex-wrap: nowrap;" v-if="shipping_type === 0">
<view class="acea-row row-middle" style="flex-wrap: nowrap;"> <view class="acea-row row-middle" style="flex-wrap: nowrap;">
<!-- <image style="width: 32rpx;height: 32rpx;margin-right: 12rpx;" :src="webUrl+'/20210807230820761721.png'" <!-- <image style="width: 32rpx;height: 32rpx;margin-right: 12rpx;" :src="webUrl+'/20210807230820761721.png'"
mode=""></image> --> mode=""></image> -->
@@ -64,13 +68,22 @@
<view class="v12-pa-2 acea-row row-between-wrapper"> <view class="v12-pa-2 acea-row row-between-wrapper">
<view class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx">联系人</view> <view class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx">联系人</view>
<view class="discount"> <view class="discount">
<input class="v12-font-24" type="text" placeholder="请填写您的联系姓名" v-model="contacts"/> <input
v-model="contacts"
class="v12-font-24"
type="text"
placeholder="请填写您的联系姓名"
/>
</view> </view>
</view> </view>
<view class="v12-pa-2 acea-row row-between-wrapper"> <view class="v12-pa-2 acea-row row-between-wrapper">
<view class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx">联系电话</view> <view class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx">联系电话</view>
<view class="discount"> <view class="discount">
<input type="text" placeholder="请填写您的联系电话" v-model="contactsTel"/> <input
v-model="contactsTel"
type="text"
placeholder="请填写您的联系电话"
/>
</view> </view>
</view> </view>
</view> </view>
@@ -80,7 +93,11 @@
mode=""></image> --> mode=""></image> -->
<text class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx;">备注</text> <text class="v12-font-24 v12-secondary-dark-text v12-pr-3 v12-text-right" style="width: 140rpx;">备注</text>
</view> </view>
<textarea v-model="mark" placeholder="建议与商家协商一致" class="mark v12-font-24 "></textarea> <textarea
v-model="mark"
placeholder="建议与商家协商一致"
class="mark v12-font-24 "
/>
</view> </view>
</view> </view>
<!-- v12 --> <!-- v12 -->
@@ -180,11 +197,11 @@
</view> </view>
<view class="list" style="margin-top: 0;"> <view class="list" style="margin-top: 0;">
<view <view
class="payItem acea-row row-middle"
:class="active === 'weixin' ? 'on' : ''"
v-show="isWeixin" v-show="isWeixin"
@click="payItem('weixin')" :class="active === 'weixin' ? 'on' : ''"
class="payItem acea-row row-middle"
style="flex-wrap: nowrap; margin-top: 0" style="flex-wrap: nowrap; margin-top: 0"
@click="payItem('weixin')"
> >
<view class="name acea-row v12-font-24"> <view class="name acea-row v12-font-24">
<!-- <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view> --> <!-- <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view> -->
@@ -198,11 +215,11 @@
</label> </label>
</view> </view>
<view <view
class="payItem acea-row row-middle"
:class="active === 'weixin' ? 'on' : ''"
@click="payItem('weixin')"
v-show="!isWeixin" v-show="!isWeixin"
:class="active === 'weixin' ? 'on' : ''"
class="payItem acea-row row-middle"
style="flex-wrap: nowrap; margin-top: 20rpx" style="flex-wrap: nowrap; margin-top: 20rpx"
@click="payItem('weixin')"
> >
<view class="name acea-row v12-font-24"> <view class="name acea-row v12-font-24">
<!-- <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view> --> <!-- <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view> -->
@@ -214,13 +231,12 @@
<radio style="transform: scale(0.7);" value="" :checked="active === 'weixin'" color="#C52733"/> <radio style="transform: scale(0.7);" value="" :checked="active === 'weixin'" color="#C52733"/>
<text></text> <text></text>
</label> </label>
</view> </view>
<view <view
class="payItem acea-row row-middle v12-justify-between"
:class="active === 'yue' ? 'on' : ''" :class="active === 'yue' ? 'on' : ''"
@click="payItem('yue')" class="payItem acea-row row-middle v12-justify-between"
style="flex-wrap: nowrap;" style="flex-wrap: nowrap;"
@click="payItem('yue')"
> >
<view class="name acea-row v12-font-24"> <view class="name acea-row v12-font-24">
<!-- <view style="background-color: #007AFF;" class="iconfont icon-icon-test" <!-- <view style="background-color: #007AFF;" class="iconfont icon-icon-test"
@@ -233,13 +249,10 @@
<radio style="transform: scale(0.7);" value="" :checked="active === 'yue'" color="#C52733"/> <radio style="transform: scale(0.7);" value="" :checked="active === 'yue'" color="#C52733"/>
<text></text> <text></text>
</label> </label>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- v9 优惠券开始 --> <!-- v9 优惠券开始 -->
<u-popup <u-popup
:show="show" :show="show"
@@ -260,7 +273,6 @@
/> />
</u-popup> </u-popup>
<!-- v9 优惠券结束 --> <!-- v9 优惠券结束 -->
<view style="height:80rpx"></view> <view style="height:80rpx"></view>
<view class="footer v12-justify-end v12-px-3" style="height: 120rpx;"> <view class="footer v12-justify-end v12-px-3" style="height: 120rpx;">
<view class="v12-align-center v12-px-4"> <view class="v12-align-center v12-px-4">
@@ -301,19 +313,24 @@
<script> <script>
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard' import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
import OrderGoods from "@/components/OrderGoods"; import OrderGoods from "@/components/OrderGoods"
import AddressWindow from "@/components/AddressWindow"; import AddressWindow from "@/components/AddressWindow"
import {createOrder, postOrderComputed, postOrderConfirm} from "@/api/order"; import {
import {mapGetters} from "vuex"; createOrder,
import {weappPay} from "@/libs/wechat"; postOrderComputed,
import {isNullOrEmpty, isWeixin} from "@/utils"; postOrderConfirm,
import blPaymentPasswordInput from '@/components/blPaymentPasswordInput.vue'; getAddressDefaultSelected
import uniPopup from '@/components/uni-popup/uni-popup.vue'; } from "@/api/order"
import {mapGetters} from "vuex"
import {weappPay} from "@/libs/wechat"
import {isNullOrEmpty, isWeixin} from "@/utils"
import blPaymentPasswordInput from '@/components/blPaymentPasswordInput.vue'
import uniPopup from '@/components/uni-popup/uni-popup.vue'
import CouponsPopup from "@/components/CouponsPopup.vue" import CouponsPopup from "@/components/CouponsPopup.vue"
import { pageListenMixins } from '@/mixins/pageListenMixins' import { pageListenMixins } from '@/mixins/pageListenMixins'
const NAME = "OrderSubmission", const NAME = "OrderSubmission"
_isWeixin = isWeixin(); const _isWeixin = isWeixin()
export default { export default {
name: NAME, name: NAME,
components: { components: {
@@ -377,16 +394,16 @@ export default {
pageKeyId: Object.freeze('orderConfirm'), pageKeyId: Object.freeze('orderConfirm'),
total: 0, total: 0,
couponTitle: '', couponTitle: '',
hasCoupon: false, hasCoupon: false
}; }
}, },
computed: mapGetters(["userInfo", "storeItems"]), computed: mapGetters(["userInfo", "storeItems"]),
watch: { watch: {
useIntegral() { useIntegral() {
this.computedPrice('useIntegral'); this.computedPrice('useIntegral')
}, },
shipping_type() { shipping_type() {
this.computedPrice('shipping_type'); this.computedPrice('shipping_type')
}, },
async couponId(value) { async couponId(value) {
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === +value) this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === +value)
@@ -395,7 +412,6 @@ export default {
} }
}, },
onLoad(opts) { onLoad(opts) {
console.log(opts);
const that = this const that = this
if (that.$yroute.query.pinkid !== undefined) { if (that.$yroute.query.pinkid !== undefined) {
that.pinkId = that.$yroute.query.pinkid that.pinkId = that.$yroute.query.pinkid
@@ -408,43 +424,27 @@ export default {
that.lotteryRecordId = that.$yroute.query.lotteryRecordId that.lotteryRecordId = that.$yroute.query.lotteryRecordId
} }
that.hasCoupon = opts.couponId !== '' that.hasCoupon = opts.couponId !== ''
that.getCartInfo()
}, },
onShow() { onShow() {
const _this = this const _this = this
_this.getCartInfo()
//获取用户信息 //获取用户信息
_this.$store.dispatch("getUser", true) _this.$store.dispatch("getUser", true)
// 监听到选择收货地址 // 监听到选择收货地址
const chooseAddress = uni.getStorageSync('chooseAddress') || {} const chooseAddress = uni.getStorageSync('chooseAddress') || {}
const sourceAddress = uni.getStorageSync('sourceAddress') || {} // const sourceAddress = uni.getStorageSync('sourceAddress') || {}
// 监听到选择收货地址 // 监听到选择收货地址
if (chooseAddress.id && (chooseAddress.id !== sourceAddress.id)) { if (chooseAddress.id) {
_this.addressInfo = chooseAddress _this.addressInfo = chooseAddress
// 地址切换也要重新计算一下 // 地址切换也要重新计算一下
uni.setStorageSync('sourceAddress', _this.addressInfo || '') // uni.setStorageSync('sourceAddress', _this.addressInfo || '')
uni.setStorageSync('sourceAddress', {})
_this.computedPrice('onLoad chooseAddress') _this.computedPrice('onLoad chooseAddress')
setTimeout(() => { setTimeout(() => {
uni.hideLoading() uni.hideLoading()
uni.setStorageSync('chooseAddress', {}) uni.setStorageSync('chooseAddress', {})
}, 1000) }, 1000)
// uni.showModal({
// title:'确定修改地址吗?',
// content: '',
// showCancel: true,
// cancelText: '取消',
// confirmText: '确认',
// success: (res) => {
// if(res.confirm) {
// }
// },
// complete: () => {
// uni.hideLoading()
// uni.setStorageSync('chooseAddress', {})
// }
// })
} }
}, },
methods: { methods: {
isNullOrEmpty, isNullOrEmpty,
@@ -453,26 +453,25 @@ export default {
this.couponId = this.$yroute.query.couponId || uni.getStorageSync('couponId') || 0 this.couponId = this.$yroute.query.couponId || uni.getStorageSync('couponId') || 0
}, },
showStoreList() { showStoreList() {
this.$store.commit("get_to", "orders"); this.$store.commit("get_to", "orders")
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/shop/StoreList/index" path: "/pages/shop/StoreList/index"
}); })
}, },
force2Decimal(value) { force2Decimal(value) {
return this.$force2Decimal(value); return this.$force2Decimal(value)
}, },
usePointsCheckChange(e) { usePointsCheckChange(e) {
this.computedPrice() this.computedPrice()
}, },
// 计算订单金额 // 计算订单金额
computedPrice(f) { computedPrice(f) {
let shipping_type = this.shipping_type;
postOrderComputed(this.orderGroupInfo.orderKey, { postOrderComputed(this.orderGroupInfo.orderKey, {
addressId: this.addressInfo.id, addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0, useIntegral: this.useIntegral ? 1 : 0,
couponId: this.couponList.usable.length === 0 ? 0 : this.couponId || 0, couponId: this.couponList.usable.length === 0 ? 0 : this.couponId || 0,
usePoints: this.usePointsCheck ? 1 : 0, usePoints: this.usePointsCheck ? 1 : 0,
shipping_type: parseInt(shipping_type) + 1 shipping_type: parseInt(this.shipping_type) + 1
}).then(res => { }).then(res => {
const data = res.data; const data = res.data;
if (data.status === "EXTEND_ORDER") { if (data.status === "EXTEND_ORDER") {
@@ -481,18 +480,16 @@ export default {
query: { query: {
id: data.result.orderId id: data.result.orderId
} }
}); })
} else { } else {
this.orderPrice = data.result; this.orderPrice = data.result;
console.log(this.orderPrice);
if (this.usePointsCheck) { if (this.usePointsCheck) {
this.usePointsNumber = data.result.usedPoints this.usePointsNumber = data.result.usedPoints
} else { } else {
this.usePointsNumber = 0 this.usePointsNumber = 0
} }
} }
}); })
}, },
getCartInfo() { getCartInfo() {
const _this = this const _this = this
@@ -532,17 +529,18 @@ export default {
_this.usePointsCheck = true _this.usePointsCheck = true
_this.usePointsNumber = data.maxPoints _this.usePointsNumber = data.maxPoints
} }
if(_this.$yroute.query.address !== undefined ) {
_this.addressInfo = JSON.parse(_this.$yroute.query.address) || {}
} else {
_this.addressInfo = uni.getStorageSync('sourceAddress') || data.addressInfo || {}
console.log(data.addressInfo);
}
_this.systemStore = data.systemStore || {} _this.systemStore = data.systemStore || {}
_this.storeSelfMention = data.storeSelfMention _this.storeSelfMention = data.storeSelfMention
if(_this.$yroute.query.address !== undefined ) {
_this.addressInfo = JSON.parse(_this.$yroute.query.address) || {}
_this.computedPrice() _this.computedPrice()
} else {
// _this.addressInfo = uni.getStorageSync('sourceAddress') || data.addressInfo || {}
getAddressDefaultSelected().then(res => {
_this.addressInfo = res.data
_this.computedPrice()
})
}
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
title: err.msg, title: err.msg,
@@ -552,32 +550,33 @@ export default {
}) })
}, },
addressTap: function () { addressTap: function () {
//改用跳转页面方式 uni.setStorageSync('sourceAddress', this.addressInfo)
// 改用跳转页面方式
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/user/address/AddressManagement/index", path: "/pages/user/address/AddressManagement/index",
query: { query: {
choosMode: 1 choosMode: 1
} }
}); })
}, },
addressRedirect() { addressRedirect() {
this.addressLoaded = false; this.addressLoaded = false
this.showAddress = false; this.showAddress = false
}, },
payItem: function (index) { payItem: function (index) {
this.active = index; this.active = index
}, },
changeAddress(addressInfo) { changeAddress(addressInfo) {
this.addressInfo = addressInfo; this.addressInfo = addressInfo
//地址切换也要重新计算一下 //地址切换也要重新计算一下
this.computedPrice('changeAddress'); this.computedPrice('changeAddress')
}, },
pwdPopClose() { pwdPopClose() {
this.isShowPayPwdPop = false; this.isShowPayPwdPop = false
}, },
pwdPopFinish(payPwd) { pwdPopFinish(payPwd) {
this.payPassword = payPwd; this.payPassword = payPwd
this.createOrder(true); this.createOrder(true)
}, },
//支付密码输入监听 //支付密码输入监听
onInput(e) { onInput(e) {
@@ -585,36 +584,38 @@ export default {
}, },
// 支付密码输入确认 // 支付密码输入确认
onConfirm(e) { onConfirm(e) {
this.payPassword = e.value; this.payPassword = e.value
this.$refs.popup.close();//关闭支付密码弹窗 this.$refs.popup.close()
this.$refs.secrity.clear();//清空支付密码 this.$refs.secrity.clear()
this.createOrder(true); this.createOrder(true)
}, },
subscribePay() { subscribePay() {
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds: ['7O3wKw7_D4t7yfSOlvecKuOQP8QEPY88uBx2FJg43HE', 'TSmTnGibZ8IxWCiRWOvLxha6-0u7tE-V1-WbDCiPkKU', '9Q6xLHe6HyjkU5Zn5k_2zxYPf2y4MxVyUbOSW8pcZRU'], tmplIds: [
'7O3wKw7_D4t7yfSOlvecKuOQP8QEPY88uBx2FJg43HE',
'TSmTnGibZ8IxWCiRWOvLxha6-0u7tE-V1-WbDCiPkKU',
'9Q6xLHe6HyjkU5Zn5k_2zxYPf2y4MxVyUbOSW8pcZRU'
],
complete: () => this.createOrder(false) complete: () => this.createOrder(false)
}) })
}, },
createOrder(isyue) { createOrder(isyue) {
let shipping_type = this.shipping_type;
if (!this.active) { if (!this.active) {
uni.showToast({ uni.showToast({
title: "请选择支付方式", title: "请选择支付方式",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
return; return
} }
if (!this.addressInfo.id && !this.shipping_type) { if (!this.addressInfo.id && !this.shipping_type) {
uni.showToast({ uni.showToast({
title: "请选择收货地址", title: "请选择收货地址",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
return; return
} }
if (this.shipping_type) { if (this.shipping_type) {
if ( if (
(this.contacts === "" || this.contactsTel === "") && (this.contacts === "" || this.contactsTel === "") &&
@@ -624,16 +625,15 @@ export default {
title: "请填写联系人或联系人电话", title: "请填写联系人或联系人电话",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
return; return;
} }
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) { if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) {
uni.showToast({ uni.showToast({
title: "请填写正确的手机号", title: "请填写正确的手机号",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
return; return;
} }
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) { if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) {
@@ -641,41 +641,36 @@ export default {
title: "请填写您的真实姓名", title: "请填写您的真实姓名",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
return; return
} }
} }
// 判断如果是余额支付,先要输入支付密码
//判断如果是余额支付,先要输入支付密码
if (this.active == 'yue' && !isyue) { if (this.active == 'yue' && !isyue) {
//先判断用户是否绑定过手机 // 先判断用户是否绑定过手机
if (this.userInfo.phone) { if (this.userInfo.phone) {
//再判断用户是否设置过支付密码 // 再判断用户是否设置过支付密码
if (this.userInfo.hasPwdPay) { if (this.userInfo.hasPwdPay) {
//显示输入支付密码 // 显示输入支付密码
this.isShowPayPwdPop = true; this.isShowPayPwdPop = true
} else { } else {
//设置支付密码 // 设置支付密码
this.$yrouter.push("/pkg_user/views/payPassword?isSetMode=true"); this.$yrouter.push("/pkg_user/views/payPassword?isSetMode=true")
} }
} else { } else {
//跳转到绑定手机 // 跳转到绑定手机
this.$yrouter.push("/pkg_user/views/bindPhone"); this.$yrouter.push("/pkg_user/views/bindPhone")
} }
return
return;
} }
uni.showLoading({ uni.showLoading({
title: "生成订单中" title: "生成订单中"
}); })
let from = {}; let from = {}
if (this.$deviceType == "app") { if (this.$deviceType == "app") {
from.from = "app"; from.from = "app"
} }
console.log(this.storeItems, this.systemStore); const params = {
var params = {
realName: this.contacts, realName: this.contacts,
phone: this.contactsTel, phone: this.contactsTel,
addressId: this.addressInfo.id, addressId: this.addressInfo.id,
@@ -696,15 +691,13 @@ export default {
uni.setStorageSync('chooseAddress', {}) uni.setStorageSync('chooseAddress', {})
//余额支付的支付密码 //余额支付的支付密码
if (this.active == 'yue') { if (this.active == 'yue') {
params.passwordPay = this.payPassword; params.passwordPay = this.payPassword
} }
uni.removeStorageSync('couponId') uni.removeStorageSync('couponId')
var that = this
var that = this; createOrder(this.orderGroupInfo.orderKey, params).then(res => {
createOrder(this.orderGroupInfo.orderKey, params) uni.hideLoading()
.then(res => { const data = res.data
uni.hideLoading();
const data = res.data;
switch (data.status) { switch (data.status) {
case "ORDER_EXIST": case "ORDER_EXIST":
case "EXTEND_ORDER": case "EXTEND_ORDER":
@@ -712,23 +705,22 @@ export default {
title: res.msg, title: res.msg,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId
} }
}); })
break; break;
case "PAY_DEFICIENCY": case "PAY_DEFICIENCY":
break; break;
case "PAY_ERROR": case "PAY_ERROR":
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
@@ -741,13 +733,13 @@ export default {
title: res.msg, title: res.msg,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
id: data.result.orderId id: data.result.orderId
} }
}); })
break; break;
case "WECHAT_H5_PAY": case "WECHAT_H5_PAY":
// H5支付 // H5支付
@@ -756,10 +748,7 @@ export default {
query: { query: {
id: data.result.orderId id: data.result.orderId
} }
}); })
setTimeout(() => {
// location.href = data.result.jsConfig.mweb_url;
}, 100);
break; break;
case "WECHAT_PAY": case "WECHAT_PAY":
// 小程序支付 // 小程序支付
@@ -769,10 +758,9 @@ export default {
query: { query: {
id: data.result.orderId id: data.result.orderId
} }
}); })
}); })
break; break;
case "WECHAT_APP_PAY": case "WECHAT_APP_PAY":
// APP支付 // APP支付
weappPay(data.result.jsConfig).finally(() => { weappPay(data.result.jsConfig).finally(() => {
@@ -782,26 +770,24 @@ export default {
id: data.result.orderId id: data.result.orderId
} }
}); });
}); })
break; break;
} }
}) }).catch(err => {
.catch(err => { uni.hideLoading()
uni.hideLoading();
uni.showToast({ uni.showToast({
title: title: err.msg ||
err.msg ||
err.response.data.msg || err.response.data.msg ||
err.response.data.message || err.response.data.message ||
"创建订单失败", "创建订单失败",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); })
}).finally(function () { }).finally(function () {
that.isShowPayPwdPop = false; that.isShowPayPwdPop = false
that.$refs.payPwdPop.clear();//清空支付密码 that.$refs.payPwdPop.clear()
that.$refs.payPwdPop.close();//关闭支付密码弹窗 that.$refs.payPwdPop.close()
}); })
}, },
close() { close() {
this.show = !this.show this.show = !this.show
@@ -813,7 +799,7 @@ export default {
this.show = !this.show this.show = !this.show
this.couponId = uni.getStorageSync('couponId') || 0 this.couponId = uni.getStorageSync('couponId') || 0
this.couponTitle = item.couponTitle this.couponTitle = item.couponTitle
}, }
} }
}; };
</script> </script>