预售列表

master
fanfan 5 months ago
parent af186fb16e
commit bdd295f3d4
  1. 42
      src/views/market/presale/modules/EditForm.vue
  2. 2
      src/views/user/order/Index.vue

@ -1,14 +1,5 @@
<template> <template>
<a-modal <a-modal :title="title" :width="780" :visible="visible" :confirmLoading="confirmLoading" :maskClosable="false" :destroyOnClose="true" @ok="handleSubmit" @cancel="handleCancel">
:title="title"
:width="780"
:visible="visible"
:confirmLoading="confirmLoading"
:maskClosable="false"
:destroyOnClose="true"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form :form="form"> <a-form :form="form">
<a-form-item label="预售名称" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="预售名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
@ -16,19 +7,11 @@
</a-form-item> </a-form-item>
<a-form-item label="预售商品" :labelCol="labelCol" :wrapperCol="wrapperCol" required> <a-form-item label="预售商品" :labelCol="labelCol" :wrapperCol="wrapperCol" required>
<div style="width: 100%; overflow-x: auto;"> <div style="width: 100%; overflow-x: auto;">
<SelectGoods <SelectGoods :defaultList="selectGoodsList" :multiple="true" v-decorator="['goods_list', { rules: [{ required: true, message: '请选择预售商品' }] }]" />
:defaultList="selectGoodsList"
:multiple="true"
v-decorator="['goods_list', { rules: [{ required: true, message: '请选择预售商品' }] }]"
/>
</div> </div>
</a-form-item> </a-form-item>
<a-form-item label="预售时间" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="预售时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-date-picker <a-date-picker show-time format="YYYY-MM-DD HH:mm:ss" v-decorator="['p_time', { rules: [{ required: true, message: '请输入预售时间' }] }]" />
show-time
format="YYYY-MM-DD HH:mm:ss"
v-decorator="['p_time', { rules: [{ required: true, message: '请输入预售时间' }] }]"
/>
</a-form-item> </a-form-item>
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
@ -52,7 +35,7 @@ export default {
SelectImage, SelectImage,
SelectGoods SelectGoods
}, },
data () { data() {
return { return {
// //
title: '编辑预售', title: '编辑预售',
@ -75,7 +58,7 @@ export default {
methods: { methods: {
// //
edit (record) { edit(record) {
// //
this.visible = true this.visible = true
// //
@ -88,7 +71,7 @@ export default {
}, },
// //
setFieldsValue () { setFieldsValue() {
const { record, form: { setFieldsValue } } = this const { record, form: { setFieldsValue } } = this
this.$nextTick(() => { this.$nextTick(() => {
setFieldsValue(pick(record, ['name', 'goods_list', 'p_time', 'status'])) setFieldsValue(pick(record, ['name', 'goods_list', 'p_time', 'status']))
@ -96,7 +79,7 @@ export default {
}, },
// //
handleSubmit (e) { handleSubmit(e) {
e.preventDefault() e.preventDefault()
// //
const { form: { validateFields } } = this const { form: { validateFields } } = this
@ -107,15 +90,18 @@ export default {
}, },
// //
handleCancel () { handleCancel() {
this.visible = false this.visible = false
this.form.resetFields() this.form.resetFields()
}, },
hasObject(arr) {
return arr.some(item => typeof item === 'object' && item !== null);
},
// api // api
onFormSubmit (values) { onFormSubmit(values) {
this.confirmLoading = true this.confirmLoading = true
Api.edit({ id: this.record.id, form: { ...values, goods_list: values.goods_list.join(',') } }) let arrType=this.hasObject(values.goods_list)
Api.edit({ id: this.record.id, form: { ...values, goods_list: arrType?values.goods_list.map(item => item.goods_id).join(","):values.goods_list.join(',') } })
.then(result => { .then(result => {
// //
this.$message.success(result.message, 1.5) this.$message.success(result.message, 1.5)

@ -24,7 +24,7 @@
</a-form-item> </a-form-item>
<a-form-item label="支付方式"> <a-form-item label="支付方式">
<a-select v-decorator="['pay_method', { initialValue: 0 }]"> <a-select v-decorator="['pay_method', { initialValue: 0 }]">
<a-select-option :value="''">全部</a-select-option> <a-select-option :value="0">全部</a-select-option>
<a-select-option :value="'wechat'">会员</a-select-option> <a-select-option :value="'wechat'">会员</a-select-option>
<a-select-option :value="'balance'">分销商 </a-select-option> <a-select-option :value="'balance'">分销商 </a-select-option>
</a-select> </a-select>

Loading…
Cancel
Save