|
|
@@ -9,7 +9,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="arrow-box">
|
|
|
- <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/arrow_gray.png" mode=""></image>
|
|
|
+ <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/arrow_gray.png"
|
|
|
+ mode=""></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="address-box" v-if="address!=null" @click="openAddress()">
|
|
|
@@ -23,7 +24,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="arrow-box">
|
|
|
- <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/arrow_gray.png" mode=""></image>
|
|
|
+ <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/arrow_gray.png"
|
|
|
+ mode=""></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -45,7 +47,8 @@
|
|
|
</view>
|
|
|
<view class="right">
|
|
|
<text class="text">{{couponText}}</text>
|
|
|
- <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/arrow4.png" mode=""></image>
|
|
|
+ <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/arrow4.png"
|
|
|
+ mode=""></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="points">
|
|
|
@@ -58,6 +61,13 @@
|
|
|
<text class="text" v-if="address==null">--</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+ <!-- 备注 -->
|
|
|
+ <view class="remarks">
|
|
|
+ <input type="text" v-model="form.mark" placeholder="备注留言(选填)" placeholder-class="input" />
|
|
|
+ </view>
|
|
|
+
|
|
|
+
|
|
|
<view class="points">
|
|
|
<view class="left">
|
|
|
<text class="text">合计</text>
|
|
|
@@ -89,9 +99,11 @@
|
|
|
<div class="item acea-row row-center-wrapper" v-for="(item, index) in couponsList" :key="index">
|
|
|
<div class="money">
|
|
|
<image v-if="item.status==0&&item.useMinPrice<=orderData.totalPrice" class="img"
|
|
|
- src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/coupon1.png" mode="widthFix"></image>
|
|
|
+ src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/coupon1.png"
|
|
|
+ mode="widthFix"></image>
|
|
|
<image v-if="item.status!=0||item.useMinPrice>orderData.totalPrice" class="img"
|
|
|
- src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/coupon2.png" mode="widthFix"></image>
|
|
|
+ src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/coupon2.png"
|
|
|
+ mode="widthFix"></image>
|
|
|
<div style="z-index: 999;">
|
|
|
¥<span class="num">{{ item.couponPrice }}</span>
|
|
|
</div>
|
|
|
@@ -114,7 +126,8 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<view v-if="couponsList.length == 0" class="no-data-box">
|
|
|
- <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/no_data.png" mode="aspectFit"></image>
|
|
|
+ <image src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/no_data.png"
|
|
|
+ mode="aspectFit"></image>
|
|
|
<view class="empty-title">暂无数据</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -142,7 +155,7 @@
|
|
|
data() {
|
|
|
return {
|
|
|
orderData: {
|
|
|
- totalPrice:null
|
|
|
+ totalPrice: null
|
|
|
},
|
|
|
cityId: null,
|
|
|
address: null,
|
|
|
@@ -163,21 +176,21 @@
|
|
|
confirmParam: [],
|
|
|
type: '',
|
|
|
isFirstLoad: true,
|
|
|
- recordId:''
|
|
|
+ recordId: ''
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onLoad(options) {
|
|
|
console.log("确认订单", options)
|
|
|
- this.orderKey = options.orderKey||'';
|
|
|
- this.liveId = options.liveId||'';
|
|
|
- this.goodsId = options.goodsId||'';
|
|
|
- this.productId = options.productId||'';
|
|
|
+ this.orderKey = options.orderKey || '';
|
|
|
+ this.liveId = options.liveId || '';
|
|
|
+ this.goodsId = options.goodsId || '';
|
|
|
+ this.productId = options.productId || '';
|
|
|
this.totalNum = Number(options.totalNum) || 0;
|
|
|
this.type = options.type;
|
|
|
this.isFirstLoad = true;
|
|
|
- this.recordId=options.recordId||'';
|
|
|
-
|
|
|
+ this.recordId = options.recordId || '';
|
|
|
+
|
|
|
if (options.type == 'win') {
|
|
|
this.getKey()
|
|
|
}
|
|
|
@@ -189,7 +202,7 @@
|
|
|
this.address = e;
|
|
|
this.addressId = e.addressId;
|
|
|
this.cityId = e.cityId;
|
|
|
- console.log("地址",e.cityId)
|
|
|
+ console.log("地址", e.cityId)
|
|
|
});
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -285,14 +298,14 @@
|
|
|
computedRewardOrder() {
|
|
|
let data = {
|
|
|
cityId: this.cityId || '',
|
|
|
- productId: this.productId ,
|
|
|
+ productId: this.productId,
|
|
|
orderKey: this.orderKey,
|
|
|
totalNum: 1,
|
|
|
}
|
|
|
computedReward(data).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
console.log("查询创建订单信息>>>>", res.data)
|
|
|
- this.orderData = res.data||{}
|
|
|
+ this.orderData = res.data || {}
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
@@ -324,47 +337,48 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- return createliveOrder(data).then(res => {
|
|
|
+ return createliveOrder(data).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
this.orderList = res.order;
|
|
|
- return res.order;
|
|
|
+ return res.order;
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
icon: 'none'
|
|
|
});
|
|
|
- throw new Error(res.msg);
|
|
|
+ throw new Error(res.msg);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
// 创建抽奖订单
|
|
|
createRewardOrder() {
|
|
|
- let data = {
|
|
|
- cityId: this.cityId,
|
|
|
- liveId: this.liveId,
|
|
|
- orderKey: this.orderKey,
|
|
|
- userName: this.address.realName,
|
|
|
- userPhone: this.address.phone,
|
|
|
- userAddress: this.address.province + ' ' + this.address.city + ' ' + this.address.district + ' ' + this.address.detail,
|
|
|
- cartId: "5",
|
|
|
- productId: this.productId,
|
|
|
- totalNum: 1,
|
|
|
- couponUserId: this.couponUserId,
|
|
|
- recordId:this.recordId
|
|
|
- }
|
|
|
-
|
|
|
- return createReward(data).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.orderList = res.order || {};
|
|
|
- return res.order || {};
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- throw new Error(res.msg);
|
|
|
- }
|
|
|
- });
|
|
|
+ let data = {
|
|
|
+ cityId: this.cityId,
|
|
|
+ liveId: this.liveId,
|
|
|
+ orderKey: this.orderKey,
|
|
|
+ userName: this.address.realName,
|
|
|
+ userPhone: this.address.phone,
|
|
|
+ userAddress: this.address.province + ' ' + this.address.city + ' ' + this.address.district + ' ' +
|
|
|
+ this.address.detail,
|
|
|
+ cartId: "5",
|
|
|
+ productId: this.productId,
|
|
|
+ totalNum: 1,
|
|
|
+ couponUserId: this.couponUserId,
|
|
|
+ recordId: this.recordId
|
|
|
+ }
|
|
|
+
|
|
|
+ return createReward(data).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.orderList = res.order || {};
|
|
|
+ return res.order || {};
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ throw new Error(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
couponSelect(item) {
|
|
|
this.couponText = "-¥" + (item.couponPrice || 0).toFixed(2);
|
|
|
@@ -382,7 +396,7 @@
|
|
|
if (this.couponsList.length === 0 || !this.isFirstLoad) {
|
|
|
return;
|
|
|
}
|
|
|
- const availableCoupons = this.couponsList.filter(item =>
|
|
|
+ const availableCoupons = this.couponsList.filter(item =>
|
|
|
item.status === 0 && item.useMinPrice <= (this.orderData.totalPrice || 0)
|
|
|
);
|
|
|
if (availableCoupons.length === 0) {
|
|
|
@@ -392,7 +406,7 @@
|
|
|
const maxCoupon = availableCoupons[0];
|
|
|
this.couponText = "-¥" + (maxCoupon.couponPrice || 0).toFixed(2);
|
|
|
this.couponUserId = maxCoupon.id;
|
|
|
-
|
|
|
+
|
|
|
console.log('自动选择最大优惠券:', maxCoupon);
|
|
|
this.isFirstLoad = false;
|
|
|
// 重新计算订单价格
|
|
|
@@ -428,39 +442,39 @@
|
|
|
},
|
|
|
// 提交订单
|
|
|
async submitOrder() {
|
|
|
- try {
|
|
|
- if (this.orderKey == null) {
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: '订单KEY不存在',
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.address == null) {
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: '收货地址不能为空',
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- let orderList;
|
|
|
- if (this.type == "win") {
|
|
|
- orderList = await this.createRewardOrder(); // 中奖订单
|
|
|
- } else {
|
|
|
- orderList = await this.createLiveOrder(); // 购买订单
|
|
|
- }
|
|
|
- console.log("orderList>>", orderList)
|
|
|
- const orderListStr = encodeURIComponent(JSON.stringify(orderList));
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages_shopping/live/paymentOrder?orderList=${orderListStr}&couponUserId=${this.couponUserId}&type=${this.type}`
|
|
|
- });
|
|
|
- } catch (error) {
|
|
|
- console.error('提交订单错误:', error);
|
|
|
- uni.showToast({
|
|
|
- title: error.message || '提交订单失败',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- }
|
|
|
+ try {
|
|
|
+ if (this.orderKey == null) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '订单KEY不存在',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.address == null) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '收货地址不能为空',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let orderList;
|
|
|
+ if (this.type == "win") {
|
|
|
+ orderList = await this.createRewardOrder(); // 中奖订单
|
|
|
+ } else {
|
|
|
+ orderList = await this.createLiveOrder(); // 购买订单
|
|
|
+ }
|
|
|
+ console.log("orderList>>", orderList)
|
|
|
+ const orderListStr = encodeURIComponent(JSON.stringify(orderList));
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages_shopping/live/paymentOrder?orderList=${orderListStr}&couponUserId=${this.couponUserId}&type=${this.type}`
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.error('提交订单错误:', error);
|
|
|
+ uni.showToast({
|
|
|
+ title: error.message || '提交订单失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
@@ -549,6 +563,31 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ .remarks {
|
|
|
+ height: 88upx;
|
|
|
+ padding: 0 30upx;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 16upx;
|
|
|
+ margin-top: 20upx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ input {
|
|
|
+ width: 100%;
|
|
|
+ font-size: 28upx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #000000;
|
|
|
+ }
|
|
|
+
|
|
|
+ .input {
|
|
|
+ font-size: 28upx;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #999999;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.points {
|
|
|
height: 88rpx;
|
|
|
padding: 0 30rpx;
|