zs há 2 anos atrás
pai
commit
1d44a2f0b8
1 ficheiros alterados com 31 adições e 23 exclusões
  1. 31 23
      pagesIntegral/order/index.vue

+ 31 - 23
pagesIntegral/order/index.vue

@@ -202,29 +202,37 @@
 			async toSubmit() {
 				const that = this;
 				if (that.address) {
-					let data = {
-						address: that.address._id,
-						shop: that.shopInfo._id,
-						goods: that.orderInfo._id,
-						buy_num: that.buy_num,
-						remarks: that.remarks
-					}
-					const arr = await that.$api(`/zrOrder`, `POST`, data, `integral`)
-					if (arr.errcode == '0') {
-						uni.hideLoading();
-						uni.showToast({
-							title: arr.data.errmsg || '兑换成功',
-							icon: 'none'
-						})
-						uni.reLaunch({
-							url: `/pagesIntegral/record/index`
-						})
-					} else {
-						uni.showToast({
-							title: arr.data.errmsg || '兑换失败!',
-							icon: 'none'
-						})
-					}
+					uni.showModal({
+						title: '提示',
+						content: '确定兑换该商品吗?',
+						success: async function(res) {
+							if (res.confirm) {
+								let data = {
+									address: that.address._id,
+									shop: that.shopInfo._id,
+									goods: that.orderInfo._id,
+									buy_num: that.buy_num,
+									remarks: that.remarks
+								}
+								const arr = await that.$api(`/zrOrder`, `POST`, data, `integral`)
+								if (arr.errcode == '0') {
+									uni.hideLoading();
+									uni.showToast({
+										title: arr.data.errmsg || '兑换成功',
+										icon: 'none'
+									})
+									uni.reLaunch({
+										url: `/pagesIntegral/record/index`
+									})
+								} else {
+									uni.showToast({
+										title: arr.data.errmsg || '兑换失败!',
+										icon: 'none'
+									})
+								}
+							}
+						}
+					});
 				} else {
 					uni.showToast({
 						title: `没有收货地址`,