feature/0423
wanghousheng 9 months ago
parent c9fa00edec
commit 685c66d19b
  1. 62
      src/views/goods/Create.vue
  2. 4
      src/views/server/Index.vue
  3. 28
      src/views/server/modules/Add.vue
  4. 36
      src/views/server/modules/Edit.vue

@ -36,7 +36,6 @@
:dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }"
:treeData="formData.categoryList" :treeData="formData.categoryList"
treeCheckable treeCheckable
treeCheckStrictly
allowClear allowClear
v-decorator="['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]" v-decorator="['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"
></a-tree-select> ></a-tree-select>
@ -377,7 +376,10 @@
<span>{{ province.name }}</span> <span>{{ province.name }}</span>
<template v-if="province.citys.length"> <template v-if="province.citys.length">
<span>(</span> <span>(</span>
<span class="city-name" v-for="(city, cidx) in province.citys" :key="cidx" <span
class="city-name"
v-for="(city, cidx) in province.citys"
:key="cidx"
>{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span >{{ city.name }}{{ province.citys.length > cidx + 1 ? '、' : '' }}</span
> >
<span>)</span> <span>)</span>
@ -534,7 +536,7 @@ import { AreasModal } from '@/components/Modal'
const defaultItem = { const defaultItem = {
key: 0, key: 0,
region: [], region: [],
region_text: [], region_text: []
} }
export default { export default {
components: { components: {
@ -544,9 +546,9 @@ export default {
Ueditor, Ueditor,
InputNumberGroup, InputNumberGroup,
MultiSpec, MultiSpec,
AreasModal, AreasModal
}, },
data() { data () {
return { return {
// //
tabKey: 0, tabKey: 0,
@ -570,15 +572,15 @@ export default {
title: '销售区域', title: '销售区域',
dataIndex: 'region_text', dataIndex: 'region_text',
width: '400px', width: '400px',
scopedSlots: { customRender: 'region_text' }, scopedSlots: { customRender: 'region_text' }
}, }
], ],
// //
citysCount: null, citysCount: null
} }
}, },
// //
created() { created () {
this.isLoading = true this.isLoading = true
// form // form
GoodsModel.getFromData().then(() => { GoodsModel.getFromData().then(() => {
@ -587,7 +589,7 @@ export default {
}, },
methods: { methods: {
// //
onForceUpdate(bool = false) { onForceUpdate (bool = false) {
this.$forceUpdate() this.$forceUpdate()
// booltrue $forceUpdate, // booltrue $forceUpdate,
// $forceUpdate, v-decoratorform.getFieldValue // $forceUpdate, v-decoratorform.getFieldValue
@ -598,12 +600,12 @@ export default {
}, },
// tab // tab
handleTabs(key) { handleTabs (key) {
this.tabKey = key this.tabKey = key
}, },
// //
onReloadCategoryList() { onReloadCategoryList () {
this.isLoading = true this.isLoading = true
GoodsModel.getCategoryList().then(() => { GoodsModel.getCategoryList().then(() => {
this.isLoading = false this.isLoading = false
@ -611,7 +613,7 @@ export default {
}, },
// //
onReloadServiceList() { onReloadServiceList () {
this.isLoading = true this.isLoading = true
GoodsModel.getServiceList().then(() => { GoodsModel.getServiceList().then(() => {
this.isLoading = false this.isLoading = false
@ -619,7 +621,7 @@ export default {
}, },
// //
onReloadDeliveryList() { onReloadDeliveryList () {
this.isLoading = true this.isLoading = true
GoodsModel.getDeliveryList().then(() => { GoodsModel.getDeliveryList().then(() => {
this.isLoading = false this.isLoading = false
@ -627,12 +629,12 @@ export default {
}, },
// //
handleSubmit(e) { handleSubmit (e) {
e.preventDefault() e.preventDefault()
// //
const { const {
form: { validateFields }, form: { validateFields },
ruleList, ruleList
} = this } = this
validateFields((errors, values) => { validateFields((errors, values) => {
// tab // tab
@ -661,14 +663,14 @@ export default {
}, },
// tab // tab
onTargetTabError(errors) { onTargetTabError (errors) {
// tabKey // tabKey
// //
const tabsFieldsMap = [ const tabsFieldsMap = [
['goods_type', 'goods_name', 'categorys', 'imagesIds', 'delivery_id', 'is_ind_delivery_type', 'delivery_type'], ['goods_type', 'goods_name', 'categorys', 'imagesIds', 'delivery_id', 'is_ind_delivery_type', 'delivery_type'],
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single'], ['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single'],
['content'], ['content'],
['alone_grade_equity', 'first_money', 'second_money', 'third_money'], ['alone_grade_equity', 'first_money', 'second_money', 'third_money']
] ]
const field = Object.keys(errors).shift() const field = Object.keys(errors).shift()
for (const key in tabsFieldsMap) { for (const key in tabsFieldsMap) {
@ -680,7 +682,7 @@ export default {
}, },
// api // api
onFormSubmit(values) { onFormSubmit (values) {
this.isLoading = true this.isLoading = true
this.isBtnLoading = true this.isBtnLoading = true
GoodsApi.add({ form: values }) GoodsApi.add({ form: values })
@ -698,7 +700,7 @@ export default {
.finally(() => (this.isLoading = false)) .finally(() => (this.isLoading = false))
}, },
// //
handleAdd() { handleAdd () {
const index = this.ruleList.length const index = this.ruleList.length
const newItem = { ...defaultItem, key: index } const newItem = { ...defaultItem, key: index }
// id(id) // id(id)
@ -712,7 +714,7 @@ export default {
}, },
// //
handleEdit(index, item) { handleEdit (index, item) {
// id(id) // id(id)
const excludedCityIds = this.getExcludedCityIds() const excludedCityIds = this.getExcludedCityIds()
// //
@ -720,9 +722,9 @@ export default {
}, },
// //
handleAreaSubmit(result) { handleAreaSubmit (result) {
const { const {
custom: { scene, item }, custom: { scene, item }
} = result } = result
item.region = result.selectedCityIds item.region = result.selectedCityIds
item.region_text = result.selectedText item.region_text = result.selectedText
@ -732,7 +734,7 @@ export default {
}, },
// id(id) // id(id)
getExcludedCityIds() { getExcludedCityIds () {
const excludedCityIds = [] const excludedCityIds = []
this.ruleList.forEach((item) => { this.ruleList.forEach((item) => {
item.region.forEach((cityId) => { item.region.forEach((cityId) => {
@ -743,22 +745,22 @@ export default {
}, },
// //
handleAreasModal(scene, index, item, excludedCityIds) { handleAreasModal (scene, index, item, excludedCityIds) {
this.$refs.AreasModal.handle({ scene, index, item }, item.region, excludedCityIds) this.$refs.AreasModal.handle({ scene, index, item }, item.region, excludedCityIds)
}, },
// //
handleDelete(index) { handleDelete (index) {
const app = this const app = this
const modal = this.$confirm({ const modal = this.$confirm({
title: '您确定要删除该记录吗?', title: '您确定要删除该记录吗?',
onOk() { onOk () {
app.ruleList.splice(index, 1) app.ruleList.splice(index, 1)
modal.destroy() modal.destroy()
}, }
}) })
}, }
}, }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

@ -127,8 +127,8 @@ const columns = [
scopedSlots: { customRender: 'server_price' } scopedSlots: { customRender: 'server_price' }
}, },
{ {
title: '成本价', title: '划线价',
dataIndex: 'cost_price', dataIndex: 'line_price',
scopedSlots: { customRender: 'cost_price' } scopedSlots: { customRender: 'cost_price' }
}, },
{ {

@ -38,7 +38,7 @@
<a-input-number <a-input-number
:min="0.01" :min="0.01"
:precision="2" :precision="2"
v-decorator="['cost_price', { initialValue: 1, rules: [{ required: true, message: '请输入成本价' }] }]" v-decorator="['line_price', { initialValue: 1, rules: [{ required: true, message: '请输入划线价' }] }]"
/> />
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>
@ -94,41 +94,41 @@ import { SelectImage, Ueditor } from '@/components'
export default { export default {
components: { components: {
SelectImage, SelectImage,
Ueditor, Ueditor
}, },
props: { props: {
// //
}, },
data() { data () {
return { return {
categoryList: [], categoryList: [],
// //
title: '', title: '',
// //
labelCol: { labelCol: {
span: 7, span: 7
}, },
// //
wrapperCol: { wrapperCol: {
span: 13, span: 13
}, },
// modal() // modal()
visible: false, visible: false,
// modal() loading // modal() loading
confirmLoading: false, confirmLoading: false,
// //
form: this.$form.createForm(this), form: this.$form.createForm(this)
} }
}, },
methods: { methods: {
// //
add() { add () {
// //
this.getCategoryList() this.getCategoryList()
this.visible = true this.visible = true
}, },
// //
getCategoryList() { getCategoryList () {
this.isLoading = true this.isLoading = true
Api.categoryList() Api.categoryList()
.then((result) => { .then((result) => {
@ -137,11 +137,11 @@ export default {
.finally(() => (this.isLoading = false)) .finally(() => (this.isLoading = false))
}, },
// //
handleSubmit(e) { handleSubmit (e) {
e.preventDefault() e.preventDefault()
// //
const { const {
form: { validateFields }, form: { validateFields }
} = this } = this
validateFields((errors, values) => { validateFields((errors, values) => {
// api // api
@ -152,13 +152,13 @@ export default {
}, },
// //
handleCancel() { handleCancel () {
this.visible = false this.visible = false
this.form.resetFields() this.form.resetFields()
}, },
// api // api
onFormSubmit(values) { onFormSubmit (values) {
this.confirmLoading = true this.confirmLoading = true
Api.addServer({ form: values }) Api.addServer({ form: values })
.then((result) => { .then((result) => {
@ -172,7 +172,7 @@ export default {
.finally((result) => { .finally((result) => {
this.confirmLoading = false this.confirmLoading = false
}) })
}, }
}, }
} }
</script> </script>

@ -34,11 +34,11 @@
/> />
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>
<a-form-item label="成本价" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="划线价" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number <a-input-number
:min="0.01" :min="0.01"
:precision="2" :precision="2"
v-decorator="['cost_price', { initialValue: 1, rules: [{ required: true, message: '请输入成本价' }] }]" v-decorator="['line_price', { initialValue: 1, rules: [{ required: true, message: '请输入划线价' }] }]"
/> />
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>
@ -94,23 +94,23 @@ import { SelectImage, Ueditor } from '@/components'
export default { export default {
components: { components: {
SelectImage, SelectImage,
Ueditor, Ueditor
}, },
props: { props: {
// //
}, },
data() { data () {
return { return {
categoryList: [], categoryList: [],
// //
title: '', title: '',
// //
labelCol: { labelCol: {
span: 7, span: 7
}, },
// //
wrapperCol: { wrapperCol: {
span: 13, span: 13
}, },
// modal() // modal()
visible: false, visible: false,
@ -119,12 +119,12 @@ export default {
// //
form: this.$form.createForm(this), form: this.$form.createForm(this),
// //
record: {}, record: {}
} }
}, },
methods: { methods: {
// //
edit(record) { edit (record) {
this.getCategoryList() this.getCategoryList()
// //
this.visible = true this.visible = true
@ -134,7 +134,7 @@ export default {
this.setFieldsValue() this.setFieldsValue()
}, },
// //
getCategoryList() { getCategoryList () {
this.isLoading = true this.isLoading = true
Api.categoryList() Api.categoryList()
.then((result) => { .then((result) => {
@ -143,9 +143,9 @@ export default {
.finally(() => (this.isLoading = false)) .finally(() => (this.isLoading = false))
}, },
// //
setFieldsValue() { setFieldsValue () {
const { const {
form: { setFieldsValue }, form: { setFieldsValue }
} = this } = this
// //
this.$nextTick(() => { this.$nextTick(() => {
@ -161,17 +161,17 @@ export default {
'content', 'content',
'comment_rate', 'comment_rate',
'sold', 'sold',
'comment_num', 'comment_num'
]) ])
) )
}) })
}, },
// //
handleSubmit(e) { handleSubmit (e) {
e.preventDefault() e.preventDefault()
// //
const { const {
form: { validateFields }, form: { validateFields }
} = this } = this
validateFields((errors, values) => { validateFields((errors, values) => {
// api // api
@ -182,13 +182,13 @@ export default {
}, },
// //
handleCancel() { handleCancel () {
this.visible = false this.visible = false
this.form.resetFields() this.form.resetFields()
}, },
// api // api
onFormSubmit(values) { onFormSubmit (values) {
this.confirmLoading = true this.confirmLoading = true
Api.editServer({ serverId: this.record['server_id'], form: values }) Api.editServer({ serverId: this.record['server_id'], form: values })
.then((result) => { .then((result) => {
@ -202,7 +202,7 @@ export default {
.finally((result) => { .finally((result) => {
this.confirmLoading = false this.confirmLoading = false
}) })
}, }
}, }
} }
</script> </script>

Loading…
Cancel
Save