|
@@ -44,7 +44,7 @@
|
|
|
</div>
|
|
|
<by-form v-if="showPay" :propConfig="payConfig" ref="payform"></by-form>
|
|
|
<div class="pay-row" v-if="showPay && orderValue.status != 'Split' && orderValue.status != 'Merged' && orderValue.status != 'Cancelled'">
|
|
|
- <el-button type="primary" size="mini" @click="addPay">添加</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="addPay">添加</el-button>
|
|
|
</div>
|
|
|
<div class="pay-info">
|
|
|
<el-descriptions v-for="(item,index) of orderValue.pays" :key="index" :title="item.payment" size="mini" :column="4">
|
|
@@ -60,31 +60,36 @@
|
|
|
</el-collapse-item>
|
|
|
<el-collapse-item title="商品订单" name="3" class="add-order-item">
|
|
|
<div class="addProductTool">
|
|
|
- <by-tool :propConfig="toolConfig"></by-tool>
|
|
|
+ <by-tool :propConfig="toolConfig" ref="tool"></by-tool>
|
|
|
<div class="preferential">
|
|
|
<div class="pre-title">抵扣金额<i class="el-icon-info" title="支持输入数字和百分比。若输入百分比,将自动计算折扣金额=商品成交总金额*百分比(举例:打9折,请输入10%),
|
|
|
只在订单创建时计算一次,在订单创建后修改商品价格不会自动计算,运费不参与折扣。"></i>:</div>
|
|
|
- <vxe-input v-model="freeAmount" class="freeAmount" placeholder="请输入" type="number" size="mini" @input="freeAmountChange"></vxe-input>
|
|
|
+ <vxe-input v-if="!orderValue.id" v-model="freeAmount" class="freeAmount" placeholder="请输入" type="number" size="mini" @change="freeAmountChange"></vxe-input>
|
|
|
+ <span v-else>{{ freeAmount }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<by-table :propConfig="tableConfig" ref="table">
|
|
|
- <!-- <template v-slot:t_cont='{ row }'>
|
|
|
+ <template v-slot:name='{ row }'>
|
|
|
<div class="product-cont">
|
|
|
- <div class="product-name">{{ row.name }}</div>
|
|
|
- <div class="other-info">
|
|
|
+ <div class="product-name">{{ row.name }}<el-tag v-if="row.isGift == 1" size="mini" type="success">赠</el-tag></div>
|
|
|
+ <!-- <div class="other-info">
|
|
|
<span>{{ row.styleId }}</span>
|
|
|
<span>{{ row.skuId }}</span>
|
|
|
<el-tag v-if="row.isGift == 1" size="mini" type="success">赠</el-tag>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
- </template> -->
|
|
|
+ </template>
|
|
|
<template v-slot:qty='{ row }'>
|
|
|
- <vxe-input v-model="row.qty" placeholder="数量" align="center" size="mini" type="integer" @input="qtyChange($event, row)"></vxe-input>
|
|
|
+ <vxe-input v-model="row.qty" v-if="!orderValue.id" placeholder="数量" align="center" size="mini" type="integer" @input="qtyChange($event, row)" >
|
|
|
+ </vxe-input>
|
|
|
+ <span v-else>{{ row.qty }}</span>
|
|
|
</template>
|
|
|
<template v-slot:price='{ row }'>
|
|
|
<span v-if="row.isGift == 1">0</span>
|
|
|
- <vxe-input v-else v-model="row.price" placeholder="单价" align="center" size="mini" type="number" @input="priceChange($event, row)"></vxe-input>
|
|
|
+ <vxe-input v-else-if="!orderValue.id" v-model="row.price" placeholder="单价" align="center" size="mini" type="number" @input="priceChange($event, row)" >
|
|
|
+ </vxe-input>
|
|
|
+ <span v-else>{{ row.price }}</span>
|
|
|
</template>
|
|
|
</by-table>
|
|
|
<div class="product-row">
|
|
@@ -138,6 +143,7 @@
|
|
|
<product-sku-modal ref="product" :mulit="true" @confirm="confirmProduct" />
|
|
|
<product-sku-modal ref="productGift" :mulit="true" @confirm="confirmProductGift" />
|
|
|
<add-product-modal ref="addProductModal" @handleSuccess="handleSuccess" />
|
|
|
+ <edit-product-modal ref="editProductModal" @handleSuccess="handleSuccess" />
|
|
|
</template>
|
|
|
<template #footer v-if="!orderValue.id">
|
|
|
<div class="btn">
|
|
@@ -151,10 +157,11 @@
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
|
-import { addOrder,saveBaseOrder,single,delItem,addPay } from '@/api/omsOrder'
|
|
|
+import { addOrder,saveBaseOrder,single,delItem,addPay,batchItem } from '@/api/omsOrder'
|
|
|
import { add,multiply,subtract,divide } from '@/benyun/utils/accuracy'
|
|
|
import AddProductModal from "./addProductModal.vue";
|
|
|
-@Component({components:{AddProductModal}})
|
|
|
+import EditProductModal from "./editProductModal.vue";
|
|
|
+@Component({components:{AddProductModal,EditProductModal}})
|
|
|
export default class AddOrder extends Vue {
|
|
|
value=false;
|
|
|
num:any=0;
|
|
@@ -479,6 +486,7 @@ export default class AddOrder extends Vue {
|
|
|
columns:[{
|
|
|
title:'名称',
|
|
|
field:'name',
|
|
|
+ slot:true,
|
|
|
width:300
|
|
|
},{
|
|
|
title:'数量',
|
|
@@ -852,6 +860,42 @@ export default class AddOrder extends Vue {
|
|
|
created(){
|
|
|
this.userInfo = this.$store.getters.userInfo;
|
|
|
}
|
|
|
+ //编辑商品
|
|
|
+ updataProduct(){
|
|
|
+ let data = (this.$refs.table as any).getValue();
|
|
|
+ let parames:any={};
|
|
|
+ parames.id = this.orderValue.id;
|
|
|
+ parames.freeAmount = this.freeAmount;
|
|
|
+ parames.addItems=[];
|
|
|
+ parames.addGifts=[];
|
|
|
+ parames.delItems=[];
|
|
|
+ parames.freight=10;
|
|
|
+ parames.isPay = false;
|
|
|
+ for(const item of data){
|
|
|
+ if(item.__status == 'modify'){
|
|
|
+ if(item.isGift == 1){
|
|
|
+ parames.addGifts.push({
|
|
|
+ itemId:item.id,
|
|
|
+ qty:item.qty,
|
|
|
+ price:0
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ parames.addItems.push({
|
|
|
+ itemId:item.id,
|
|
|
+ qty:item.qty,
|
|
|
+ price:0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.load = true;
|
|
|
+ batchItem(parames).then(()=>{
|
|
|
+ this.load = false;
|
|
|
+ this.handleSuccess();
|
|
|
+ }).catch(()=>{
|
|
|
+ this.load = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
handleSuccess(){
|
|
|
this.$emit('handleSuccess');
|
|
|
this.getData();
|
|
@@ -920,10 +964,25 @@ export default class AddOrder extends Vue {
|
|
|
this.load = false
|
|
|
})
|
|
|
}
|
|
|
+ //商品编辑
|
|
|
+ editProduct(){
|
|
|
+ let tableValue = (this.$refs.table as any).getValue();
|
|
|
+ let formValue = (this.$refs.baseform as any).getValue();
|
|
|
+ let newValue:any = {};
|
|
|
+ newValue.freight = formValue.freight;
|
|
|
+ newValue.freeAmount = this.freeAmount;
|
|
|
+ newValue.isPay = false;
|
|
|
+ (this.$refs.editProductModal as any).setShow(true);
|
|
|
+ (this.$refs.editProductModal as any).setFormValue(newValue);
|
|
|
+ (this.$refs.setTableValue as any).setFormValue(tableValue);
|
|
|
+ }
|
|
|
show(){
|
|
|
this.baseConfig = (this as any).$lodash.cloneDeep(this.config);
|
|
|
this.buyerInfoConfig = (this as any).$lodash.cloneDeep(this.config2);
|
|
|
this.newInvoicesConfig = (this as any).$lodash.cloneDeep(this.invoicesConfig);
|
|
|
+ if(this.$refs.tool){
|
|
|
+ (this.$refs.tool as any).initTools();
|
|
|
+ }
|
|
|
if(this.orderValue.id){
|
|
|
let data = this.orderValue;
|
|
|
this.freeAmount = this.orderValue.freeAmount;
|
|
@@ -962,6 +1021,13 @@ export default class AddOrder extends Vue {
|
|
|
//商品
|
|
|
const productData:Array<any> = data.items ? data.items : [];
|
|
|
(this.$refs.table as any).setValue(productData);
|
|
|
+ (this.$refs.tool as any).setCustomTools([{
|
|
|
+ name: '商品编辑', icon: 'el-icon-edit', event:{
|
|
|
+ click:()=>{
|
|
|
+ this.editProduct()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }])
|
|
|
//付款
|
|
|
this.orderValue.isPay = data.isPay;
|
|
|
if(this.orderValue.isPay != 0 || this.orderValue.isPay != 1){
|
|
@@ -1464,6 +1530,12 @@ export default class AddOrder extends Vue {
|
|
|
background-color: #198cf8;
|
|
|
}
|
|
|
}
|
|
|
+.updata-btn-row{
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ padding-bottom: 8px;
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss">
|