shish 4 лет назад
Родитель
Сommit
1cb41987c8
2 измененных файлов с 43 добавлено и 158 удалено
  1. 35 126
      ghsApp/src/admin/breakage/confirm.vue
  2. 8 32
      ghsApp/src/admin/breakage/index.vue

+ 35 - 126
ghsApp/src/admin/breakage/confirm.vue

@@ -12,22 +12,17 @@
                   <view class="info-line">
                   <view class="info-line">
                     <text class="item-name">{{ item.itemName }}</text>
                     <text class="item-name">{{ item.itemName }}</text>
                     <text class="item-price">
                     <text class="item-price">
-                      <text class="unit">¥</text>
+                      <text class="unit"></text>
                       <text class="price">
                       <text class="price">
-                        {{ item.userPrice }}
+                        <text v-if="item.bigCount > 0 || item.smallCount > 0">{{`${item.bigCount}`}}扎</text>
+                        <text v-if="item.smallCount > 0">/</text>
+                        <text v-if="item.smallCount > 0">{{`${item.smallCount}`}}支</text>
                       </text>
                       </text>
                     </text>
                     </text>
                   </view>
                   </view>
                   <view class="info-line">
                   <view class="info-line">
-                    <text class="item-type">{{ item.rank }}级</text>
+                    <text class="item-type"></text>
                     <text class="item-count">
                     <text class="item-count">
-                      <text v-if="item.bigCount > 0 || item.smallCount > 0">{{
-                        `${item.bigCount}`
-                      }}</text>
-                      <text v-if="item.smallCount > 0">/</text>
-                      <text v-if="item.smallCount > 0">{{
-                        `${item.smallCount}`
-                      }}</text>
                     </text>
                     </text>
                   </view>
                   </view>
                 </view>
                 </view>
@@ -39,7 +34,7 @@
                 重选花材
                 重选花材
               </view>
               </view>
               <view class="describe-view">
               <view class="describe-view">
-                共{{ selectList.length }}种,合计 ¥<text class="price">{{ allPrice }}</text>
+                共{{ selectList.length }}种</text>
               </view>
               </view>
             </view>
             </view>
           </view>
           </view>
@@ -74,7 +69,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, freight,wastage,updateOrder } from "@/api/order/index";
+import { wastage } from "@/api/order/index";
 import { mapActions, mapGetters } from "vuex";
 import { mapActions, mapGetters } from "vuex";
 export default {
 export default {
   name: "BillingAffirm", // 开单确认
   name: "BillingAffirm", // 开单确认
@@ -96,7 +91,7 @@ export default {
 			payWayList:[{name:"微信",id:0},{name:"支付宝",id:1},{name:"现金",id:4},{name:"银行卡",id:5}],
 			payWayList:[{name:"微信",id:0},{name:"支付宝",id:1},{name:"现金",id:4},{name:"银行卡",id:5}],
 			payWayindex:0,
 			payWayindex:0,
       form: {
       form: {
-        debt: 1, //付款方式 1欠款订单 0正常订单
+        debt: 1,
         shopId: "",
         shopId: "",
         shopName: "",
         shopName: "",
         receiveProvince: "",
         receiveProvince: "",
@@ -114,10 +109,9 @@ export default {
         product: "",
         product: "",
         remark:"",
         remark:"",
         payWay:0,
         payWay:0,
-        needPrint:1,//订单生成时打印订单1需要2不需要
+        needPrint:1,
       },
       },
       money: "",
       money: "",
-      modifyPrice: 0,
       showCustomer: false,
       showCustomer: false,
 			pageType: "wastage",
 			pageType: "wastage",
     };
     };
@@ -134,7 +128,6 @@ export default {
         title: this.getMerchantInfo.name,
         title: this.getMerchantInfo.name,
       });
       });
     }
     }
