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

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

@ -38,7 +38,7 @@
<a-input-number
:min="0.01"
: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>
</a-form-item>
@ -94,41 +94,41 @@ import { SelectImage, Ueditor } from '@/components'
export default {
components: {
SelectImage,
Ueditor,
Ueditor
},
props: {
//
},
data() {
data () {
return {
categoryList: [],
//
title: '',
//
labelCol: {
span: 7,
span: 7
},
//
wrapperCol: {
span: 13,
span: 13
},
// modal()
visible: false,
// modal() loading
confirmLoading: false,
//
form: this.$form.createForm(this),
form: this.$form.createForm(this)
}
},
methods: {
//
add() {
add () {
//
this.getCategoryList()
this.visible = true
},
//
getCategoryList() {
getCategoryList () {
this.isLoading = true
Api.categoryList()
.then((result) => {
@ -137,11 +137,11 @@ export default {
.finally(() => (this.isLoading = false))
},
//
handleSubmit(e) {
handleSubmit (e) {
e.preventDefault()
//
const {
form: { validateFields },
form: { validateFields }
} = this
validateFields((errors, values) => {
// api
@ -152,13 +152,13 @@ export default {
},
//
handleCancel() {
handleCancel () {
this.visible = false
this.form.resetFields()
},
// api
onFormSubmit(values) {
onFormSubmit (values) {
this.confirmLoading = true
Api.addServer({ form: values })
.then((result) => {
@ -172,7 +172,7 @@ export default {
.finally((result) => {
this.confirmLoading = false
})
},
},
}
}
}
</script>

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

Loading…
Cancel
Save