xiaogang 3 rokov pred
rodič
commit
5d027cddd2

+ 1 - 1
components/page-component/goods/app-goods-banner.vue

xqd
@@ -109,7 +109,7 @@
             isCart: {
                 type: Boolean,
                 default() {
-                    return true;
+                    return false;
                 }
             },
             videoUrl: {

+ 19 - 130
pages/cart/cart.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -7,48 +7,11 @@
 					<text class="app-edit-text">{{editStatus ? '完成' : '编辑'}}</text>
 				</app-form-id>
 			</view>
-			
-			<view class="cart-list" v-if="listObj.length > 0">
-				<uni-collapse class="collapse-box" v-model="open">
-					<!-- 国内商品 -->
-				    <uni-collapse-item v-if="listObj[0].goods_list.length > 0"
-						class="collapse-item"
-						:open="true">
-						<template v-slot:title>
-							<view class="collapse-item-titlebar">
-								<text class="collapse-item-titlebar-txt">国内商品</text>
-							</view>
-						</template>
-				        <view class="app-item" v-for="(mch, index) in listObj" :key="index" >
-							<template v-if="mch.type === 0">
-								<app-shop-product :type="0" :theme="getTheme" @change="change" @update="update" :mch="mch"  :editStatus="editStatus" @changeSingleRadio="changeSingleRadio" @changeRadioAll="changeRadioAll" ></app-shop-product>
-							</template>
-							<!-- <app-shop-product :type="0" :theme="getTheme" @change="change" @update="update" :mch="mch"  :editStatus="editStatus" @changeSingleRadio="changeSingleRadio" @changeRadioAll="changeRadioAll" ></app-shop-product> -->
-				        </view>
-				    </uni-collapse-item>
-					<!-- 国外商品 -->
-					<uni-collapse-item v-if="listObj[1].goods_list.length > 0"
-						class="collapse-item"
-						:open="true">
-						<template v-slot:title>
-							<view class="collapse-item-titlebar">
-								<text class="collapse-item-titlebar-txt">境外商品</text>
-							</view>
-						</template>
-				        <view class="app-item" v-for="(mch, index) in listObj" :key="index" >
-							<template v-if="mch.type === 1">
-								<app-shop-product :type="0" :theme="getTheme" @change="change" @update="update" :mch="mch"  :editStatus="editStatus" @changeSingleRadio="changeSingleRadio" @changeRadioAll="changeRadioAll" ></app-shop-product>
-							</template>
-						</view>
-				    </uni-collapse-item>
-				</uni-collapse>
-			</view>
-			
-            <!-- <template v-if="listObj.length > 0">
+            <template v-if="listObj.length > 0">
                 <view class="app-item" v-for="(mch, index) in listObj" :key="index" >
 				    <app-shop-product :theme="getTheme" @change="change" @update="update" :mch="mch"  :editStatus="editStatus" @changeSingleRadio="changeSingleRadio" @changeRadioAll="changeRadioAll" ></app-shop-product>
 			    </view>
-            </template> -->
+            </template>
 			<view class="no-cart" v-if="listObj.length === 0">
 				<view class="cart-icon">
 					<image class="cart-image" src="../../static/image/icon/nav-icon-cart.png"></image>
@@ -142,8 +105,6 @@
     import appShopProduct from './components/app-shop-product/app-shop-product.vue';
     import appRadio from '../../components/basic-component/app-radio/app-radio.vue';
     import appEmptyBottom from '../../components/basic-component/app-empty-bottom/app-empty-bottom.vue';
-	
-	import deepClone from '@/core/deepClone.js'
     
     export default {
         name: 'cart',
@@ -154,7 +115,6 @@
         },
         data() {
             return {
-				open: ['0'],
                 countList: {
                     express: {
                         name: '',number: 0,list: [],price: 0, is_miaosha: false
@@ -207,7 +167,6 @@
             }),
         },
         methods: {
-			
             update(good) {
                 for(let idx in this.listObj) {
                     for(let index in this.listObj[idx].goods_list) {
@@ -220,7 +179,6 @@
                 }
             },
             setALl(data) {
-				this.open = ['0', '1']
                 this.selectAll(data.active);
             },
 	        
@@ -238,9 +196,6 @@
                         }
                     }
                 }
-				if (!this.editStatus) {
-					this.open = ['0', '1']
-				}
                 this.editStatus = !this.editStatus;
             },
 	        
