|
|
@@ -138,7 +138,7 @@ import AppAvatarModule from "@/components/module/app-avatar";
|
|
|
import AppCustomerSel from "@/components/app-customer-sel";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
|
import productMins from "@/mixins/product";
|
|
|
-import {getPurchaseDetailApi,createPurchaseOrderApi} from "@/api/purchase/index";
|
|
|
+import {getPurchaseDetailApi,createPurchaseOrderApi} from "@/api/purchase";
|
|
|
import { PURCHASE_ORDER_STATUS } from "@/utils/declare";
|
|
|
import AppDatePicker from "@/components/app-date-picker";
|
|
|
export default {
|
|
|
@@ -271,30 +271,24 @@ export default {
|
|
|
},
|
|
|
|
|
|
async initData() {
|
|
|
- try {
|
|
|
- const { orderSn } = this.option;
|
|
|
- if (!orderSn) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const { data } = await getPurchaseDetailApi(orderSn);
|
|
|
- Object.keys(this.form).forEach((i, index) => {
|
|
|
- this.form[i] = data[i];
|
|
|
- });
|
|
|
+ const { orderSn } = this.option;
|
|
|
+ if (!orderSn) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const { data } = await getPurchaseDetailApi(orderSn);
|
|
|
+ Object.keys(this.form).forEach((i, index) => {
|
|
|
+ this.form[i] = data[i];
|
|
|
+ });
|
|
|
|
|
|
- this.detailsInfo = data;
|
|
|
+ this.detailsInfo = data;
|
|
|
|
|
|
- if (data.itemInfo) {
|
|
|
- let list = data.itemInfo;
|
|
|
- list.forEach(element => {
|
|
|
- element.bigCount = element.bigNum;
|
|
|
- element.smallCount = element.smallNum;
|
|
|
- });
|
|
|
- this.setSelectInfo({ selectJobType: this.selectJobType, info: list,selectJobId:this.selectJobId });
|
|
|
- }
|
|
|
- if (!this.getMerchantInfo) {
|
|
|
- await this.initMerchantInfo();
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
+ if (data.itemInfo) {
|
|
|
+ let list = data.itemInfo;
|
|
|
+ list.forEach(element => {
|
|
|
+ element.bigCount = element.bigNum;
|
|
|
+ element.smallCount = element.smallNum;
|
|
|
+ });
|
|
|
+ this.setSelectInfo({ selectJobType: this.selectJobType, info: list,selectJobId:this.selectJobId });
|
|
|
}
|
|
|
},
|
|
|
onCityConfirm(e) {
|
|
|
@@ -307,7 +301,8 @@ export default {
|
|
|
that.confirmFn();
|
|
|
})
|
|
|
},
|
|
|
- async confirmFn() {
|
|
|
+ confirmFn() {
|
|
|
+ let that = this
|
|
|
const { orderSn } = this.option;
|
|
|
let formData = this.form;
|
|
|
if (orderSn) {
|
|
|
@@ -324,15 +319,16 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
formData.itemInfo = JSON.stringify(itemInfo)
|
|
|
- if (!this.getMerchantInfo) {
|
|
|
- await this.initMerchantInfo()
|
|
|
- }
|
|
|
uni.showLoading({mask:true})
|
|
|
- const res = await createPurchaseOrderApi({...formData,modifyPrice:this.modifyPrice,cgModel:this.myShopInfo.cgModel,ghsId:this.option.ghsId})
|
|
|
- uni.hideLoading()
|
|
|
- uni.setStorageSync('flowersItemInfo', itemInfo)
|
|
|
- this.removeFromSaveDirect()
|
|
|
- this.$util.pageTo({url: "/pagesPurchase/components/pageSuccess",type:2,query: {orderSn: res.data.orderSn}})
|
|
|
+ let params = {...formData,modifyPrice:this.modifyPrice,cgModel:this.myShopInfo.cgModel,ghsId:this.option.ghsId}
|
|
|
+ createPurchaseOrderApi(params).then(res=>{
|
|
|
+ uni.hideLoading()
|
|
|
+ if(res.code == 1 && res.data.orderSn){
|
|
|
+ uni.setStorageSync('flowersItemInfo', itemInfo)
|
|
|
+ that.removeFromSaveDirect()
|
|
|
+ that.$util.pageTo({url: "/pagesPurchase/components/pageSuccess",type:2,query: {orderSn: res.data.orderSn}})
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
formSubmit(e) {
|
|
|
let rules = [
|