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', pool: '/goods/pool',
collector:'/goods/collector' 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) { export function getCollector (params) {
return axios({ return axios({
url: api.collector, 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"> <span slot="recovery_image" slot-scope="text, item">
<a title="点击查看原图" :href="item.image.external_url" target="_blank"> <a title="点击查看原图" :href="item.recovery_image" target="_blank">
<img width="50" height="50" :src="item.image.external_url" alt="回收图片" /> <img width="50" height="50" :src="item.recovery_image" alt="回收图片" />
</a> </a>
</span> </span>
<!-- 回收名称 --> <!-- 回收名称 -->

@ -50,7 +50,7 @@
<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">
<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>
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]"> <a-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]">
@ -109,6 +109,12 @@ export default {
methods: { methods: {
// //
edit(record) { edit(record) {
let list = []
list.push({
preview_url: record.recovery_image,
file_id: 9999
})
record.recovery_image = list
this.getCategoryList() this.getCategoryList()
// //
this.visible = true this.visible = true

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

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

Loading…
Cancel
Save