shish 11 miesięcy temu
rodzic
commit
d59807c341

+ 4 - 20
hdApp/src/admin/billing/affirm.vue

@@ -58,8 +58,9 @@
               <view class="operate-view" v-if="isScanEnv == false"><text> </text></view>
               <view class="operate-view" v-if="isScanEnv == false"><text> </text></view>
               <view class="describe-view">
               <view class="describe-view">
                 <text>{{ selectList.length }}种</text>
                 <text>{{ selectList.length }}种</text>
-                <text v-if="Number(totalItemNum.big)>0">,{{totalItemNum.big?parseFloat(totalItemNum.big):0}}扎</text>
-                <text v-if="Number(totalItemNum.small)>0">,{{totalItemNum.small?parseFloat(totalItemNum.small):0}}支</text>
+                <text v-if="Number(allCount.bigLength)>0">,{{allCount.bigLength?parseFloat(allCount.bigLength):0}}扎</text>
+                <text v-if="Number(allCount.smallLength)>0">,{{allCount.smallLength?parseFloat(allCount.smallLength):0}}支</text>
+                <text v-if="Number(allCount.weight)>0">,{{allCount.weight?parseFloat(allCount.weight):0}}公斤</text>
               </view>
               </view>
             </view>
             </view>
           </view>
           </view>
@@ -325,7 +326,7 @@ import appAddressGroup from "@/components/app-address-group";
 import appSendTime from "@/components/app-send-time";
 import appSendTime from "@/components/app-send-time";
 import appFormSend from "@/components/app-form-send";
 import appFormSend from "@/components/app-form-send";
 const formUtil = require("@/utils/formValidation.js");
 const formUtil = require("@/utils/formValidation.js");
-import { createOrder, updateOrder } from "@/api/order/index";
+import { createOrder } from "@/api/order/index";
 import { getAllStaff } from "@/api/shop-admin"
 import { getAllStaff } from "@/api/shop-admin"
 import { mapActions, mapGetters } from "vuex";
 import { mapActions, mapGetters } from "vuex";
 import { getCustomInfo} from "@/api/custom"
 import { getCustomInfo} from "@/api/custom"
