|
|
@@ -5,7 +5,7 @@
|
|
|
<view class="flex align-center">
|
|
|
<image src="../../../static/tabbar/index.png" style="width: 40rpx;height: 37rpx;" mode=""></image>
|
|
|
<view class="text-xl text-bold text-black margin-lr-xs">{{goodsShop.shopName}}</view>
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
<!-- <image src="../../../static/images/index/right.png" style="width: 14rpx;height: 24rpx;" mode=""></image> -->
|
|
|
@@ -179,6 +179,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ dataList:[],
|
|
|
orderType: 2,
|
|
|
shopId: '',
|
|
|
tuiguangImg: '',
|
|
|
@@ -198,6 +199,7 @@
|
|
|
this.shopId = e.shopId
|
|
|
this.orderId = e.orderId ? e.orderId : uni.getStorageSync('orderId')
|
|
|
this.userId = uni.getStorageSync('userId')
|
|
|
+ this.getData();
|
|
|
},
|
|
|
onShow() {
|
|
|
this.getOrderDetail();
|
|
|
@@ -208,12 +210,6 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- onBackPress() {
|
|
|
-
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
-
|
|
|
- },
|
|
|
methods: {
|
|
|
// 添加数量
|
|
|
add(item, index) {
|
|
|
@@ -367,9 +363,9 @@
|
|
|
this.getOrderList()
|
|
|
},
|
|
|
goGoodsList() {
|
|
|
- uni.setStorageSync('types',1)
|
|
|
+ uni.setStorageSync('types', 1)
|
|
|
uni.navigateBack({
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
// uni.navigateTo({
|
|
|
// url: '/pages/index/shop/goodsList?shopId=' + this.shopId
|
|
|
@@ -409,10 +405,10 @@
|
|
|
uni.hideLoading()
|
|
|
});
|
|
|
},
|
|
|
- getOrderDetail(){
|
|
|
- this.$Request.getT('/app/order/selectOrderById?orderId=' + this.orderId).then(res =>{
|
|
|
- if(res.code == 0 && res.data){
|
|
|
- if(res.data.isPay && res.data.isPay == 1){
|
|
|
+ getOrderDetail() {
|
|
|
+ this.$Request.getT('/app/order/selectOrderById?orderId=' + this.orderId).then(res => {
|
|
|
+ if (res.code == 0 && res.data) {
|
|
|
+ if (res.data.isPay && res.data.isPay == 1) {
|
|
|
uni.showToast({
|
|
|
title: '拼单已结束',
|
|
|
icon: 'none'
|
|
|
@@ -433,27 +429,29 @@
|
|
|
|
|
|
this.$Request.get("/app/order/selectShareTheBill", data).then(res => {
|
|
|
if (res.code == 0) {
|
|
|
-
|
|
|
- if(!res.data){
|
|
|
- uni.showToast({
|
|
|
- title: '拼单已结束',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
+
|
|
|
+ if (!res.data) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '拼单已结束',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
setTimeout(function() {
|
|
|
- uni.removeStorageSync('orderId')
|
|
|
- uni.navigateBack()
|
|
|
- }, 1000)
|
|
|
- }
|
|
|
+ uni.removeStorageSync('orderId')
|
|
|
+ uni.navigateBack()
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
this.goodsShop = res.data.goodsShop
|
|
|
// this.goodsList = res.data.orderGoodsList
|
|
|
this.myGoodList = res.data.parentShareTheBill
|
|
|
let mySum = 0
|
|
|
for (var i = 0; i < this.myGoodList.length; i++) {
|
|
|
if (i == 0) {
|
|
|
- mySum = parseFloat(parseFloat(parseFloat(this.myGoodList[i].goodsPrice) * parseFloat(this.myGoodList[i].goodsNum)).toFixed(2))
|
|
|
+ mySum = parseFloat(parseFloat(parseFloat(this.myGoodList[i].goodsPrice) *
|
|
|
+ parseFloat(this.myGoodList[i].goodsNum)).toFixed(2))
|
|
|
this.number += this.myGoodList[i].goodsNum
|
|
|
} else {
|
|
|
- mySum = parseFloat(parseFloat(mySum + parseFloat(this.myGoodList[i].goodsPrice) * parseFloat(this.myGoodList[i].goodsNum)).toFixed(2))
|
|
|
+ mySum = parseFloat(parseFloat(mySum + parseFloat(this.myGoodList[i].goodsPrice) *
|
|
|
+ parseFloat(this.myGoodList[i].goodsNum)).toFixed(2))
|
|
|
this.number += this.myGoodList[i].goodsNum
|
|
|
}
|
|
|
if (i == (this.myGoodList.length - 1)) {
|
|
|
@@ -467,22 +465,27 @@
|
|
|
var sum = 0
|
|
|
for (var i = 0; i < this.otherGoodList.length; i++) {
|
|
|
if (i == 0) {
|
|
|
-
|
|
|
- sum = parseFloat(parseFloat(parseFloat(this.otherGoodList[i].goodsPrice) * parseFloat(this.otherGoodList[i].goodsNum)).toFixed(2))
|
|
|
-
|
|
|
+
|
|
|
+ sum = parseFloat(parseFloat(parseFloat(this.otherGoodList[i].goodsPrice) *
|
|
|
+ parseFloat(this.otherGoodList[i].goodsNum)).toFixed(2))
|
|
|
+
|
|
|
this.number += this.otherGoodList[i].goodsNum
|
|
|
} else {
|
|
|
this.number += this.otherGoodList[i].goodsNum
|
|
|
if (this.otherGoodList[i].userId == this.otherGoodList[i - 1].userId) {
|
|
|
- sum = parseFloat(parseFloat(sum + parseFloat(this.otherGoodList[i].goodsPrice) * parseFloat(this.otherGoodList[i].goodsNum)).toFixed(2))
|
|
|
+ sum = parseFloat(parseFloat(sum + parseFloat(this.otherGoodList[i]
|
|
|
+ .goodsPrice) * parseFloat(this.otherGoodList[i].goodsNum)).toFixed(
|
|
|
+ 2))
|
|
|
} else {
|
|
|
this.otherGoodList[i - 1].goodsPrice = sum
|
|
|
- sum = parseFloat(parseFloat(parseFloat(this.otherGoodList[i].goodsPrice) * parseFloat(this.otherGoodList[i].goodsNum)).toFixed(2))
|
|
|
+ sum = parseFloat(parseFloat(parseFloat(this.otherGoodList[i].goodsPrice) *
|
|
|
+ parseFloat(this.otherGoodList[i].goodsNum)).toFixed(2))
|
|
|
}
|
|
|
}
|
|
|
if (i == (this.otherGoodList.length - 1)) {
|
|
|
this.otherGoodList[i].goodsPrice = sum
|
|
|
- this.totalPrice = parseFloat(parseFloat(parseFloat(this.totalPrice) + parseFloat(sum)).toFixed(2))
|
|
|
+ this.totalPrice = parseFloat(parseFloat(parseFloat(this.totalPrice) + parseFloat(
|
|
|
+ sum)).toFixed(2))
|
|
|
// parseFloat(parseFloat(mySum).toFixed(2))
|
|
|
}
|
|
|
}
|
|
|
@@ -496,6 +499,17 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 获取店铺信息
|
|
|
+ getData() {
|
|
|
+ let data = {
|
|
|
+ shopId: this.shopId
|
|
|
+ }
|
|
|
+ this.$Request.get("/app/goods/selectGoodsList", data).then(res => {
|
|
|
+ if (res.code == 0 && res.data) {
|
|
|
+ this.dataList = res.data.list
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 去结算
|
|
|
goConfirm() {
|
|
|
if (!this.userId) {
|
|
|
@@ -515,10 +529,45 @@
|
|
|
}
|
|
|
}
|
|
|
if (this.myGoodList.length > 0 || this.otherGoodList.length > 0) {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/index/shop/confirmOrder?shopId=' + this.shopId + '&orderType=2&orderId=' +
|
|
|
- this.orderId
|
|
|
- })
|
|
|
+ let that = this;
|
|
|
+ let goodstr1 = 0 //商品库的 必须次数
|
|
|
+ let goodstr2 = 0 //购物车的 必须次数
|
|
|
+ let regex = new RegExp('必选', 'g');
|
|
|
+ let dataList = JSON.stringify(this.dataList)
|
|
|
+ if (dataList.match(regex)) {
|
|
|
+ goodstr1 = dataList.match(regex).length
|
|
|
+ console.log("goodstr1----" + goodstr1)
|
|
|
+ if (dataList.indexOf('必选') != -1) { //检测商品是否存在必选
|
|
|
+ let goodsList = JSON.stringify(that.myGoodList)
|
|
|
+ if (goodsList.match(regex)) {
|
|
|
+ goodstr2 = goodsList.match(regex).length
|
|
|
+ console.log("goodstr2----" + goodstr2)
|
|
|
+ if (goodstr1 == goodstr2) { //检查购物车商品是否存在必须
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/index/shop/confirmOrder?shopId=' + that.shopId + '&orderType=2&orderId=' +
|
|
|
+ that.orderId
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "有" + goodstr1 + "个必选商品,请选择后结算",
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: "有" + goodstr1 + "个必选商品,请选择后结算",
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/index/shop/confirmOrder?shopId=' + that.shopId + '&orderType=2&orderId=' +
|
|
|
+ that.orderId
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '请先添加商品',
|
|
|
@@ -1160,4 +1209,4 @@
|
|
|
background: #FCD202;
|
|
|
border-radius: 36rpx;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|