|
|
@@ -31,7 +31,7 @@
|
|
|
`${item.bigCount}`
|
|
|
}}</text>
|
|
|
<text v-if="item.smallCount > 0">/</text>
|
|
|
- <text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
|
|
|
+ <text v-if="item.smallCount > 0">{{ item.smallCount }}</text>
|
|
|
</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -54,22 +54,23 @@
|
|
|
<view class="module-com input-line-wrap">
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
<view class="tui-title ">客户</view>
|
|
|
- <view class="tui-input" v-if="form.customId" @click="showCustomer = true">{{ form.customName }}</view>
|
|
|
+ <view class="tui-input" v-if="clientInfo.id" @click="showCustomer = true">{{ clientInfo.name }}</view>
|
|
|
<view class="tui-placeholder" style="width: 100%" v-else @click="showCustomer = true">请选择客户</view>
|
|
|
</tui-list-cell>
|
|
|
- <tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
- <view class="tui-title ">送货</view>
|
|
|
- <button @tap="form.sendType=2" class="admin-button-com mini-btn" :class="form.sendType==2?'blue':'default'">自取</button>
|
|
|
- <button @click="form.sendType=1" class="admin-button-com mini-btn" :class="form.sendType==1?'blue':'default'">配送</button>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
|
|
|
+ <view class="tui-title ">包装费</view>
|
|
|
+ <input type="number" placeholder="请填写包装费和材料费" v-model="packingMoney" placeholder-class="tui-placeholder">
|
|
|
</tui-list-cell>
|
|
|
- <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="form.sendType == 1">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
|
|
|
<view class="tui-title ">运费</view>
|
|
|
- <input type="number" placeholder="留空表示免运费" @input="countAllPrices" v-model="form.sendCost" placeholder-class="tui-placeholder">
|
|
|
+ <input type="number" placeholder="选填" v-model="freight" placeholder-class="tui-placeholder">
|
|
|
</tui-list-cell>
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title ">结算方式</view>
|
|
|
- <button @tap="form.debt=1" class="admin-button-com mini-btn" :class="form.debt==1?'blue':'default'">欠款</button>
|
|
|
- <button @click="form.debt=0" class="admin-button-com mini-btn" :class="form.debt==0?'blue':'default'">已收款</button>
|
|
|
+ <button class="admin-button-com mini-btn" :class="payType==res.id?'blue':'default'" style="margin-right: 10rpx"
|
|
|
+ @tap="payType=res.id" v-for="(res,i) in getDictionariesInfo.htPayWayOption">
|
|
|
+ {{ res.name }}
|
|
|
+ </button>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
|
|
|
@@ -79,9 +80,9 @@
|
|
|
</view>
|
|
|
<view class="under-bar">
|
|
|
<view class="price-view">
|
|
|
- <text class="price-title">{{ form.debt==1?'欠款':'已收款' }}</text>
|
|
|
+ <text class="price-title">收款</text>
|
|
|
<text class="price-number">
|
|
|
- ¥ <text class="large">{{ allPrice+Number(form.sendCost) }}</text>
|
|
|
+ ¥ <text class="large">{{ allPrice+Number(packingMoney)+Number(freight) }}</text>
|
|
|
</text>
|
|
|
</view>
|
|
|
<button class="admin-button-com blue middle" @click="affirmFormSubmit">开单</button>
|
|
|
@@ -124,27 +125,10 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
autoLoad: false,
|
|
|
- form: {
|
|
|
- debt:1,//结算方式 1欠款订单 0正常订单
|
|
|
- shopId: "",
|
|
|
- shopName: "",
|
|
|
- receiveProvince: "",
|
|
|
- receiveCity: "",
|
|
|
- receiveFloor: "",
|
|
|
- receiveAddress: "",
|
|
|
- receiveLong: "",
|
|
|
- receiveLat: "",
|
|
|
- sendType: 2,
|
|
|
- sendSide: "2",
|
|
|
- sendDate: "",
|
|
|
- sendTime: "",
|
|
|
- sendCost: "",
|
|
|
- customId: "",
|
|
|
- product: ""
|
|
|
- },
|
|
|
-
|
|
|
- // 详细地址
|
|
|
- // showRegion: false,
|
|
|
+ packingMoney:'',//包装费
|
|
|
+ freight:'',//运费
|
|
|
+ payType:null,//选中的-支付类型
|
|
|
+ clientInfo: '',//客户信息
|
|
|
showCustomer: false
|
|
|
};
|
|
|
},
|
|
|
@@ -162,48 +146,63 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(["getMerchantInfo", "getLoginInfo"])
|
|
|
+ ...mapGetters(["getMerchantInfo", "getLoginInfo","getDictionariesInfo"])
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(["initMerchantInfo"]),
|
|
|
- init() {
|
|
|
- this._getDet();
|
|
|
- },
|
|
|
- countAllPrices(e){
|
|
|
- this.allPrices = this.allPrices+Number(this.form.sendCost)
|
|
|
- console.log('e',e)
|
|
|
- console.log('this.form.sendCost',Number(this.form.sendCost))
|
|
|
- console.log('this.form.sendCost',this.form.sendCost)
|
|
|
- console.log('this.allPrices',this.allPrices)
|
|
|
- },
|
|
|
-
|
|
|
- // api
|
|
|
- _getDet() {
|
|
|
- let data = uni.getStorageSync("modifyShopB");
|
|
|
- if (this.$util.isEmpty(data)) return;
|
|
|
- Object.keys(this.form).forEach((i, index) => {
|
|
|
- // if (i != 'password') {
|
|
|
- this.form[i] = data[i];
|
|
|
- // }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
+ // 选取客户
|
|
|
changeCustomerFn(info) {
|
|
|
console.log("changeCustomerFn", info);
|
|
|
- let params = {
|
|
|
- province: info.province,
|
|
|
- city:info.city,
|
|
|
- address:info.address,
|
|
|
- floor:info.floor,
|
|
|
- long: info.long,
|
|
|
- lat: info.lat,
|
|
|
+ this.clientInfo = info;
|
|
|
+ },
|
|
|
+ //确定开单
|
|
|
+ affirmFormSubmit(){
|
|
|
+ if(this.clientInfo==''){uni.showToast({title:'请选择客户!',icon:'none'});return;}
|
|
|
+ if(this.packingMoney==''){uni.showToast({title:'请输入包装费!',icon:'none'});return;}
|
|
|
+ if(this.payType==null){uni.showToast({title:'请选择结算方式!',icon:'none'});return;}
|
|
|
+ const product = this.selectList.map(ele => {
|
|
|
+ return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount };
|
|
|
+ });
|
|
|
+ let options = {
|
|
|
+ orderType:2,// 开单类型,1成品开单 2花材开单
|
|
|
+ packingFee:this.packingMoney,// 包装费
|
|
|
+ sendCost:this.freight,// 运费
|
|
|
+ customId:this.clientInfo.id,// 客户
|
|
|
+ payWay:this.payType,//付款方式
|
|
|
+ product:product,//下单商品
|
|
|
};
|
|
|
- freight(params).then(res => {
|
|
|
- this.form.sendCost = res.data.sedCost;
|
|
|
+ let self = this;
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认开单?',
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ createOrder(options).then(res => {
|
|
|
+ console.log('开单成功',res);
|
|
|
+ return;
|
|
|
+ // this.$msg("下单成功");
|
|
|
+ this.resetSelectInfoByType(this.pageType);
|
|
|
+ const {
|
|
|
+ data: { id, orderSn }
|
|
|
+ } = res;
|
|
|
+ // 如果是客户跳转到客户成功页pagesClient/official/clientApply 供货员工下单到 /admin/billing/result
|
|
|
+ let url =
|
|
|
+ this.getLoginInfo.identity == "1"
|
|
|
+ ? "pagesClient/official/clientApply"
|
|
|
+ : `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
|
|
|
+ uni.redirectTo({
|
|
|
+ url: url,
|
|
|
+ success: result => {},
|
|
|
+ fail: () => {},
|
|
|
+ complete: () => {}
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
- this.form.customId = info.id;
|
|
|
- this.form.customName = info.name;
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
confirmFn(options) {
|
|
|
createOrder(options).then(res => {
|
|
|
// this.$msg("下单成功");
|
|
|
@@ -224,47 +223,7 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- affirmFormSubmit(){
|
|
|
- let self = this;
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '确认开单?',
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- self.formSubmit();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // 表单验证
|
|
|
- async formSubmit(e) {
|
|
|
- try {
|
|
|
- // 进行表单检查
|
|
|
- let formData = this.form;
|
|
|
|
|
|
- const product = this.selectList.map(ele => {
|
|
|
- return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount };
|
|
|
- });
|
|
|
- formData.product = JSON.stringify(product);
|
|
|
- if (!this.getMerchantInfo) {
|
|
|
- await this.initMerchantInfo();
|
|
|
- }
|
|
|
- formData.shopId = this.getMerchantInfo.id;
|
|
|
-
|
|
|
- console.log(9999, formData);
|
|
|
- // this.confirmFn(formData);
|
|
|
- // let rules = rules.concat(temp);
|
|
|
- let checkRes = formUtil.validation(formData, []);
|
|
|
- // 验证通过!
|
|
|
- if (!checkRes) {
|
|
|
- this.confirmFn(formData);
|
|
|
- } else {
|
|
|
- this.$msg(checkRes);
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.log(999999, error);
|
|
|
- }
|
|
|
- },
|
|
|
gobackEvent() {
|
|
|
uni.navigateBack({
|
|
|
delta: 1
|