master
fanfan 6 months ago
parent a1967a046a
commit aa2f14a69c
  1. 45
      src/api/goods/index.js
  2. 103
      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. 76
      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,

@ -12,13 +12,7 @@
<a-input v-decorator="['goodsNo']" class="goodsWidth" placeholder="请输入商品编码" /> <a-input v-decorator="['goodsNo']" class="goodsWidth" placeholder="请输入商品编码" />
</a-form-item> </a-form-item>
<a-form-item label="商品分类"> <a-form-item label="商品分类">
<a-tree-select <a-tree-select class="goodsWidth" :treeData="categoryListTree" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" allowClear v-decorator="['categoryId', { initialValue: 0 }]"></a-tree-select>
class="goodsWidth"
:treeData="categoryListTree"
:dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }"
allowClear
v-decorator="['categoryId', { initialValue: 0 }]"
></a-tree-select>
</a-form-item> </a-form-item>
<a-form-item label="规格类型"> <a-form-item label="规格类型">
<a-select @change="onchangeSpecs" placeholder="请选择"> <a-select @change="onchangeSpecs" placeholder="请选择">
@ -65,6 +59,14 @@
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-row> </a-row>
<a-modal v-model:visible="batchVisible" width="300px" :title="setupIndex==1?'设置是否大牌正品':setupIndex==2?'设置是否新品首发':setupIndex==3?'设置是否店内':'设置所属分类排行'" @ok="handleUpdateSetup(selectedRowKeys,setupIndex!=4?setupValue:paihang,setupIndex)">
<a-select v-if="setupIndex!=4" v-model="setupValue" style="width: 250px;margin:10px 0" placeholder="请选择">
<a-select-option :value="item.val" v-for="item in isYesNo" :key="item.val">
{{ item.name }}
</a-select-option>
</a-select>
<a-input v-model="paihang" v-else placeholder="请输入所属分类排行值" style="width: 250px;margin:10px 0" />
</a-modal>
<!-- 操作板块 --> <!-- 操作板块 -->
<div class="row-item-tab clearfix"> <div class="row-item-tab clearfix">
<div class="tab-list fl-l"> <div class="tab-list fl-l">
@ -78,15 +80,14 @@
</a-radio-group> </a-radio-group>
</div> </div>
<a-button v-if="$auth('/goods/create') && (storeVersion === 0 || (storeVersion === 1 && isSuper === 0))" class="fl-l" type="primary" icon="plus" @click="handleCreate()">创建商品</a-button> <a-button v-if="$auth('/goods/create') && (storeVersion === 0 || (storeVersion === 1 && isSuper === 0))" class="fl-l" type="primary" icon="plus" @click="handleCreate()">创建商品</a-button>
<a-button <a-button v-if="$module('goods-import') && $auth('/goods/import/batch') && (storeVersion === 0 || (storeVersion === 1 && isSuper === 0))" class="fl-l" icon="arrow-up" @click="handleImport()">批量导入</a-button>
v-if="$module('goods-import') && $auth('/goods/import/batch') && (storeVersion === 0 || (storeVersion === 1 && isSuper === 0))"
class="fl-l"
icon="arrow-up"
@click="handleImport()"
>批量导入</a-button>
<a-button style="background-color: #501212; color: #fff; border: none" @click="handleExport(selectedRowKeys)">导出</a-button> <a-button style="background-color: #501212; color: #fff; border: none" @click="handleExport(selectedRowKeys)">导出</a-button>
<a-button v-if="storeVersion === 0 || (storeVersion === 1 && isSuper === 0)" class="fl-l" style="background-color: #f0baae; border: none" type="primary" @click="handleModify()">批量修改</a-button> <a-button v-if="storeVersion === 0 || (storeVersion === 1 && isSuper === 0)" class="fl-l" style="background-color: #f0baae; border: none" type="primary" @click="handleModify()">批量修改</a-button>
<div v-if="selectedRowKeys.length" class="button-group"> <!-- <a-button style="background-color: #9E7AFF; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(1)">设置大牌</a-button>
<a-button style="background-color: #FB322A; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(2)">设置新品</a-button>
<a-button style="background-color: #1184D2; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(3)">设置店内</a-button>
<a-button style="background-color: #EEA507; color: #fff; border: none" v-if="selectedRowKeys.length" @click="handleSetup(4)">设置排行榜</a-button> -->
<div v-if="selectedRowKeys.length" class="button-group" style="margin-top:15px">
<a-button-group class="ml-10"> <a-button-group class="ml-10">
<a-button v-action:status icon="arrow-up" @click="handleUpdateStatus(selectedRowKeys, true)">上架</a-button> <a-button v-action:status icon="arrow-up" @click="handleUpdateStatus(selectedRowKeys, true)">上架</a-button>
<a-button v-action:status icon="arrow-down" @click="handleUpdateStatus(selectedRowKeys, false)">下架</a-button> <a-button v-action:status icon="arrow-down" @click="handleUpdateStatus(selectedRowKeys, false)">下架</a-button>
@ -97,16 +98,7 @@
</div> </div>
</div> </div>
</div> </div>
<s-table <s-table ref="table" rowKey="goods_id" :loading="isLoading" :columns="columns" :data="loadData" :rowSelection="rowSelection" :pagination="pagination" :scroll="{ x: 1450 }">
ref="table"
rowKey="goods_id"
:loading="isLoading"
:columns="columns"
:data="loadData"
:rowSelection="rowSelection"
:pagination="pagination"
:scroll="{ x: 1450 }"
>
<!-- 商品图片 --> <!-- 商品图片 -->
<span slot="goods_image" slot-scope="text"> <span slot="goods_image" slot-scope="text">
<a title="点击查看原图" :href="text" target="_blank"> <a title="点击查看原图" :href="text" target="_blank">
@ -122,27 +114,17 @@
</span> </span>
<!-- 商品状态 --> <!-- 商品状态 -->
<span slot="status" slot-scope="text, item"> <span slot="status" slot-scope="text, item">
<a-tag <a-tag class="cur-p" :color="text == 10 ? 'green' : 'red'" @click="handleUpdateStatus([item.goods_id], text != 10)">{{ text == 10 ? '上架' : '下架' }}</a-tag>
class="cur-p"
:color="text == 10 ? 'green' : 'red'"
@click="handleUpdateStatus([item.goods_id], text != 10)"
>{{ text == 10 ? '上架' : '下架' }}</a-tag>
</span> </span>
<!-- 京东下架 --> <!-- 京东下架 -->
<span slot="is_jd_remove" slot-scope="text"> <span slot="is_jd_remove" slot-scope="text">
<p <p style="width: 40px;text-align: center;" :style="{ color: text == 1 ? 'red' : 'green'}">
style="width: 40px;text-align: center;"
:style="{ color: text == 1 ? 'red' : 'green'}"
>
{{ text == 1 ? '是' : '否' }} {{ text == 1 ? '是' : '否' }}
</p> </p>
</span> </span>
<!-- 商品池 --> <!-- 商品池 -->
<span slot="is_pool" slot-scope="text"> <span slot="is_pool" slot-scope="text">
<p <p style="width: 40px" :style="{ color: text == 0 ? 'red' : text == 1 ? 'green' : 'gray' }">
style="width: 40px"
:style="{ color: text == 0 ? 'red' : text == 1 ? 'green' : 'gray' }"
>
{{ text == 0 ? '待处理' : text == 1 ? '已入池' : '未入池' }} {{ text == 0 ? '待处理' : text == 1 ? '已入池' : '未入池' }}
</p> </p>
</span> </span>
@ -154,10 +136,7 @@
>编辑</router-link >编辑</router-link
> --> > -->
<a @click="handleEdit(item.goods_id)">编辑</a> <a @click="handleEdit(item.goods_id)">编辑</a>
<router-link <router-link v-if="$module('goods-copy') && $auth('/goods/copy') && (storeVersion === 0 || (storeVersion === 1 && isSuper === 0))" :to="{ path: '/goods/copy', query: { goodsId: item.goods_id } }">复制</router-link>
v-if="$module('goods-copy') && $auth('/goods/copy') && (storeVersion === 0 || (storeVersion === 1 && isSuper === 0))"
:to="{ path: '/goods/copy', query: { goodsId: item.goods_id } }"
>复制</router-link>
<!-- <a v-if="storeVersion === 0 || (storeVersion === 1 && isSuper === 0)" v-action:delete @click="handleDelete([item.goods_id])">删除</a> --> <!-- <a v-if="storeVersion === 0 || (storeVersion === 1 && isSuper === 0)" v-action:delete @click="handleDelete([item.goods_id])">删除</a> -->
</div> </div>
</s-table> </s-table>
@ -304,8 +283,11 @@ export default {
spec_type: '', spec_type: '',
channel: '', channel: '',
merchant_id: '', merchant_id: '',
is_jd_remove:'' is_jd_remove: ''
}, },
paihang: '',
setupIndex: 0,
setupValue: 1,
// //
isLoading: false, isLoading: false,
// //
@ -343,7 +325,8 @@ export default {
{ name: '否', val: 0 }, { name: '否', val: 0 },
], ],
checkList: [], checkList: [],
merchantList: [] merchantList: [],
batchVisible: false
} }
}, },
created() { created() {
@ -371,13 +354,45 @@ export default {
} }
}, },
methods: { methods: {
getGoodsJingDong(val){ getGoodsJingDong(val) {
this.queryParam.is_jd_remove = val this.queryParam.is_jd_remove = val
}, },
// //
handleModify() { handleModify() {
this.$router.push('/goods/modify') this.$router.push('/goods/modify')
}, },
handleSetup(type) {
this.paihang = '';
this.setupValue = 1;
this.setupIndex = type
this.batchVisible = true
},
//
handleUpdateSetup(goodsIds, val, type) {
this.isLoading = true
let url = ''
if (type == 1) {
url = GoodsApi.setBrand({ goodsIds, is_brand: val })
}
if (type == 2) {
url = GoodsApi.setNew({ goodsIds, is_new: val })
}
if (type == 3) {
url = GoodsApi.setInstore({ goodsIds, is_in_store: val })
}
if (type == 4) {
url = GoodsApi.setRank({ goodsIds, paihang: val })
}
url.then((result) => {
this.batchVisible = false
this.$message.success(result.message, 1.5)
this.handleRefresh()
})
.finally((result) => {
this.$message.warning(result.message, 1.5)
this.isLoading = false
})
},
// //
handleExport(goodsIds) { handleExport(goodsIds) {
const formData = this.searchForm.getFieldsValue() const formData = this.searchForm.getFieldsValue()

@ -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,25 +1,12 @@
<template> <template>
<a-modal <a-modal title="编辑服务" :width="920" :visible="visible" :confirmLoading="confirmLoading" :maskClosable="false" :destroyOnClose="true" @ok="handleSubmit" @cancel="handleCancel">
title="编辑服务"
:width="920"
: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">
<a-input <a-input v-decorator="['server_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]" />
v-decorator="['server_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"
/>
</a-form-item> </a-form-item>
<a-form-item label="服务分类" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="服务分类" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select <a-select v-decorator="['category_id', { initialValue: 0, rules: [{ required: true, message: '请选择分类' }] }]">
v-decorator="['category_id', { initialValue: 0, rules: [{ required: true, message: '请选择分类' }] }]"
>
<a-select-option :value="0">选择分类</a-select-option> <a-select-option :value="0">选择分类</a-select-option>
<a-select-option v-for="(item, index) in categoryList" :key="index" :value="item.category_id">{{ <a-select-option v-for="(item, index) in categoryList" :key="index" :value="item.category_id">{{
item.name item.name
@ -27,46 +14,26 @@
</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"
:precision="2"
v-decorator="['server_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="0.01" :precision="2" v-decorator="['line_price', { initialValue: 1, rules: [{ required: true, message: '请输入划线价' }] }]" />
: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="10"
:step="10"
v-decorator="['comment_num', { initialValue: 10, 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">
<a-input-number <a-input-number :min="90" :step="1" :max="100" v-decorator="['comment_rate', { initialValue: 90, rules: [{ required: true, message: '请输入好评率' }] }]" />
: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 <a-input-number :min="100" v-decorator="['sold', { initialValue: 100, rules: [{ required: true, message: '请输入销量价格' }] }]" />
:min="100"
v-decorator="['sold', { initialValue: 100, 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">
<SelectImage :defaultList="record.image ? [record.image] : []" v-decorator="['image_id']" /> <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-radio-group v-decorator="['status', { initialValue: 1, rules: [{ required: true }] }]">
@ -75,10 +42,7 @@
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="数字越小越靠前"> <a-form-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="数字越小越靠前">
<a-input-number <a-input-number :min="0" v-decorator="['sort', { initialValue: 100, rules: [{ required: true, message: '请输入至少1个数字' }] }]" />
:min="0"
v-decorator="['sort', { initialValue: 100, rules: [{ required: true, message: '请输入至少1个数字' }] }]"
/>
</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: '服务详情不能为空' }] }]" /> <Ueditor v-decorator="['content', { rules: [{ required: true, message: '服务详情不能为空' }] }]" />
@ -99,7 +63,7 @@ export default {
props: { props: {
// //
}, },
data () { data() {
return { return {
categoryList: [], categoryList: [],
// //
@ -124,7 +88,13 @@ export default {
}, },
methods: { methods: {
// //
edit (record) { edit(record) {
let list = []
list.push({
preview_url: record.server_image,
file_id: 9999
})
record.server_image = list
this.getCategoryList() this.getCategoryList()
// //
this.visible = true this.visible = true
@ -134,7 +104,7 @@ export default {
this.setFieldsValue() this.setFieldsValue()
}, },
// //
getCategoryList () { getCategoryList() {
this.isLoading = true this.isLoading = true
Api.categoryList() Api.categoryList()
.then((result) => { .then((result) => {
@ -143,7 +113,7 @@ export default {
.finally(() => (this.isLoading = false)) .finally(() => (this.isLoading = false))
}, },
// //
setFieldsValue () { setFieldsValue() {
const { const {
form: { setFieldsValue } form: { setFieldsValue }
} = this } = this
@ -167,7 +137,7 @@ export default {
}) })
}, },
// //
handleSubmit (e) { handleSubmit(e) {
e.preventDefault() e.preventDefault()
// //
const { const {
@ -182,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.editServer({ serverId: this.record['server_id'], form: values }) Api.editServer({ serverId: this.record['server_id'], form: values })
.then((result) => { .then((result) => {

Loading…
Cancel
Save