@@ -466,23 +467,6 @@ export default {
 	},
 	},
   computed: {
   computed: {
     ...mapGetters(["getMerchantInfo","getMyShopInfo", "getLoginInfo"]),
     ...mapGetters(["getMerchantInfo","getMyShopInfo", "getLoginInfo"]),
-    totalItemNum(){
-      let big = 0
-      let small = 0
-      if(!this.$util.isEmpty(this.selectList)){
-          for(const ele of this.selectList){
-            if(Number(ele.bigCount)>0){
-              big = Number(big)+Number(ele.bigCount)
-              big = big.toFixed(0)
-            }
-            if(Number(ele.smallCount)){
-              small = Number(small) + Number(ele.smallCount)
-              small = small.toFixed(0)
-            }
-          }
-      }
-      return {big:big,small:small}
-    },
     finalPrice(){
     finalPrice(){
       let totalPrice = this.allPrice.toFixed(2)
       let totalPrice = this.allPrice.toFixed(2)
       let finalPrice = Number(totalPrice)
       let finalPrice = Number(totalPrice)

+ 3 - 12
hdApp/src/admin/express/create.vue

@@ -47,7 +47,7 @@
         </view>
         </view>
         <view class="form-item required">
         <view class="form-item required">
           <text class="item-label">商品重量</text>
           <text class="item-label">商品重量</text>
-          <input class="item-input" type="digit" v-model="expressForm.weight" placeholder="公斤" />
+          <input class="item-input" type="digit" v-model="expressForm.weight" placeholder="公斤" @focus="expressForm.weight=''" />
         </view>
         </view>
       </view>
       </view>
 
 
@@ -95,7 +95,7 @@ export default {
       expressForm: {
       expressForm: {
         packageNum: 1,
         packageNum: 1,
         price: 0,
         price: 0,
-        weight: '',
+        weight:'',
         user_name: '',
         user_name: '',
         user_phone: '',
         user_phone: '',
         user_lng: 0,
         user_lng: 0,
@@ -121,7 +121,6 @@ export default {
     if (options.orderId) {
     if (options.orderId) {
       this.orderId = options.orderId
       this.orderId = options.orderId
       this.isNew = options.isNew
       this.isNew = options.isNew
-      //this.getOrderDetail()
     }
     }
 
 
     //返回上一页时刷新
     //返回上一页时刷新
@@ -160,11 +159,10 @@ export default {
      * 获取订单详情
      * 获取订单详情
      */
      */
     async getOrderDetail() {
     async getOrderDetail() {
-      try {
         const res = await getDetail({ id: this.orderId })
         const res = await getDetail({ id: this.orderId })
         if (res.code === 1) {
         if (res.code === 1) {
           this.orderInfo = res.data
           this.orderInfo = res.data
-
+          this.expressForm.weight = res.data.weight?parseFloat(res.data.weight):0
           this.expressForm.price = res.data.prePrice || 0
           this.expressForm.price = res.data.prePrice || 0
           // 自动填充收货信息
           // 自动填充收货信息
           this.expressForm.user_name = res.data.receiveUserName || res.data.bookName || ''
           this.expressForm.user_name = res.data.receiveUserName || res.data.bookName || ''
@@ -172,15 +170,8 @@ export default {
           this.expressForm.user_address = res.data.city + res.data.dist + res.data.address + res.data.floor
           this.expressForm.user_address = res.data.city + res.data.dist + res.data.address + res.data.floor
           this.expressForm.user_lng = res.data.long || 0
           this.expressForm.user_lng = res.data.long || 0
           this.expressForm.user_lat = res.data.lat || 0
           this.expressForm.user_lat = res.data.lat || 0
-        } else {
-          this.$msg(res.msg || '获取订单信息失败')
         }
         }
-      } catch (error) {
-        this.$msg('获取订单信息失败,请重试')
-        console.error('获取订单详情错误:', error)
-      }
     },
     },
-
     /**
     /**
      * 查询配送运费
      * 查询配送运费
      */
      */

+ 17 - 1
hdApp/src/mixins/product.js

@@ -79,13 +79,29 @@ export default {
 		allCount() {
 		allCount() {
 			let bigLength = 0;
 			let bigLength = 0;
 			let smallLength = 0;
 			let smallLength = 0;
+			let weight = 0
 			if (this.selectList) {
 			if (this.selectList) {
 				for (const item of this.selectList) {
 				for (const item of this.selectList) {
 					bigLength += Number(item.bigCount)
 					bigLength += Number(item.bigCount)
 					smallLength += Number(item.smallCount)
 					smallLength += Number(item.smallCount)
+
+					if(item.weight){
+						if(Number(item.bigCount)>0){
+							let bigAdd = Number(item.weight)*Number(item.bigCount)
+							weight = Number(weight) + Number(bigAdd)
+						}else{
+							let ratio = item.ratio||20
+							let unitWeight = item.weight/ratio
+							let smallAdd = Number(unitWeight)*Number(item.smallCount)
+							weight = Number(weight) + Number(smallAdd)
+						}
+						weight = weight.toFixed(2)
+						weight = parseFloat(weight)
+					}
+
 				}
 				}
 			}
 			}
-			return {bigLength:bigLength,smallLength:smallLength,};
+			return {bigLength:bigLength,smallLength:smallLength,weight:weight};
 		},
 		},
 		//当前选中商品列表中是否有没有库存的商品
 		//当前选中商品列表中是否有没有库存的商品
 		hasNoStock() {
 		hasNoStock() {

+ 16 - 2
mallApp/src/mixins/cgProduct.js

@@ -102,17 +102,31 @@ export default {
 
 
 			return Math.round(price * 100) / 100;
 			return Math.round(price * 100) / 100;
 		},
 		},
-		//选择商品总数
+		//选择商品总数和总重要
 		allCount() {
 		allCount() {
 			let bigLength = 0;
 			let bigLength = 0;
 			let smallLength = 0;
 			let smallLength = 0;
+			let weight = 0
 			if (this.selectList) {
 			if (this.selectList) {
 				for (const item of this.selectList) {
 				for (const item of this.selectList) {
 					bigLength += item.bigCount
 					bigLength += item.bigCount
 					smallLength += item.smallCount
 					smallLength += item.smallCount
+					if(item.weight){
+						if(Number(item.bigCount)>0){
+							let bigAdd = Number(item.weight)*Number(item.bigCount)
+							weight = Number(weight) + Number(bigAdd)
+						}else{
+							let ratio = item.ratio||20
+							let unitWeight = item.weight/ratio
+							let smallAdd = Number(unitWeight)*Number(item.smallCount)
+							weight = Number(weight) + Number(smallAdd)
+						}
+						weight = weight.toFixed(2)
+						weight = parseFloat(weight)
+					}
 				}
 				}
 			}
 			}
-			return {bigLength:bigLength,smallLength:smallLength,};
+			return {bigLength:bigLength,smallLength:smallLength,weight:weight};
 		},
 		},
 		allCountFun() {
 		allCountFun() {
 			let bigLength = 0;
 			let bigLength = 0;

+ 5 - 21
mallApp/src/pages/billing/affirmGhs.vue

@@ -30,7 +30,7 @@
 							<view class="operate-view" @click="modifyItem">
 							<view class="operate-view" @click="modifyItem">
 								<text class="iconfont icongouwuche"></text>返回修改
 								<text class="iconfont icongouwuche"></text>返回修改
 							</view>
 							</view>
-							<view class="describe-view">共{{ allCountFun.bigLength }}扎,合计 ¥<text class="price">{{ allPriceFun }}</text></view>
+							<view class="describe-view">{{ allCount.bigLength }}扎,{{allCount.weight}}公斤,<text class="price">¥{{ allPriceFun }}</text></view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
@@ -266,37 +266,23 @@ export default {
 		},
 		},
 		calcSendCost() {
 		calcSendCost() {
 			let that = this
 			let that = this
-			let weight = 0
-			if(!this.$util.isEmpty(this.selectList)){
-				this.selectList.forEach((item,idx,arr) => {
-					if(Number(item.bigCount)>0){
-						let add = Number(item.weight)*Number(item.bigCount)
-						weight = Number(weight) + Number(add)
-					}else{
-						let unitWeight = item.weight/item.ratio
-						let add = Number(unitWeight)*Number(item.smallCount)
-						weight = Number(weight) + Number(add)
-					}
-				})
-			}
-			weight = Number(weight).toFixed(2)
 			// 无地址或重量为 0 时,设为 0 并返回
 			// 无地址或重量为 0 时,设为 0 并返回
 			if (this.$util.isEmpty(that.userInfo.lat) || this.$util.isEmpty(that.userInfo.long)) {
 			if (this.$util.isEmpty(that.userInfo.lat) || this.$util.isEmpty(that.userInfo.long)) {
 				that.form.sendCost = 0
 				that.form.sendCost = 0
 				this.$msg('请填写地址')
 				this.$msg('请填写地址')
 				return
 				return
 			}
 			}
-			if(Number(weight) <= 0){
+			if(Number(that.allCount.weight) <= 0){
 				this.$msg('商品没有重量,无法使用跑腿')
 				this.$msg('商品没有重量,无法使用跑腿')
 				return false
 				return false
 			}
 			}
 			// newFreight
 			// newFreight
-			let packageNum = that.allCountFun && that.allCountFun.bigLength ? Number(that.allCountFun.bigLength) : 1
+			let packageNum = that.allCount && Number(that.allCount.bigLength)>0 ? Number(that.allCount.bigLength) : that.allCount.smallLength
 			let cargoName = '花材'
 			let cargoName = '花材'
 			let newFreightParams = {
 			let newFreightParams = {
 				cargo_name: cargoName,
 				cargo_name: cargoName,
 				price: that.allPriceFun,
 				price: that.allPriceFun,
-				weight: weight,
+				weight: that.allCount.weight,
 				package_num: packageNum,
 				package_num: packageNum,
 				user_lng: that.userInfo.long,
 				user_lng: that.userInfo.long,
 				user_lat: that.userInfo.lat,
 				user_lat: that.userInfo.lat,
@@ -305,7 +291,6 @@ export default {
 				user_address: that.userInfo.province + that.userInfo.city + that.userInfo.dist + that.userInfo.address + that.userInfo.floor
 				user_address: that.userInfo.province + that.userInfo.city + that.userInfo.dist + that.userInfo.address + that.userInfo.floor
 			}
 			}
 			newFreight(newFreightParams).then(res => {
 			newFreight(newFreightParams).then(res => {
-				console.log('newFreight',res)
 				if(res.code == 1){
 				if(res.code == 1){
 					that.form.sendCost = res.data.est_fee?parseFloat(Number(res.data.est_fee/100)):0
 					that.form.sendCost = res.data.est_fee?parseFloat(Number(res.data.est_fee/100)):0
 				}
 				}
@@ -443,10 +428,9 @@ export default {
 				}
 				}
 				.describe-view {
 				.describe-view {
 					display: flex;
 					display: flex;
-
 					align-items: center;
 					align-items: center;
 					color: #333;
 					color: #333;
-					font-size: 24upx;
+					font-size: 26upx;
 					.price {
 					.price {
 						font-weight: bold;
 						font-weight: bold;
 						font-size: 36upx;
 						font-size: 36upx;