shish 2 лет назад
Родитель
Сommit
fca062aa54

+ 4 - 0
ghs/src/cool/request/index.js

@@ -36,12 +36,16 @@ import ptItemClass from '@/service/pt-item-class/index';
 import ghsItemClass from '@/service/ghs-item-class/index';
 import statBook from '@/service/stat-book/index';
 import ghs from '@/service/ghs/index';
+import cg from '@/service/cg/index';
+import purchaseOrder from '@/service/purchase-order/index';
 
 export function SET_SERVICE({ store }) {
 	// const files = require.context('@/service/', true, /\.js$/);
 	// const ignore = ['./request.js'];
 
 	let modules = {
+		cg,
+		purchaseOrder,
 		common,
 		system,
 		test,

+ 6 - 0
ghs/src/service/cg/index.js

@@ -0,0 +1,6 @@
+import { BaseService, Service } from '@/cool';
+@Service('cg')
+export class CgService extends BaseService {
+
+}
+export default new CgService();

+ 14 - 0
ghs/src/service/purchase-order/index.js

@@ -0,0 +1,14 @@
+import { BaseService, Service } from '@/cool';
+@Service('purchase-order')
+export class PurchaseOrderService extends BaseService {
+
+    createOrder(data) {
+		return this.request({
+			url: '/create-order',
+			method: 'POST',
+			data: data
+		});
+	}
+
+}
+export default new PurchaseOrderService();

+ 39 - 25
ghs/src/views/in/add.vue

@@ -233,7 +233,6 @@ export default {
 				isCost:1
 			},
 			detailsInfo: {},
-			totalPrice:0,
 			totalFreight:0,
 			perKgFreight:0,
 			location:0,
@@ -262,7 +261,6 @@ export default {
       selectGhsName:'',
       t:null,
       currentShop:{default:0,pfLevel:0},
-      diffList:[],
       showGetItemList:false,
       currentItem:{},
       classList:[],
@@ -306,7 +304,6 @@ export default {
 			let finalPrice = price.toFixed(2);
 			finalPrice = parseFloat(finalPrice)
 			this.modifyPrice = finalPrice
-			this.totalPrice = finalPrice
 			let newPrice = price.toFixed(2);
 			newPrice = parseFloat(newPrice)
 			return newPrice
@@ -321,6 +318,26 @@ export default {
 			let calcWeight = realityWeight.toFixed(2);
 			return calcWeight
 		},
+		totalPrice(){
+			let price = Number(this.selectAllPrice);
+			//打包费
+			if(Number(this.form.packingCharge) > 0){
+				price	 = Number(price) + Number(this.form.packingCharge)
+			}
+			//到付的,长途和短途运费不能算在要结账的订单金额里。寄付的则要算。
+			if(this.form.yfPayWay == 1){
+				//短途运费
+				if(Number(this.form.shortCharge) > 0){
+					price	 = Number(price) + Number(this.form.shortCharge)
+				}
+				//长途运费
+				if(Number(this.form.longCharge) > 0){
+					price	 = Number(price) + Number(this.form.longCharge)
+				}
+			}
+			let currentPrice = price.toFixed(2)
+      return currentPrice
+		}
   },
   created() {
 
@@ -427,9 +444,7 @@ export default {
 					price	 = Number(price) + Number(this.form.longCharge)
 				}
 			}
-			this.totalPrice = price.toFixed(2);
 			this.modifyPrice = price.toFixed(2);
-
 			let packingCharge = Number(this.form.packingCharge) > 0 ? Number(this.form.packingCharge) : 0
 			let longCharge = Number(this.form.longCharge) > 0 ? Number(this.form.longCharge) : 0
 			let shortCharge = Number(this.form.shortCharge) > 0 ? Number(this.form.shortCharge) : 0
@@ -522,39 +537,38 @@ export default {
         this.$message({message: '请选择供货商',type: 'warning'})
         return false
       }
-
       let formData = this.form;
-      const product = this.selectList.map(ele => {
-        return { productId: ele.id, bigNum: ele.bigCount, smallNum: 0,itemId:ele.itemId,price:ele.userPrice };
-      });
-      formData.product = JSON.stringify(product)
-      if(Number(this.modifyPrice) <= 0){
-        this.$message({message: '收款金额必须大于0',type: 'warning'})
+			const itemInfo = this.selectList.map(ele => {
+				return {
+					classId: ele.classId,
+					productId: ele.id,
+					bigNum: ele.bigCount,
+					smallNum: ele.smallCount,
+					itemId:ele.itemId,
+					itemPrice: ele.userPrice,
+					ratio:ele.ratio,
+					ratioType:ele.ratioType
+				}
+			})
+			formData.itemInfo = JSON.stringify(itemInfo)
+      if(Number(this.modifyPrice)<=0){
+        this.$message({message: '应付金额要大于0',type: 'warning'})
         return false
       }
-      let book = 0
-      let params = {...formData,modifyPrice: this.modifyPrice,newVersion:1,book:book};
-      let name = '确认提交'
-      this.$confirm(name, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
-        that.$service.order.orderCreate(params).then(data => {
-          if(data.respondType && data.respondType == 'priceError'){
-            that.diffList = data.diff ? data.diff : []
-            that.noStockPlay()
-            that.$message({message: '请确认修改的价格',type: 'warning'})
-          }else{
+      let params = {...formData,modifyPrice:this.modifyPrice,cgModel:0,inType:0}
+      this.$confirm('确认提交', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
+        that.$service.purchaseOrder.createOrder(params).then(data => {
             that.$nextTick(()=>{
               that.selectList = [];
-              that.diffList = []
               that.successPlay()
               that.removeFromSaveDirect()
               that.showCommitPop = false;
-              that.$notify({ title: '成功', message: '开单成功', type: 'success'})
+              that.$notify({ title: '成功', message: '操作成功', type: 'success'})
               that.backToSearchItem()
               setTimeout(function(){
                 that.formReset()
               },900)
             })
-          }
         })
       })
     },