master
fanfan 6 months ago
parent a1967a046a
commit aa2f14a69c
  1. 45
      src/api/goods/index.js
  2. 1077
      src/views/goods/Index.vue
  3. 4
      src/views/recovery/Index.vue
  4. 8
      src/views/recovery/modules/Edit.vue
  5. 4
      src/views/server/Index.vue
  6. 360
      src/views/server/modules/Edit.vue

@ -17,7 +17,50 @@ const api = {
pool: '/goods/pool',
collector:'/goods/collector'
}
/**
* 大牌
* @param {*} data
*/
export function setBrand (data) {
return axios({
url: '/goods/setBrand',
method: 'post',
data: data
})
}
/**
* 新品
* @param {*} data
*/
export function setNew (data) {
return axios({
url: '/goods/setNew',
method: 'post',
data: data
})
}
/**
* 是否店内
* @param {*} data
*/
export function setInstore (data) {
return axios({
url: '/goods/setInstore',
method: 'post',
data: data
})
}
/**
* 是否店内
* @param {*} data
*/
export function setRank (data) {
return axios({
url: '/goods/setRank',
method: 'post',
data: data
})
}
export function getCollector (params) {
return axios({
url: api.collector,

File diff suppressed because it is too large Load Diff

@ -63,8 +63,8 @@
>
<!-- 回收图片 -->
<span slot="recovery_image" slot-scope="text, item">
<a title="点击查看原图" :href="item.image.external_url" target="_blank">
<img width="50" height="50" :src="item.image.external_url" alt="回收图片" />
<a title="点击查看原图" :href="item.recovery_image" target="_blank">
<img width="50" height="50" :src="item.recovery_image" alt="回收图片" />
</a>
</span>
<!-- 回收名称 -->

@ -50,7 +50,7 @@
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
<SelectImage :defaultList="record.image ? [record.image] : []" v-decorator="['image_id']" />
<SelectImage :defaultList="record.recovery_image ? record.recovery_image : []" v-decorator="['image_id']" />
</a-form-item>
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]">
@ -109,6 +109,12 @@ export default {
methods: {
//
edit(record) {
let list = []
list.push({
preview_url: record.recovery_image,
file_id: 9999
})
record.recovery_image = list
this.getCategoryList()
//
this.visible = true

@ -63,8 +63,8 @@
>
<!-- 服务图片 -->
<span slot="server_image" slot-scope="text, item">
<a title="点击查看原图" :href="item.image.external_url" target="_blank">
<img width="50" height="50" :src="item.image.external_url" alt="服务图片" />
<a title="点击查看原图" :href="item.server_image" target="_blank">
<img width="50" height="50" :src="item.server_image" alt="服务图片" />
</a>
</span>
<!-- 服务名称 -->

@ -1,208 +1,178 @@
<template>
<a-modal
title="编辑服务"
:width="920"
:visible="visible"
:confirmLoading="confirmLoading"
:maskClosable="false"
:destroyOnClose="true"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item label="服务名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input
v-decorator="['server_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/>
</a-form-item>
<a-form-item label="服务分类" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select
v-decorator="['category_id', { initialValue: 0, rules: [{ required: true, message: '请选择分类' }] }]"
>
<a-select-option :value="0">选择分类</a-select-option>
<a-select-option v-for="(item, index) in categoryList" :key="index" :value="item.category_id">{{
<a-modal title="编辑服务" :width="920" :visible="visible" :confirmLoading="confirmLoading" :maskClosable="false" :destroyOnClose="true" @ok="handleSubmit" @cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item label="服务名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['server_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
</a-form-item>
<a-form-item label="服务分类" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-decorator="['category_id', { initialValue: 0, rules: [{ required: true, message: '请选择分类' }] }]">
<a-select-option :value="0">选择分类</a-select-option>
<a-select-option v-for="(item, index) in categoryList" :key="index" :value="item.category_id">{{
item.name
}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="服务价格" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number
:min="0.01"
:precision="2"
v-decorator="['server_price', { initialValue: 1, rules: [{ required: true, message: '请输入服务价格' }] }]"
/>
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="划线价" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number
:min="0.01"
:precision="2"
v-decorator="['line_price', { initialValue: 1, rules: [{ required: true, message: '请输入划线价' }] }]"
/>
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="评论数量" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number
:min="10"
:step="10"
v-decorator="['comment_num', { initialValue: 10, rules: [{ required: true, message: '请输入评论数量' }] }]"
/>
</a-form-item>
<a-form-item label="好评率" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number
:min="90"
:step="1"
:max="100"
v-decorator="['comment_rate', { initialValue: 90, rules: [{ required: true, message: '请输入好评率' }] }]"
/>
<span class="ml-10">%</span>
</a-form-item>
<a-form-item label="销量" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number
:min="100"
v-decorator="['sold', { initialValue: 100, rules: [{ required: true, message: '请输入销量价格' }] }]"
/>
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="服务图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
<SelectImage :defaultList="record.image ? [record.image] : []" v-decorator="['image_id']" />
</a-form-item>
<a-form-item label="服务状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">上架</a-radio>
<a-radio :value="2">下架</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="数字越小越靠前">
<a-input-number
:min="0"
v-decorator="['sort', { initialValue: 100, rules: [{ required: true, message: '请输入至少1个数字' }] }]"
/>
</a-form-item>
<a-form-item label="服务详情" :labelCol="labelCol" :wrapperCol="wrapperCol">
<Ueditor v-decorator="['content', { rules: [{ required: true, message: '服务详情不能为空' }] }]" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</a-select>
</a-form-item>
<a-form-item label="服务价格" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number :min="0.01" :precision="2" v-decorator="['server_price', { initialValue: 1, rules: [{ required: true, message: '请输入服务价格' }] }]" />
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="划线价" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number :min="0.01" :precision="2" v-decorator="['line_price', { initialValue: 1, rules: [{ required: true, message: '请输入划线价' }] }]" />
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="评论数量" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number :min="10" :step="10" v-decorator="['comment_num', { initialValue: 10, rules: [{ required: true, message: '请输入评论数量' }] }]" />
</a-form-item>
<a-form-item label="好评率" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number :min="90" :step="1" :max="100" v-decorator="['comment_rate', { initialValue: 90, rules: [{ required: true, message: '请输入好评率' }] }]" />
<span class="ml-10">%</span>
</a-form-item>
<a-form-item label="销量" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number :min="100" v-decorator="['sold', { initialValue: 100, rules: [{ required: true, message: '请输入销量价格' }] }]" />
<span class="ml-10"></span>
</a-form-item>
<a-form-item label="服务图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
<SelectImage :defaultList="record.server_image ? record.server_image : []" v-decorator="['image_id']" />
</a-form-item>
<a-form-item label="服务状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]">
<a-radio :value="1">上架</a-radio>
<a-radio :value="2">下架</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="数字越小越靠前">
<a-input-number :min="0" v-decorator="['sort', { initialValue: 100, rules: [{ required: true, message: '请输入至少1个数字' }] }]" />
</a-form-item>
<a-form-item label="服务详情" :labelCol="labelCol" :wrapperCol="wrapperCol">
<Ueditor v-decorator="['content', { rules: [{ required: true, message: '服务详情不能为空' }] }]" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import * as Api from '@/api/server'
import { SelectImage, Ueditor } from '@/components'
export default {
components: {
SelectImage,
Ueditor
},
props: {
//
},
data () {
return {
categoryList: [],
//
title: '',
//
labelCol: {
span: 7
},
//
wrapperCol: {
span: 13
},
// modal()
visible: false,
// modal() loading
confirmLoading: false,
//
form: this.$form.createForm(this),
//
record: {}
}
},
methods: {
//
edit (record) {
this.getCategoryList()
//
this.visible = true
//
this.record = record
//
this.setFieldsValue()
},
//
getCategoryList () {
this.isLoading = true
Api.categoryList()
.then((result) => {
this.categoryList = result.data.list
})
.finally(() => (this.isLoading = false))
},
//
setFieldsValue () {
const {
form: { setFieldsValue }
} = this
//
this.$nextTick(() => {
setFieldsValue(
_.pick(this.record, [
'server_name',
'image_id',
'category_id',
'status',
'server_price',
'cost_price',
'sort',
'content',
'comment_rate',
'sold',
'comment_num'
])
)
})
},
//
handleSubmit (e) {
e.preventDefault()
//
const {
form: { validateFields }
} = this
validateFields((errors, values) => {
// api
if (!errors) {
this.onFormSubmit(values)
}
})
},
components: {
SelectImage,
Ueditor
},
props: {
//
},
data() {
return {
categoryList: [],
//
title: '',
//
labelCol: {
span: 7
},
//
wrapperCol: {
span: 13
},
// modal()
visible: false,
// modal() loading
confirmLoading: false,
//
form: this.$form.createForm(this),
//
record: {}
}
},
methods: {
//
edit(record) {
let list = []
list.push({
preview_url: record.server_image,
file_id: 9999
})
record.server_image = list
this.getCategoryList()
//
this.visible = true
//
this.record = record
//
this.setFieldsValue()
},
//
getCategoryList() {
this.isLoading = true
Api.categoryList()
.then((result) => {
this.categoryList = result.data.list
})
.finally(() => (this.isLoading = false))
},
//
setFieldsValue() {
const {
form: { setFieldsValue }
} = this
//
this.$nextTick(() => {
setFieldsValue(
_.pick(this.record, [
'server_name',
'image_id',
'category_id',
'status',
'server_price',
'cost_price',
'sort',
'content',
'comment_rate',
'sold',
'comment_num'
])
)
})
},
//
handleSubmit(e) {
e.preventDefault()
//
const {
form: { validateFields }
} = this
validateFields((errors, values) => {
// api
if (!errors) {
this.onFormSubmit(values)
}
})
},
//
handleCancel () {
this.visible = false
this.form.resetFields()
},
//
handleCancel() {
this.visible = false
this.form.resetFields()
},
// api
onFormSubmit (values) {
this.confirmLoading = true
Api.editServer({ serverId: this.record['server_id'], form: values })
.then((result) => {
//
this.$message.success(result.message, 1.5)
//
this.handleCancel()
//
this.$emit('handleSubmit', values)
})
.finally((result) => {
this.confirmLoading = false
})
}
}
// api
onFormSubmit(values) {
this.confirmLoading = true
Api.editServer({ serverId: this.record['server_id'], form: values })
.then((result) => {
//
this.$message.success(result.message, 1.5)
//
this.handleCancel()
//
this.$emit('handleSubmit', values)
})
.finally((result) => {
this.confirmLoading = false
})
}
}
}
</script>

Loading…
Cancel
Save