|
|
@@ -14,8 +14,11 @@
|
|
|
</a-form-model-item>
|
|
|
<a-row>
|
|
|
<a-col :span="24">
|
|
|
- <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money">
|
|
|
- <a-input-number :disabled="model.subjectType==6" v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
|
|
|
+ <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="" v-if="model.subjectType==6">
|
|
|
+ <a-input-number :disabled="model.subjectType==6" v-model="goodsPrice" placeholder="请输入金额" :min="0"></a-input-number>
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money" v-else>
|
|
|
+ <a-input-number v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
@@ -31,12 +34,15 @@
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
<a-table :columns="columns" :loading="loading" :dataSource="dataSource" style="margin-top:10px;">
|
|
|
- <template slot="sellingPrice" slot-scope="text, record">
|
|
|
- <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>
|
|
|
- </template>
|
|
|
- <template slot="number" slot-scope="text, record">
|
|
|
- <a-input-number v-model="record.number" :min="0"></a-input-number>
|
|
|
- </template>
|
|
|
+ <template slot="sellingPrice" slot-scope="text, record">
|
|
|
+ <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>
|
|
|
+ </template>
|
|
|
+ <template slot="number" slot-scope="text, record">
|
|
|
+ <a-input-number :max="record.inventory" v-model="record.number" @change="changeNumber" :min="0"></a-input-number>
|
|
|
+ </template>
|
|
|
+ <template slot="inventorySlot" slot-scope="text,record">
|
|
|
+ {{record.inventory - record.number}}
|
|
|
+ </template>
|
|
|
</a-table>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
@@ -61,11 +67,13 @@ import {
|
|
|
validateDuplicateValue
|
|
|
} from "@/utils/util";
|
|
|
|
|
|
-import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
|
+import {
|
|
|
+ JeecgListMixin
|
|
|
+} from '@/mixins/JeecgListMixin'
|
|
|
export default {
|
|
|
name: "BusMemberCardForm",
|
|
|
components: {},
|
|
|
- mixins:[JeecgListMixin],
|
|
|
+ mixins: [JeecgListMixin],
|
|
|
props: {
|
|
|
//表单禁用
|
|
|
disabled: {
|
|
|
@@ -79,7 +87,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- dataSource:[],
|
|
|
+ dataSource: [],
|
|
|
columns: [{
|
|
|
title: "名称",
|
|
|
align: "center",
|
|
|
@@ -89,18 +97,25 @@ export default {
|
|
|
title: "售价",
|
|
|
align: "center",
|
|
|
dataIndex: "sellingPrice",
|
|
|
- scopedSlots: { customRender: 'sellingPrice' },
|
|
|
+ scopedSlots: {
|
|
|
+ customRender: 'sellingPrice'
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: "数量",
|
|
|
align: "center",
|
|
|
dataIndex: "number",
|
|
|
- scopedSlots: { customRender: 'number' },
|
|
|
+ scopedSlots: {
|
|
|
+ customRender: 'number'
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: "剩余库存",
|
|
|
align: "center",
|
|
|
dataIndex: "inventory",
|
|
|
+ scopedSlots: {
|
|
|
+ customRender: 'inventorySlot'
|
|
|
+ }
|
|
|
},
|
|
|
],
|
|
|
model: {
|
|
|
@@ -138,7 +153,7 @@ export default {
|
|
|
}],
|
|
|
},
|
|
|
url: {
|
|
|
- list: "/rooms/cesGoods/queryList",
|
|
|
+ list: "/rooms/cesGoods/kf-goods-list",
|
|
|
edit: "/business/busMemberCard/edit",
|
|
|
queryById: "/business/busMemberCard/queryById",
|
|
|
},
|
|
|
@@ -153,6 +168,10 @@ export default {
|
|
|
formDisabled() {
|
|
|
return this.disabled;
|
|
|
},
|
|
|
+ goodsPrice() {
|
|
|
+ let money = this.dataSource.reduce((pre, cur) => pre + cur.sellingPrice * (cur.number || 0), 0)
|
|
|
+ return money
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
var _info = JSON.parse(localStorage.getItem("storeInfo"));
|
|
|
@@ -172,9 +191,11 @@ export default {
|
|
|
// this.dataSource = res.result.records;
|
|
|
// }
|
|
|
// })
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
+ changeNumber() {
|
|
|
+ console.log(this.dataSource);
|
|
|
+ },
|
|
|
handleSearch(value) {
|
|
|
let result;
|
|
|
if (!value) {
|
|
|
@@ -212,11 +233,30 @@ export default {
|
|
|
// 触发表单验证
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ if (this.dataSource.every(ele=>ele.number==0) && this.model.subjectType == 6) {
|
|
|
+ this.$message.warning("请至少选择一件商品")
|
|
|
+ return
|
|
|
+ }
|
|
|
that.confirmLoading = true;
|
|
|
var orders = [];
|
|
|
+ let feeGoods = []
|
|
|
+
|
|
|
+ if (this.model.subjectType == 6) {
|
|
|
+ that.dataSource.forEach(ele=>{
|
|
|
+ if (ele.number>0) {
|
|
|
+ feeGoods.push({
|
|
|
+ goodsId: ele.id,
|
|
|
+ num: ele.number,
|
|
|
+ price: ele.sellingPrice
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ that.model.money = that.goodsPrice
|
|
|
+ }
|
|
|
orders.push({
|
|
|
money: this.model.money,
|
|
|
subjectType: this.model.subjectType,
|
|
|
+ feeGoods: feeGoods
|
|
|
});
|
|
|
this.model.orders = orders;
|
|
|
this.model.livingOrderId = this.livingOrderId;
|
|
|
@@ -235,6 +275,42 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ loadData(arg) {
|
|
|
+ if (this.url.list == 2) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.url.list) {
|
|
|
+ this.$message.error("请设置url.list属性!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //加载数据 若传入参数1则加载第一页的内容
|
|
|
+ if (arg === 1) {
|
|
|
+ this.ipagination.current = 1;
|
|
|
+ }
|
|
|
+ var params = this.getQueryParams(); //查询条件
|
|
|
+ this.loading = true;
|
|
|
+ getAction(this.url.list, params).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
|
+ let arr = []
|
|
|
+ arr = res.result.records || res.result;
|
|
|
+ arr.forEach(ele=>{
|
|
|
+ ele.number = 0
|
|
|
+ })
|
|
|
+ this.dataSource = JSON.parse(JSON.stringify(arr));
|
|
|
+ if (res.result.total) {
|
|
|
+ this.ipagination.total = res.result.total;
|
|
|
+ } else {
|
|
|
+ this.ipagination.total = 0;
|
|
|
+ }
|
|
|
+ //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message)
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|