-    this.modifyPrice = this.allPrice.toFixed(2);
     this.courier(2);
     this.courier(2);
     if(option.customId){
     if(option.customId){
       this.form.customId = option.customId
       this.form.customId = option.customId
@@ -158,22 +151,12 @@ export default {
     ...mapActions(["initMerchantInfo"]),
     ...mapActions(["initMerchantInfo"]),
     init () {
     init () {
       this._getDet();
       this._getDet();
-    },
-    selectCustom(){
-      //已经有选客户流程,不能修改
-      this.$msg('客户不能修改');
-      //this.$util.pageTo({ url: '/admin/custom/selectCustom',query: {style:2}})
     },
     },
 		payWayChange(e){
 		payWayChange(e){
 			let index = e.detail.value
 			let index = e.detail.value
 			this.payWayindex = index
 			this.payWayindex = index
       this.form.payWay = this.payWayList[index].id
       this.form.payWay = this.payWayList[index].id
 		},
 		},
-    countAllPrices (e) {
-      this.allPrices = this.allPrices + Number(this.form.sendCost);
-      let allPrices = this.allPrice.toFixed(2)
-      this.modifyPrice = (Number(allPrices) + Number(this.form.sendCost)).toFixed(2);
-    },
     setPayWay(payWay){
     setPayWay(payWay){
       this.form.payWay = payWay
       this.form.payWay = payWay
     },
     },
@@ -222,108 +205,34 @@ export default {
       this.form.customName = info.name;
       this.form.customName = info.name;
     },
     },
     affirmFormSubmit () {
     affirmFormSubmit () {
-      let self = this;
-      if(this.isBilling){
-        let rules = [
-          {
-            name: "customId",
-            rule: ["required"],
-            msg: ["请选择客户"],
-          },
-        ];
-        let checkRes = formUtil.validation(this.form, rules);
-        if (checkRes) {
-          this.$msg(checkRes);
-          return false;
-        }
-        uni.showModal({
-          title: "提示",
-          content: "确认打印订单?",
-          cancelText: "不需要",
-          confirmText: "打印",
-          confirmColor: '#39B54A',
-          cancelColor: '#777777',
-          success: function (res) {
-            if (res.confirm) {
-              self.form.needPrint = 1
-              self.formSubmit();
-            }else{
-              self.form.needPrint = 2
-              self.formSubmit();
-            }
-          },
-        });
-      }else{
-        let price = 0;
-        let that = this
-        let product = this.selectList.map((ele) => {
-          price += ele.bigCount * Number(ele.bigPrice);
-          price += ele.smallCount * Number(ele.smallPrice);
-          return {
-            productId: ele.id,
-            bigNum: ele.bigCount,
-            smallNum: ele.smallCount,
-            classId: ele.classId,
-            itemId: ele.itemId,
-            price: ele.userPrice>0?ele.userPrice:price,
-          };
-        });
-        uni.showModal({
-          title: "提示",
-          content: "确认报损?",
-          success: function (res) {
-            if (res.confirm) {
-              wastage({product:JSON.stringify(product),remark:that.form.remark}).then((res) => {
-                //删除记忆
-                that.removeMemory()
-                const {data: { id, orderSn },} = res;
-                let url = '/admin/breakage/result';
-                uni.redirectTo({url: url,success: (result) => { },fail: () => { },complete: () => { },});
-              });
-            }
-          },
-        });
-      }
-    },
-    // 表单验证
-    async formSubmit () {
-      try {
-        // 进行表单检查
-        this.form;
-        let formData = this.form;
-        let price = 0;
-        const product = this.selectList.map((ele) => {
-          price += ele.bigCount * Number(ele.bigPrice);
-          price += ele.smallCount * Number(ele.smallPrice);
-          return {
-            productId: ele.id,
-            bigNum: ele.bigCount,
-            smallNum: ele.smallCount,
-            classId: ele.classId,
-            itemId: ele.itemId,
-            price: ele.userPrice>0?ele.userPrice:price,
-          };
-        });
-        formData.product = JSON.stringify(product);
-        if (!this.getMerchantInfo) {
-          await this.initMerchantInfo();
-        }
-        formData.shopId = this.getMerchantInfo.id;
-        let checkRes = formUtil.validation(formData, []);
-        // 验证通过!
-        if (!checkRes) {
-
-        } else {
-          this.$msg(checkRes);
-        }
-      } catch (error) {
-        console.log(999999, error);
-      }
+      let that = this
+      let product = this.selectList.map((ele) => {
+        return {
+          productId: ele.id,
+          bigNum: ele.bigCount,
+          smallNum: ele.smallCount,
+          classId: ele.classId,
+          itemId: ele.itemId
+        };
+      });
+      uni.showModal({
+        title: "提示",
+        content: "确认报损?",
+        success: function (res) {
+          if (res.confirm) {
+            wastage({product:JSON.stringify(product),remark:that.form.remark}).then((res) => {
+              //删除记忆
+              that.removeMemory()
+              const {data: { id, orderSn },} = res;
+              let url = '/admin/breakage/result';
+              uni.redirectTo({url: url,success: (result) => { },fail: () => { },complete: () => { },});
+            });
+          }
+        },
+      });
     },
     },
     gobackEvent () {
     gobackEvent () {
-      uni.navigateBack({
-        delta: 1,
-      });
+      uni.navigateBack({delta: 1,})
     },
     },
   },
   },
 };
 };

+ 8 - 32
ghsApp/src/admin/breakage/index.vue

@@ -40,7 +40,6 @@
 									:info="productItem"
 									:info="productItem"
 									:bigCount="getSelectItemById(productItem.id, classItem.classId).bigCount"
 									:bigCount="getSelectItemById(productItem.id, classItem.classId).bigCount"
 									:smallCount="getSelectItemById(productItem.id, classItem.classId).smallCount"
 									:smallCount="getSelectItemById(productItem.id, classItem.classId).smallCount"
