|
@@ -1,55 +1,69 @@
|
|
<template>
|
|
<template>
|
|
<vxe-modal v-model="value" id="addOrder" @show="show" width="70%" height="80%" min-width="460" min-height="320"
|
|
<vxe-modal v-model="value" id="addOrder" @show="show" width="70%" height="80%" min-width="460" min-height="320"
|
|
show-zoom resize transfer show-footer>
|
|
show-zoom resize transfer show-footer>
|
|
- <template #title>
|
|
|
|
- <span>创建新订单</span>
|
|
|
|
- </template>
|
|
|
|
- <template #default>
|
|
|
|
- <el-collapse v-model="activeNames">
|
|
|
|
- <el-collapse-item title="基本信息" name="1" class="add-order-item">
|
|
|
|
- <by-form :propConfig="config" ref="baseform"></by-form>
|
|
|
|
- </el-collapse-item>
|
|
|
|
- <el-collapse-item title="买家信息" name="2">
|
|
|
|
- <by-form :propConfig="config2" ref="infoform">
|
|
|
|
- <template v-slot:slotField='{ value }'>
|
|
|
|
- <div class="updateBuyer">
|
|
|
|
- <el-checkbox v-model="value.slotField">更新买家收货人信息</el-checkbox>
|
|
|
|
|
|
+ <template #title>
|
|
|
|
+ <span>创建新订单</span>
|
|
|
|
+ </template>
|
|
|
|
+ <template #default>
|
|
|
|
+ <el-collapse v-model="activeNames">
|
|
|
|
+ <el-collapse-item title="基本信息" name="1" class="add-order-item">
|
|
|
|
+ <by-form :propConfig="config" ref="baseform"></by-form>
|
|
|
|
+ </el-collapse-item>
|
|
|
|
+ <el-collapse-item title="买家信息" name="2" class="add-order-item">
|
|
|
|
+ <by-form :propConfig="config2" ref="infoform">
|
|
|
|
+ <template v-slot:slotField='{ value }'>
|
|
|
|
+ <div class="updateBuyer">
|
|
|
|
+ <el-checkbox v-model="value.slotField">更新买家收货人信息</el-checkbox>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </by-form>
|
|
|
|
+ </el-collapse-item>
|
|
|
|
+ <el-collapse-item title="商品订单" name="3" class="add-order-item">
|
|
|
|
+ <div class="addProductTool">
|
|
|
|
+ <by-tool :propConfig="toolConfig"></by-tool>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <by-table :propConfig="tableConfig" ref="table">
|
|
|
|
+ <template v-slot:t_cont='{ row }'>
|
|
|
|
+ <div class="product-cont">
|
|
|
|
+ <div class="product-name">{{ row.name }}</div>
|
|
|
|
+ <div class="other-info">
|
|
|
|
+ <span>{{ row.styleId }}</span>
|
|
|
|
+ <span>{{ row.skuId }}</span>
|
|
</div>
|
|
</div>
|
|
- </template>
|
|
|
|
- <template v-slot:address='{ value }'>
|
|
|
|
- 地址
|
|
|
|
- </template>
|
|
|
|
- </by-form>
|
|
|
|
- </el-collapse-item>
|
|
|
|
- <el-collapse-item title="商品订单" name="3">
|
|
|
|
- <div class="addProductTool">
|
|
|
|
- <by-tool :propConfig="toolConfig"></by-tool>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <by-table :propConfig="tableConfig" ref="table">
|
|
|
|
- <template v-slot:slotField='{ row }'>插槽:{{ row.name }}</template>
|
|
|
|
- </by-table>
|
|
|
|
- </el-collapse-item>
|
|
|
|
- <el-collapse-item title="订单支付情况" name="4">
|
|
|
|
- <el-radio-group v-model="radioPay" @input="inputPay">
|
|
|
|
- <el-radio :label="1">待付款</el-radio>
|
|
|
|
- <el-radio :label="2">快速支付&已付款</el-radio>
|
|
|
|
- <el-radio :label="3">手工添加支付信息</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- <by-form v-if="radioPay == 3" :propConfig="payConfig" ref="payform"></by-form>
|
|
|
|
- </el-collapse-item>
|
|
|
|
- <el-collapse-item title="发票信息" name="5">
|
|
|
|
- <by-form :propConfig="invoicesConfig" ref="invoicesform"></by-form>
|
|
|
|
- </el-collapse-item>
|
|
|
|
- </el-collapse>
|
|
|
|
- </template>
|
|
|
|
- <template #footer>
|
|
|
|
- <div class="btn">
|
|
|
|
- <el-button type="primary" size="small">确定并继续</el-button>
|
|
|
|
- <el-button type="primary" size="small">确定</el-button>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
- </vxe-modal>
|
|
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-slot:qty='{ row }'>
|
|
|
|
+ <el-input v-model="row.qty" placeholder="数量" class="number-input" type="number" @input="qtyChange($event, row)"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-slot:price='{ row }'>
|
|
|
|
+ <el-input v-model="row.price" placeholder="单价" class="number-input" type="number" @input="priceChange($event, row)"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </by-table>
|
|
|
|
+ </el-collapse-item>
|
|
|
|
+ <el-collapse-item title="订单支付情况" name="4" class="add-order-item">
|
|
|
|
+ <el-radio-group v-model="radioPay" @input="inputPay" class="payType">
|
|
|
|
+ <el-radio :label="1">待付款</el-radio>
|
|
|
|
+ <el-radio :label="2">快速支付&已付款</el-radio>
|
|
|
|
+ <el-radio :label="3">手工添加支付信息</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ <by-form v-if="radioPay == 3" :propConfig="payConfig" ref="payform"></by-form>
|
|
|
|
+ </el-collapse-item>
|
|
|
|
+ <el-collapse-item title="发票信息" name="5" class="add-order-item">
|
|
|
|
+ <by-form :propConfig="invoicesConfig" ref="invoicesform"></by-form>
|
|
|
|
+ </el-collapse-item>
|
|
|
|
+ </el-collapse>
|
|
|
|
+ <productDialog ref="product" @confirm="confirmProduct" />
|
|
|
|
+ </template>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <div class="btn">
|
|
|
|
+ <el-button type="primary" size="small">确定并继续</el-button>
|
|
|
|
+ <el-button type="primary" size="small" @click="btn">确定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ </vxe-modal>
|
|
|
|
+
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
@@ -57,6 +71,7 @@ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
@Component
|
|
@Component
|
|
export default class AddOrder extends Vue {
|
|
export default class AddOrder extends Vue {
|
|
value=false;
|
|
value=false;
|
|
|
|
+ productData:Array<any>=[]
|
|
userName:any='';//用户信息
|
|
userName:any='';//用户信息
|
|
orderValue:any={}; //新增订单值
|
|
orderValue:any={}; //新增订单值
|
|
radioPay=null;
|
|
radioPay=null;
|
|
@@ -224,7 +239,20 @@ export default class AddOrder extends Vue {
|
|
label:'收货地址',
|
|
label:'收货地址',
|
|
// slot:true,
|
|
// slot:true,
|
|
prop:'address',
|
|
prop:'address',
|
|
- component:'by-area'
|
|
|
|
|
|
+ component:'by-area',
|
|
|
|
+ compConfig:{
|
|
|
|
+ attr:{
|
|
|
|
+ province:'receiverProvince', //省
|
|
|
|
+ provinceCode:'receiverProvinceCode', //省编码
|
|
|
|
+ city:'receiverCity', //市
|
|
|
|
+ cityCode:'receiverCityCode', //市编码
|
|
|
|
+ county:'receiverDistrict', //县/区
|
|
|
|
+ countyCode:'receiverDistrictCode', //县/区编码
|
|
|
|
+ townCode:'receiverTownCode',
|
|
|
|
+ town:'receiverTown',
|
|
|
|
+ // show:'county'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}],
|
|
}],
|
|
[{
|
|
[{
|
|
span:24,
|
|
span:24,
|
|
@@ -276,23 +304,38 @@ export default class AddOrder extends Vue {
|
|
}
|
|
}
|
|
tableConfig:any={
|
|
tableConfig:any={
|
|
attr:{
|
|
attr:{
|
|
- size:'mini',
|
|
|
|
|
|
+ size:'small',
|
|
seq:true,
|
|
seq:true,
|
|
align:'center',
|
|
align:'center',
|
|
checkbox:true,
|
|
checkbox:true,
|
|
},
|
|
},
|
|
columns:[{
|
|
columns:[{
|
|
title:'名称|款式编码|商品编码',
|
|
title:'名称|款式编码|商品编码',
|
|
- field:'id',
|
|
|
|
|
|
+ field:'t_cont',
|
|
|
|
+ slot:true,
|
|
width:300
|
|
width:300
|
|
},{
|
|
},{
|
|
title:'数量',
|
|
title:'数量',
|
|
field:'qty',
|
|
field:'qty',
|
|
- width:100
|
|
|
|
|
|
+ width:100,
|
|
|
|
+ slot:true,
|
|
|
|
+ // component:'by-input',
|
|
|
|
+ // compConfig:{
|
|
|
|
+ // attr:{
|
|
|
|
+ // type:'number'
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
},{
|
|
},{
|
|
title:'单价',
|
|
title:'单价',
|
|
field:'price',
|
|
field:'price',
|
|
- width:100
|
|
|
|
|
|
+ width:100,
|
|
|
|
+ slot:true,
|
|
|
|
+ // component:'by-input',
|
|
|
|
+ // compConfig:{
|
|
|
|
+ // attr:{
|
|
|
|
+ // type:'number'
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
},{
|
|
},{
|
|
title:'原价',
|
|
title:'原价',
|
|
field:'basePrice',
|
|
field:'basePrice',
|
|
@@ -325,7 +368,7 @@ export default class AddOrder extends Vue {
|
|
{
|
|
{
|
|
name: '新增商品', icon: 'el-icon-plus', event:{
|
|
name: '新增商品', icon: 'el-icon-plus', event:{
|
|
click:()=>{
|
|
click:()=>{
|
|
- console.log('新增123')
|
|
|
|
|
|
+ (this.$refs.product as any).setShow(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -604,14 +647,71 @@ export default class AddOrder extends Vue {
|
|
}
|
|
}
|
|
mounted(){
|
|
mounted(){
|
|
this.userName = this.$store.getters.name;
|
|
this.userName = this.$store.getters.name;
|
|
- console.log('用户信息',this.userName);
|
|
|
|
-
|
|
|
|
|
|
|
|
}
|
|
}
|
|
show(){
|
|
show(){
|
|
(this.$refs.baseform as any).setValue({
|
|
(this.$refs.baseform as any).setValue({
|
|
createBy:this.userName
|
|
createBy:this.userName
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ confirmProduct(data:Array<any>){
|
|
|
|
+ let nowData = (this.$refs.table as any).getValue();
|
|
|
|
+ let ids='';
|
|
|
|
+ if(data.length > 0){
|
|
|
|
+ for(const item of data){
|
|
|
|
+ let t = true;
|
|
|
|
+ for(const t_item of nowData){
|
|
|
|
+ if(item.id == t_item.skuId){
|
|
|
|
+ if(!ids){
|
|
|
|
+ ids = item.id
|
|
|
|
+ }else{
|
|
|
|
+ ids = ids + ',' + item.id
|
|
|
|
+ }
|
|
|
|
+ t = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(t){
|
|
|
|
+ let obj:any={};
|
|
|
|
+ obj.name = item.name; //商品名称
|
|
|
|
+ obj.skuId = item.id; //商品编码
|
|
|
|
+ obj.styleId = item.newNumber; //款式编码
|
|
|
|
+ obj.qty = 1;
|
|
|
|
+ obj.price = item.price; //单价
|
|
|
|
+ obj.basePrice = item.basePrice; //原价
|
|
|
|
+ obj.amount = item.price;
|
|
|
|
+ obj.stock = item.stock;
|
|
|
|
+ nowData.push(obj)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ console.log(nowData);
|
|
|
|
+ (this.$refs.table as any).setValue(nowData);
|
|
|
|
+ if(ids){
|
|
|
|
+ this.$alert('编码“'+ids+'”已添加!', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ callback: action => {}
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ qtyChange(v:any,row:any){
|
|
|
|
+ if(v && row.price){
|
|
|
|
+ row.amount = v*row.price
|
|
|
|
+ }else{
|
|
|
|
+ row.amount = 0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ priceChange(v:any,row:any){
|
|
|
|
+ if(v && row.qty){
|
|
|
|
+ row.amount = v*row.qty
|
|
|
|
+ }else{
|
|
|
|
+ row.amount = 0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ btn(){
|
|
|
|
+ let value = (this.$refs.infoform as any).getValue();
|
|
|
|
+ console.log(value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
@@ -629,6 +729,23 @@ export default class AddOrder extends Vue {
|
|
width: 100%;
|
|
width: 100%;
|
|
padding-bottom: 8px;
|
|
padding-bottom: 8px;
|
|
}
|
|
}
|
|
|
|
+.payType{
|
|
|
|
+ padding-bottom: 16px;
|
|
|
|
+}
|
|
|
|
+.product-cont{
|
|
|
|
+ width: 100%;
|
|
|
|
+ .product-name{
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ padding-bottom: 4px;
|
|
|
|
+ color: #000;
|
|
|
|
+ }
|
|
|
|
+ .other-info{
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ span{
|
|
|
|
+ padding: 0 8px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
</style>
|
|
</style>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|