@@ -254,39 +209,7 @@
 	                method: 'get',
                 });
                 if (res.code === 0) {
-					
-					let list = []
-					let count = 0
-					// 分割境外境内
-					for (let i = 0; i < res.data.list.length; i ++) {
-						// 循环商铺(目前就是单商铺)
-						const domGoods = res.data.list[i].goods_list.filter((item, index) => {
-							return item.goods.is_jingwai === 0
-						})
-						const overGoods = res.data.list[i].goods_list.filter((item, index) => {
-							return item.goods.is_jingwai === 1
-						})
-						
-						let mch_dom = deepClone(res.data.list[i])
-						let mch_over = deepClone(res.data.list[i])
-						
-						mch_dom.goods_list = domGoods
-						mch_over.goods_list = overGoods
-						
-						mch_dom['type'] = 0
-						mch_over['type'] = 1
-						
-						// mch_dom.mch_id = count
-						// count++
-						// mch_over.mch_id = count
-						// count++
-						
-						list.push(mch_dom)
-						list.push(mch_over)
-					}
-					
-                    // this.listObj = res.data.list;
-					this.listObj = list
+                    this.listObj = res.data.list;
                     if(res.data.send_type_desc.express) {
                         this.countList.express.name = res.data.send_type_desc.express
                     }else {
@@ -312,20 +235,19 @@
                 for (let i = 0; i < this.listObj.length; i++) {
                     let {mch_id ,  goods_list } = this.listObj[i];
                     if (data.mch_id === mch_id) {
-						// 对应商城全选操作
                         for (let j = 0; j < goods_list.length; j++) {
-								if (!this.editStatus) {
-									if (goods_list[j].new_status === 0 && goods_list[j].buy_goods_auth) goods_list[j].is_active = !data.is_active;
-								} else {
-									goods_list[j].is_active = !data.is_active;
-								}
-								if(goods_list[j].sign === 'wholesale') {
-									goods_list[j].choose_num = goods_list[j].is_active ? goods_list[j].attrs.num : 0;
-									goods_list[j].discount = goods_list[j].is_active ? goods_list[j].attrs.discount : goods_list[j].plugin_data.discount_type == 1 ? 0 : 10;
-									for(let attr of goods_list[j].attr_arr) {
-										attr.is_active = goods_list[j].is_active;
-									}
-								}
+                            if (!this.editStatus) {
+                                if (goods_list[j].new_status === 0 && goods_list[j].buy_goods_auth) goods_list[j].is_active = !data.is_active;
+                            } else {
+                                goods_list[j].is_active = !data.is_active;
+                            }
+                            if(goods_list[j].sign === 'wholesale') {
+                                goods_list[j].choose_num = goods_list[j].is_active ? goods_list[j].attrs.num : 0;
+                                goods_list[j].discount = goods_list[j].is_active ? goods_list[j].attrs.discount : goods_list[j].plugin_data.discount_type == 1 ? 0 : 10;
+                                for(let attr of goods_list[j].attr_arr) {
+                                    attr.is_active = goods_list[j].is_active;
+                                }
+                            }
                         }
                         this.listObj[i].is_active = !data.is_active;
                     }
@@ -335,7 +257,6 @@
 	        // 单选
             changeSingleRadio({mch, item}) {
                 for (let i = 0; i < this.listObj.length; i++) {
-					// 找到对应商城操作
                     if (this.listObj[i].mch_id === mch.mch_id) {
                         let goods_list_len = mch.goods_list.length;
                         let active_num = 0;
@@ -351,6 +272,7 @@
                                         if(!this.editStatus) {
                                             this.listObj[i].goods_list[j].choose_num = this.listObj[i].goods_list[j].is_active ? this.listObj[i].goods_list[j].attrs.num : 0;
                                             this.listObj[i].goods_list[j].discount = this.listObj[i].goods_list[j].is_active ? this.listObj[i].goods_list[j].attrs.discount : this.listObj[i].goods_list[j].plugin_data.discount_type == 1 ? 0 : 10;
+
                                         }
                                     }
                                 }else {
@@ -626,7 +548,6 @@
                 }, 1000);
             },
 	        editNum() {
-				console.log(this.listObj)
                 let editList = [];
                 for (let i = 0; i < this.listObj.length; i++) {
                     let goods = this.listObj[i].goods_list;
@@ -664,7 +585,7 @@
 	        // 删除商品
             async deleteProduct() {
                 let product_list = [];
-                console.log('begin',this.listObj);
+                
                 for (let i = 0 ; i < this.listObj.length; i++) {
                     let goods = this.listObj[i].goods_list;
                     for (let j = 0 ; j < goods.length; j++) {
@@ -707,14 +628,10 @@
                 });
                 if (res.code === 0) {
                     this.editStatus = false;
-					console.log('进入前',this.listObj[0])
-					console.log('进入前',this.listObj[1])
                     for (let j = 0; j < this.listObj.length; j++) {
                         for (let i = 0; i < product_list.length; i++) {
                             if (this.listObj[j].mch_id == product_list[i].mch_id) {
-								console.log('this.listObj[j].goods_list.length',this.listObj[j].goods_list.length);
                                 for (let k = 0; k < this.listObj[j].goods_list.length; k++) {
-									console.log('for循环',this.listObj[j].goods_list[k])
                                     if(this.listObj[j].goods_list[k].sign === 'wholesale') {
                                         for(let index in this.listObj[j].goods_list[k].attr_arr) {
                                             if (this.listObj[j].goods_list[k].attr_arr[index].id == product_list[i].id) {
@@ -726,22 +643,18 @@
                                         }
                                         this.count();
                                     }else {
-										console.log('this.listObj[j].goods_list[k]',this.listObj[j].goods_list[k]);
                                         if (this.listObj[j].goods_list[k].id == product_list[i].id) {
                                             this.$delete(this.listObj[j].goods_list, k);
                                         }
                                     }
                                 }
                                 if (this.listObj[j].goods_list.length === 0) {
-									console.log('后面的if',this.listObj, j,i);
-                                    this.$delete(this.listObj[j], j);
+                                    this.$delete(this.listObj, j);
                                 }
-								console.log('this.listObj[j]',this.listObj[j]);
                             }
                         }
                     }
-					console.log('进入后',this.listObj)
-				}
+                }
             },
             b() {
                 let currentRoute = undefined;
@@ -1251,28 +1164,4 @@
         width:100%;
         height: 110upx;
     }
-	.cart-list {
-		.collapse-box {
-			// background-color: transparent;
-			.collapse-item {
-				// margin-top: 30rpx;
-				.collapse-item-titlebar {
-					display: flex;
-					align-items: center;
-					height: 80rpx;
-					.collapse-item-titlebar-txt {
-						padding-left: 24rpx;
-						font-weight: bold;
-						font-size: 30rpx;
-					}
-				}
-			}
-		}
-	}
-	::v-deep .uni-collapse {
-		background-color: transparent !important;
-	}
-	::v-deep .uni-collapse-item {
-		// margin-top: 30rpx;
-	}
 </style>

+ 51 - 107
pages/order-submit/order-submit.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -13,11 +13,8 @@
               <view v-if="previewData.hasCity && mchIndex === 1" class="group">
                 <app-address-bar :address="previewData.address" :has-ziti="previewData.has_ziti" :all-ziti="previewData.allZiti" :city="mch.city"></app-address-bar>
               </view>
-			  
-			  
-			  <!-- 循环商户列表start -->
               <view :key="mchIndex" class="group">
-                <!-- 商铺名 -->
+                <!-- 循环商户列表start -->
                 <view style="padding: 26rpx 32rpx;">
                   <view class="dir-left-nowrap cross-center" style="padding: 10rpx 0;line-height: 1.2;">
                     <!-- 商户名start -->
@@ -77,7 +74,6 @@
                   </template><!-- 自提门店信息end -->
                 </view>
                 <view class="line"></view>
-				<!-- 配送方式 -->
                 <view v-if="mch.show_delivery !== false" style="padding: 18rpx 32rpx;">
                   <!-- 选择配送方式start -->
                   <view class="dir-left-nowrap cross-center" style="padding: 18rpx 0;">
@@ -95,8 +91,7 @@
                     </view>
                   </view>
                 </view><!-- 选择配送方式end -->
-                <!-- 同城配送 -->
-				<template v-if="mch.delivery && mch.delivery.send_type === 'city' && mch.city">
+                <template v-if="mch.delivery && mch.delivery.send_type === 'city' && mch.city">
                   <!-- 同城配送信息start -->
                   <view class="line"></view>
                   <view v-if="mch.city.error" class="dir-left-nowrap cross-center" style="padding: 36rpx 32rpx;">
@@ -119,14 +114,8 @@
                 <view v-if="!mch.pick_up_enable" style="height: 80rpx;line-height: 80rpx; background: #fff4f3;padding: 0 24rpx;">
                   <view>以下商品满{{mch.pick_up_price}}元起送</view>
                 </view>
-				
-				<!-- 商品循环 -->
                 <app-submit-goods :theme="theme" v-on:updateList="updateList" :index="mchIndex" :plugin="plugin" :list="mch"></app-submit-goods>
-				
-				
-				
                 <view class="line"></view>
-				<!-- 优惠券 -->
                 <template v-if="(mch.coupon && mch.coupon.enabled) ||
                                 (mch.member_discount > 0 || mch.member_discount < 0) ||
                                 (mch.integral && mch.integral.can_use) ||
@@ -237,8 +226,7 @@
                   </view>
                   <view class="line"></view>
                 </template>
-                <!-- 运费 -->
-				<template v-if="mch.show_express_price !== false">
+                <template v-if="mch.show_express_price !== false">
                   <!-- 运费信息start -->
                   <view class="dir-left-nowrap cross-center" style="height: 84rpx; padding: 0 32rpx;">
                     <view class="box-grow-1">运费</view>
@@ -251,21 +239,31 @@
                       <template v-else>¥{{mch.express_price}}</template>
                     </view>
                   </view>
-                </template><!-- 运费信息end -->
-				<template v-if="previewData.total_sku_tax_amount !== false">
+                </template><!-- 运费信息end -->    
+				
+				<template v-if="mch.total_sku_tax_amount >0">
 				  <!-- 综合税费start -->
 				  <view class="dir-left-nowrap cross-center" style="height: 84rpx; padding: 0 32rpx;">
 				    <view class="box-grow-1">综合税费</view>
 				    <view class="box-grow-0"  :class="[themeTextClass]" :style="{'color': !is_gift ? theme.color : '','text-align':'right'}">
-				      <template v-if="previewData.total_sku_tax_amount">
-				        <view :style="{'color': theme.color}">¥{{previewData.total_sku_tax_amount}}</view>
-				      </template>
-				      <template v-else>¥{{previewData.total_sku_tax_amount}}</template>
+				      <template>¥{{mch.total_sku_tax_amount}}</template>
 				    </view>
 				  </view>
-				</template><!-- 综合税费end -->
-                <!-- 买家留言 -->
-				<template v-if="
+				</template><!-- 综合税费end -->    
+				  
+					 
+				<template v-if="balance < 0">
+                  <!-- 欠款金额start -->
+                  <view class="dir-left-nowrap cross-center" style="height: 84rpx; padding: 0 32rpx;">
+                    <view class="box-grow-1">欠款金额</view>
+                    <view class="box-grow-0"  :class="[themeTextClass]" :style="{'color': !is_gift ? theme.color : '','text-align':'right'}">
+                      <template>¥{{Math.abs(balance)}}</template>
+                    </view>
+                  </view>
+                </template>
+				<!-- 欠款金额end -->
+				
+                <template v-if="
                     !(mch.order_form && mch.order_form.status == '1')
                     && mch.show_remark !== false
                     && mch.has_goods_form !== true">
@@ -275,18 +273,14 @@
                   </view>
                 </template>
                 <view class="line"></view>
-				<!-- 小计 -->
                 <view class="dir-right-nowrap cross-center" style="height: 84rpx; padding: 0 32rpx;">
                   <view class="box-grow-0 dir-left-nowrap">
                     <view>小计:</view>
-                    <view :class="[themeTextClass]" :style="{'color': !is_gift ? theme.color : ''}">¥{{mch.total_price}}</view>
+                    <view :class="[themeTextClass]" :style="{'color': !is_gift ? theme.color : ''}">¥{{balance < 0 ? setPrice(mch.total_price, balance) : FlorPrice(mch.total_price) }}</view>
                   </view>
                   <view class="box-grow-0 font-gray mr-12">共{{mch.goods_count}}件</view>
                 </view>
-              </view>
-			  <!-- 循环商户列表end -->
-			  
-			  
+              </view><!-- 循环商户列表end -->
             </template>
             <view v-for="(mch, mchIndex) in previewData.mch_list" :key="mchIndex">
               <view v-if="mch.order_form && mch.order_form.status == '1'" class="group">
@@ -352,9 +346,9 @@
                                 {{custom_currency}}+
                             </text>
                             <template v-if="previewData.vip_card_discount_total_price">
-                                ¥{{previewData.vip_card_discount_total_price}}
+                                ¥{{balance <0 ? setPrice(previewData.vip_card_discount_total_price, balance) :FlorPrice(previewData.vip_card_discount_total_price) }}
                             </template>
-                            <template v-else>¥{{previewData.total_price}}</template>
+                            <template v-else>¥{{balance <0 ? setPrice(previewData.total_price, balance) :FlorPrice(previewData.total_price) }}</template>
                         </view>
                         <view v-if="previewData.vip_card_price > 0"  :class="[themeTextClass]" :style="{'color': !is_gift ? theme.color : '','font-size': '20rpx'}">包含SVIP费用:
                             ¥{{previewData.vip_card_price}}
@@ -386,8 +380,6 @@ import AppAddressBar from "./app-address-bar";
 import AppSubmitCheckbox from "./app-submit-checkbox";
 import AppClose from '../../components/basic-component/app-close/app-close.vue';
 
-import deepClone from '@/core/deepClone.js'
-
 export default {
     name: 'order-submit',
     components: {
@@ -401,6 +393,7 @@ export default {
     },
     data() {
         return {
+			balance: 0, // 余额
             totalTitle: '合计',
             check: false,
             previewData: {
@@ -449,8 +442,7 @@ export default {
             }
         },
     },
-    onLoad(options) {
-		this.$commonLoad.onload(options);
+    onLoad(options) { this.$commonLoad.onload(options);
         let mchList = JSON.parse(options.mch_list);
         let list = [];
         for(let item of mchList) {
@@ -496,6 +488,7 @@ export default {
         // #endif
     },
     onShow() {
+		this.getSetting()
         this.showClose = false;
         setTimeout(()=>{
             this.showClose = true;
@@ -540,7 +533,27 @@ export default {
               }
             }
         },
-        
+        // 获取余额接口
+		getSetting: function () {
+		    const self = this;
+		    self.$request({
+		        url: self.$api.balance.index,
+		    }).then(info => {
+		        if (info.code === 0) {
+		            this.balance = Number(info.data.balance);
+		        }
+		    });
+		},
+		setPrice(price, balance) {
+			
+			price = Number(price)
+			balance = Math.abs(balance)
+			return (price + balance).toFixed(2)
+			
+		},
+		FlorPrice(florPrice){
+			return Number(florPrice).toFixed(2) 
+		},
         noCouponStatus(mchIndex) {
             const mchNoCouponStatusList = this.$store.getters['orderSubmit/getMchNoCouponStatusList'];
             if (mchNoCouponStatusList[mchIndex])
@@ -588,7 +601,6 @@ export default {
             this.$store.commit('orderSubmit/mutSetFormData', formData);
         },
         setFormData(options) {
-			console.log(options.preview_url)
             this.previewUrl = decodeURIComponent(options.preview_url || this.$api.order.preview);
             this.submitUrl = decodeURIComponent(options.submit_url || this.$api.order.submit);
             this.plugin = options.plugin || null;
@@ -599,29 +611,7 @@ export default {
             this.showPayResult = options.show_pay_result || true;
             if (this.showPayResult === 'true') this.showPayResult = true;
             if (this.showPayResult === 'false') this.showPayResult = false;
-            let list = JSON.parse(options.mch_list);
-			
-			
-			// console.log('================123===============')
-			// console.log(list)
-			
-			// let tempGoods = []
-			// for (let i = 0; i < list.length; i ++) {
-			// 	const goods_list = list[i].goods_list
-			// 	if (i === 0) {
-			// 		goods_list.forEach(item => { item['is_jingwai'] = 0 })
-			// 	} else if (i === 1) {
-			// 		goods_list.forEach(item => { item['is_jingwai'] = 1 })
-			// 	}
-			// 	tempGoods = [...tempGoods, ...goods_list]
-			// }
-			
-			// const tempList = [list[0]]
-			// tempList[0].mch_id = 0
-			// tempList[0].goods_list = tempGoods
-			
-			// list = deepClone(tempList)
-			
+            const list = JSON.parse(options.mch_list);
 
             // 商户列表先做下排序,主商城必须在最前
             for (let i in list) {
@@ -690,19 +680,6 @@ export default {
                         response.data.mch_list[i].showInsertRows = false;
                     }
                     this.previewData = response.data;
-					
-					
-					// const arr = this.$store.state.orderSubmit.formData.list[0].goods_list
-					// // 添加境内外信息
-					// console.log(arr)
-					// this.previewData.mch_list[0].goods_list.forEach(item => {
-					// 	const t = arr.find(i => i.id === item.id)
-					// 	item.is_jingwai = t.is_jingwai
-					// })
-					// console.log('====================================')
-					// console.log(this.previewData.mch_list[0].goods_list)
-					
-					
                     this.setDiyFormScrollStatus();
                     this.checkCouponError();
                     this.updateStoreDistance();
@@ -923,25 +900,6 @@ export default {
                     form_data: JSON.stringify(this.$store.state.orderSubmit.formData),
                 },
             }).then(response => {
-				if (response.code === 99) {
-					// 未实名认证,需要使命认证
-					uni.hideLoading()
-					this.submitLock = false;
-					const _this = this
-					uni.showModal({
-					    title: '提示',
-					    content: '您的账号尚未实名认证,请前往认证',
-					    success: function (res) {
-							if (res.confirm) {
-							    _this.$jump({
-							    	open_type: 'navigate',
-							    	url: '/pages/identify/identify'
-							    })
-							}
-					    }
-					})
-					return
-				}
                 if (response.code === 0) {
                     this.getPayOrderId(response.data.queue_id, response.data.token);
                 } else {
@@ -1466,18 +1424,4 @@ $yWidth: #{24rpx};
 		color: #FF4544;
 	}
 }
-
-.collapse-item-titlebar {
-	display: flex;
-	align-items: center;
-	height: 80rpx;
-	.collapse-item-titlebar-txt {
-		padding-left: 24rpx;
-		font-weight: bold;
-		font-size: 30rpx;
-	}
-}
-::v-deep .uni-collapse {
-	background-color: transparent !important;
-}
 </style>