-									:userPrice="getSelectItemById(productItem.id, classItem.classId).userPrice"
 									@customNum="customNum"
 									@customNum="customNum"
 									@add="addEvent"
 									@add="addEvent"
 									@addOneEvent="addCustomNumEvent"
 									@addOneEvent="addCustomNumEvent"
@@ -60,14 +59,10 @@
 		<modal-module :show="isModel" @cancel="modalCancel" @click="affirm" :title="customData.itemName" color="#333" :size="32" padding="30rpx 30rpx" >
 		<modal-module :show="isModel" @cancel="modalCancel" @click="affirm" :title="customData.itemName" color="#333" :size="32" padding="30rpx 30rpx" >
 			<template slot="customContent">
 			<template slot="customContent">
 				<view class="select-cmd_bx" v-if="customData">
 				<view class="select-cmd_bx" v-if="customData">
-					<view class="kc"><text class="unit_price">库存 {{ customData.stock }}</text><text class="unit_price"> 单价 {{ customData.price }}</text>1扎={{customData.ratio}}支</view>
+					<view class="kc"><text class="unit_price">库存 {{ customData.stock }}</text></view>
 					<view class="num_bx">
 					<view class="num_bx">
-						<input v-model="customData.bigCount" @input="countPrice" :focus="isFocus" type="number" />扎
-						<input v-model="customData.smallCount" @input="countPrice" type="number" style="margin-left:24upx" />支
-					</view>
-					<view class="num_bx">
-						<input style="width: 495rpx" v-model="customData.userPrice" @focus="customData.userPrice = null" type="number" placeholder="金额" />
-						<text>元</text>
+						<input v-model="customData.bigCount" :focus="isFocus" type="number" />扎
+						<input v-model="customData.smallCount" type="number" style="margin-left:24upx" />支
 					</view>
 					</view>
 				</view>
 				</view>
 			</template>
 			</template>
@@ -118,7 +113,6 @@ export default {
 			customData: {
 			customData: {
 				bigCount: 0,
 				bigCount: 0,
 				smallCount: 0,
 				smallCount: 0,
-				userPrice: 0,
 			},
 			},
 			showSubmitModel: false
 			showSubmitModel: false
 		};
 		};
@@ -138,12 +132,6 @@ export default {
 	},
 	},
 
 
 	methods: {
 	methods: {
-		countPrice() {
-			let price = 0;
-			price += this.customData.bigCount * Number(this.customData.bigPrice);
-			price += this.customData.smallCount * Number(this.customData.smallPrice);
-			this.customData.userPrice = price.toFixed(2)
-		},
 		//自定义数量
 		//自定义数量
 		customNum(info) {
 		customNum(info) {
 			this.isModel = true;
 			this.isModel = true;
@@ -152,7 +140,6 @@ export default {
 			this.$nextTick(()=>{
 			this.$nextTick(()=>{
 				this.customData.smallCount =	this.customData.smallCount==0?null:this.customData.smallCount;
 				this.customData.smallCount =	this.customData.smallCount==0?null:this.customData.smallCount;
 				this.customData.bigCount =	this.customData.bigCount==0?null:this.customData.bigCount;
 				this.customData.bigCount =	this.customData.bigCount==0?null:this.customData.bigCount;
-				this.customData.userPrice =	this.customData.userPrice==0?null:this.customData.userPrice;
 				this.isFocus = true;
 				this.isFocus = true;
 			})
 			})
 		},
 		},
@@ -193,30 +180,19 @@ export default {
 						return;
 						return;
 					}
 					}
 				}
 				}
-
-				if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.customData.userPrice) == false){
-					uni.showToast({title:"金额错误",icon:"none"})
-					return;
-				}
-				if(this.customData.userPrice <=0){
-						uni.showToast({title:"金额要大于0",icon:"none"})
-						return;
-				}
 				 
 				 
 				const { bigCount,smallCount,bigNum,bigUnit,smallNum,smallUnit,ratio} = this.customData;
 				const { bigCount,smallCount,bigNum,bigUnit,smallNum,smallUnit,ratio} = this.customData;
 				const ratioNum = Number(ratio);
 				const ratioNum = Number(ratio);
-				//超过库存时 设置为库存最大值 1
+
 				if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
 				if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
-					uni.showToast({
-						title: '库存不足',
-						icon: "none"
-					});
+					uni.showToast({title: '超过库存',icon: "none"})
 					this.customData.bigCount = 0;
 					this.customData.bigCount = 0;
 					this.customData.smallCount = 0;
 					this.customData.smallCount = 0;
 					this.delAllEvent(this.customData)
 					this.delAllEvent(this.customData)
+					this.modalCancel()
 				} else {
 				} else {
-					this.updateItemEvent(this.customData);
-					this.modalCancel();
+					this.updateItemEvent(this.customData)
+					this.modalCancel()
 				}
 				}
 
 
 		},
 		},