feature/0423
陈伟 11 months ago
parent f1e4633c66
commit a765e98b06
  1. 6
      src/common/model/goods/MultiSpec.js
  2. 249
      src/components/Modal/ActiveModal/ActiveModal.vue
  3. 2
      src/components/Modal/ActiveModal/index.js
  4. 2
      src/components/Modal/index.js
  5. 184
      src/components/SelectActive/SelectActive.vue
  6. 2
      src/components/SelectActive/index.js
  7. 2
      src/components/index.js
  8. 12
      src/views/content/banner/modules/AddForm.vue
  9. 15
      src/views/content/banner/modules/EditForm.vue
  10. 6
      src/views/goods/Copy.vue
  11. 2
      src/views/goods/Create.vue
  12. 4
      src/views/goods/Index.vue
  13. 4
      src/views/goods/Update.vue
  14. 10
      src/views/goods/modules/MultiSpec.vue
  15. 6
      src/views/server/Index.vue
  16. 4
      src/views/server/modules/Add.vue
  17. 6
      src/views/server/modules/Edit.vue

@ -17,10 +17,10 @@ const defaultColumns = [
scopedSlots: { customRender: 'goods_price' } scopedSlots: { customRender: 'goods_price' }
}, },
{ {
title: '划线价格', title: '成本价',
dataIndex: 'line_price', dataIndex: 'cost_price',
width: 120, width: 120,
scopedSlots: { customRender: 'line_price' } scopedSlots: { customRender: 'cost_price' }
}, },
{ {
title: '库存数量', title: '库存数量',

@ -0,0 +1,249 @@
<template>
<a-modal
class="noborder"
:title="title"
:width="1020"
:visible="visible"
:isLoading="isLoading"
:maskClosable="false"
@ok="handleSubmit"
@cancel="handleCancel"
>
<s-table
ref="table"
:scroll="{ y: '420px', scrollToFirstRowOnChange: true }"
:rowKey="fieldName"
:loading="isLoading"
:columns="columns"
:data="loadData"
:rowSelection="rowSelection"
:pageSize="15"
>
<!-- 活动入口图片 -->
<span slot="index_image_url" slot-scope="text">
<a title="点击查看原图" :href="text" target="_blank">
<img height="50" :src="text" alt="活动入口图片" />
</a>
</span>
<!-- Banner图 -->
<span slot="theme_image_url" slot-scope="text">
<a title="点击查看原图" :href="text" target="_blank">
<img height="50" :src="text" alt="活动主题图" />
</a>
</span>
<!-- 状态 -->
<span slot="status" slot-scope="text">
<a-tag :color="text == 1 ? 'green' : ''">{{ text ? '开启' : '关闭' }}</a-tag>
</span>
</s-table>
</a-modal>
</template>
<script>
import PropTypes from 'ant-design-vue/es/_util/vue-types'
import cloneDeep from 'lodash.clonedeep'
import { filterModules } from '@/core/app'
import * as Api from '@/api/market/active'
import { STable } from '@/components/Table'
// table
const columns = filterModules([
{
title: '活动ID',
dataIndex: 'id'
},
{
title: '活动名称',
dataIndex: 'name'
},
{
title: '活动标题',
dataIndex: 'title'
},
{
title: '活动入口图片',
dataIndex: 'index_image_url',
scopedSlots: { customRender: 'index_image_url' }
},
{
title: '活动主题标题',
dataIndex: 'theme_title'
},
{
title: '活动主题图',
dataIndex: 'theme_image_url',
scopedSlots: { customRender: 'theme_image_url' }
},
{
title: '状态',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
}
])
export default {
name: 'ActiveModal',
props: {
// , false
multiple: PropTypes.bool.def(false),
// , multiple
maxNum: PropTypes.integer.def(100),
//
defaultList: PropTypes.array.def([])
},
components: {
STable
},
data () {
return {
//
title: '选择活动',
// modal()
visible: false,
// loading
isLoading: false,
//
searchForm: this.$form.createForm(this),
//
queryParam: {},
// table
columns,
// Promise
loadData: param => {
return Api.list({ ...param, ...this.queryParam })
.then(response => response.data.list)
},
// ID
fieldName: 'id',
//
selectedRowKeys: [],
//
selectedItems: [],
//
gradeList: []
}
},
computed: {
rowSelection () {
return {
selectedRowKeys: this.selectedRowKeys,
onChange: this.onSelectChange,
type: !this.multiple ? 'radio' : 'checkbox'
}
}
},
created () {
},
methods: {
//
handle () {
//
this.visible = true
this.$nextTick(() => {
//
// this.handleRefresh(true)
//
this.setDefaultValue()
})
},
//
setDefaultValue () {
const { fieldName, defaultList } = this
if (defaultList.length) {
this.selectedItems = cloneDeep(defaultList)
this.selectedRowKeys = defaultList.map(item => item[fieldName])
}
},
//
onSelectChange (selectedRowKeys, newSelectedItems) {
const { selectedItems } = this
this.selectedRowKeys = selectedRowKeys
this.selectedItems = this.createSelectedItems(selectedRowKeys, selectedItems, newSelectedItems)
},
/**
* 生成已选中的元素列表
* @param array selectedRowKeys 当前已选中的ID集
* @param array oldSelectedItems 已选择的列表记录 (change前)
* @param array newSelectedItems 已选择的列表记录 (change后)
*/
createSelectedItems (selectedRowKeys, oldSelectedItems, newSelectedItems) {
const { fieldName } = this
const selectedItems = []
oldSelectedItems.forEach(item => {
if (selectedRowKeys.includes(item[fieldName])) {
selectedItems.push(item)
}
})
const oldSelectedKeys = oldSelectedItems.map(item => item[fieldName])
newSelectedItems.forEach(item => {
if (!oldSelectedKeys.includes(item[fieldName]) && selectedRowKeys.includes(item[fieldName])) {
selectedItems.push(item)
}
})
return selectedItems
},
/**
* 刷新列表
* @param Boolean bool 强制刷新到第一页
*/
handleRefresh (bool = false) {
this.$refs.table.refresh(true)
},
//
handleSearch () {
this.searchForm.validateFields((error, values) => {
if (!error) {
this.queryParam = { ...this.queryParam, ...values }
this.handleRefresh(true)
}
})
},
//
handleCancel () {
this.visible = false
this.queryParam = {}
this.searchForm.resetFields()
this.selectedRowKeys = []
this.selectedItems = []
},
//
handleSubmit (e) {
e.preventDefault()
//
this.$emit('handleSubmit', {
selectedItems: this.selectedItems,
selectedRowKeys: this.selectedRowKeys
})
//
this.handleCancel()
}
}
}
</script>
<style lang="less" scoped>
.ant-modal-root {
background: #ccc;
/deep/.ant-modal-body {
padding-bottom: 8px;
}
/deep/.ant-modal-footer {
padding-top: 0;
}
}
//
.search-form {
/deep/.ant-form-item-control-wrapper {
min-width: 180px;
}
}
</style>

@ -0,0 +1,2 @@
import ActiveModal from './ActiveModal'
export default ActiveModal

@ -9,6 +9,7 @@ import ShopModal from './ShopModal'
import CouponModal from './CouponModal' import CouponModal from './CouponModal'
import UserModal from './UserModal' import UserModal from './UserModal'
import ServerModal from './ServerModal' import ServerModal from './ServerModal'
import ActiveModal from './ActiveModal'
export { export {
GoodsModal, GoodsModal,
@ -22,4 +23,5 @@ export {
CouponModal, CouponModal,
UserModal, UserModal,
ServerModal, ServerModal,
ActiveModal
} }

@ -0,0 +1,184 @@
<template>
<div>
<a-button @click="handleSelectActive">选择活动</a-button>
<a-table
v-show="selectedItems.length"
class="table-activeList"
rowKey="id"
:columns="columns"
:dataSource="selectedItems"
:pagination="false"
>
<!-- 活动入口图片 -->
<span slot="index_image_url" slot-scope="text">
<a title="点击查看原图" :href="text" target="_blank">
<img height="50" :src="text" alt="活动入口图片" />
</a>
</span>
<!-- Banner图 -->
<span slot="theme_image_url" slot-scope="text">
<a title="点击查看原图" :href="text" target="_blank">
<img height="50" :src="text" alt="活动主题图" />
</a>
</span>
<!-- 状态 -->
<span slot="status" slot-scope="text">
<a-tag :color="text == 1 ? 'green' : ''">{{ text ? '开启' : '关闭' }}</a-tag>
</span>
<!-- 操作项 -->
<span slot="action" slot-scope="text, item, index">
<a v-action:delete @click="handleDeleteItem(index)">删除</a>
</span>
</a-table>
<ActiveModal
ref="ActiveModal"
:multiple="multiple"
:maxNum="maxNum"
:defaultList="selectedItems"
@handleSubmit="handleSelectActiveSubmit"
/>
</div>
</template>
<script>
import PropTypes from 'ant-design-vue/es/_util/vue-types'
import cloneDeep from 'lodash.clonedeep'
import { filterModules } from '@/core/app'
import { ActiveModal } from '@/components/Modal'
// table
const columns = filterModules([
{
title: '活动ID',
dataIndex: 'id'
},
{
title: '活动名称',
dataIndex: 'name'
},
{
title: '活动标题',
dataIndex: 'title'
},
// {
// title: '',
// dataIndex: 'index_image_url',
// scopedSlots: { customRender: 'index_image_url' }
// },
{
title: '活动主题标题',
dataIndex: 'theme_title'
},
// {
// title: '',
// dataIndex: 'theme_image_url',
// scopedSlots: { customRender: 'theme_image_url' }
// },
{
title: '状态',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '操作',
width: '180px',
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
}
])
//
export default {
name: 'SelectActive',
components: {
ActiveModal
},
model: {
prop: 'value',
event: 'change'
},
props: {
// , false
multiple: PropTypes.bool.def(false),
// , multiple
maxNum: PropTypes.integer.def(100),
//
defaultList: PropTypes.array.def([])
},
data () {
return {
// table
columns,
//
selectedItems: [],
// ID
selectedActiveIds: []
}
},
watch: {
//
defaultList: {
//
immediate: true,
handler (val) {
const { selectedItems } = this
if (val.length && !selectedItems.length) {
this.onUpdate(cloneDeep(val))
}
}
}
},
created () {
},
methods: {
//
onUpdate (selectedItems) {
if (this.multiple || !selectedItems.length) {
//
this.selectedItems = selectedItems
this.selectedActiveIds = selectedItems.map(item => item.id)
} else {
//
const single = selectedItems[selectedItems.length - 1]
this.selectedItems = [single]
this.selectedActiveIds = [single.id]
}
this.onChange()
},
//
handleSelectActive () {
this.$refs.ActiveModal.handle()
},
// modal
handleSelectActiveSubmit (result) {
const { selectedItems } = result
this.onUpdate(cloneDeep(selectedItems))
},
//
handleDeleteItem (index) {
const { selectedItems } = this
selectedItems.splice(index, 1)
this.onUpdate(selectedItems)
},
// change
onChange () {
const { multiple, selectedActiveIds } = this
const sActiveIds = multiple ? selectedActiveIds : (selectedActiveIds.length ? selectedActiveIds[0] : undefined)
return this.$emit('change', sActiveIds)
}
}
}
</script>
<style lang="less" scoped>
.table-activeList {
margin-top: 10px;
min-width: 620px;
}
</style>

@ -0,0 +1,2 @@
import SelectActive from './SelectActive'
export default SelectActive

@ -12,6 +12,7 @@ import SelectSharpGoods from '@/components/SelectSharpGoods'
import SelectRegion from '@/components/SelectRegion' import SelectRegion from '@/components/SelectRegion'
import SelectCoupon from '@/components/SelectCoupon' import SelectCoupon from '@/components/SelectCoupon'
import SelectUser from '@/components/SelectUser' import SelectUser from '@/components/SelectUser'
import SelectActive from '@/components/SelectActive'
import Getpoint from '@/components/Getpoint' import Getpoint from '@/components/Getpoint'
import Ueditor from '@/components/Ueditor' import Ueditor from '@/components/Ueditor'
@ -36,4 +37,5 @@ export {
InputNumberGroup, InputNumberGroup,
ContentHeader, ContentHeader,
SelectServer, SelectServer,
SelectActive
} }

@ -20,7 +20,8 @@
/> />
</a-form-item> </a-form-item>
<a-form-item label="跳转地址" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="跳转地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['redirect_url', { rules: [{ required: false, message: '请输入跳转地址' }] }]" placeholder="请输入跳转地址" /> <SelectActive style="width: 100%;overflow: auto;" v-decorator="['redirect_url', { rules: [{ required: false, message: '请选择跳转地址' }] }]"></SelectActive>
<!-- <a-input v-decorator="['redirect_url', { rules: [{ required: false, message: '请输入跳转地址' }] }]" placeholder="请输入跳转地址" /> -->
</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-radio-group v-decorator="['status', { initialValue: 10, rules: [{ required: true }] }]"> <a-radio-group v-decorator="['status', { initialValue: 10, rules: [{ required: true }] }]">
@ -42,20 +43,21 @@
<script> <script>
import pick from 'lodash.pick' import pick from 'lodash.pick'
import * as Api from '@/api/content/banner' import * as Api from '@/api/content/banner'
import { SelectImage } from '@/components' import { SelectImage, SelectActive } from '@/components'
export default { export default {
components: { components: {
SelectImage SelectImage,
SelectActive
}, },
data () { data () {
return { return {
// //
title: '新增轮播图', title: '新增轮播图',
// //
labelCol: { span: 7 }, labelCol: { span: 3 },
// //
wrapperCol: { span: 13 }, wrapperCol: { span: 19 },
// modal() // modal()
visible: false, visible: false,
// modal() loading // modal() loading

@ -21,7 +21,11 @@
/> />
</a-form-item> </a-form-item>
<a-form-item label="跳转地址" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="跳转地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['redirect_url', { rules: [{ required: false, message: '请输入跳转地址' }] }]" placeholder="请输入跳转地址" /> <SelectActive
style="width: 100%;overflow: auto;"
:defaultList="record.activeInfo ? [record.activeInfo] : []"
v-decorator="['redirect_url', { rules: [{ required: false, message: '请选择跳转地址' }] }]"></SelectActive>
<!-- <a-input v-decorator="['redirect_url', { rules: [{ required: false, message: '请输入跳转地址' }] }]" placeholder="请输入跳转地址" /> -->
</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-radio-group v-decorator="['status', { initialValue: 10, rules: [{ required: true }] }]"> <a-radio-group v-decorator="['status', { initialValue: 10, rules: [{ required: true }] }]">
@ -43,20 +47,21 @@
<script> <script>
import pick from 'lodash.pick' import pick from 'lodash.pick'
import * as Api from '@/api/content/banner' import * as Api from '@/api/content/banner'
import { SelectImage } from '@/components' import { SelectImage, SelectActive } from '@/components'
export default { export default {
components: { components: {
SelectImage SelectImage,
SelectActive
}, },
data () { data () {
return { return {
// //
title: '编辑轮播图', title: '编辑轮播图',
// //
labelCol: { span: 7 }, labelCol: { span: 3 },
// //
wrapperCol: { span: 13 }, wrapperCol: { span: 19 },
// modal() // modal()
visible: false, visible: false,
// modal() loading // modal() loading

@ -154,12 +154,12 @@
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>
<a-form-item <a-form-item
label="划线价" label="成本价"
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
extra="划线价仅用于商品页展示" extra="成本价仅用于商品页展示"
> >
<a-input-number :min="0" :precision="2" v-decorator="['line_price']" /> <a-input-number :min="0" :precision="2" v-decorator="['cost_price']" />
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>
<a-form-item <a-form-item

@ -189,7 +189,7 @@
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
extra="成本价仅用于商品页展示" extra="成本价仅用于商品页展示"
> >
<a-input-number :min="0" :precision="2" v-decorator="['cost_price_min']" /> <a-input-number :min="0" :precision="2" v-decorator="['cost_price']" />
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>
<a-form-item <a-form-item

@ -139,8 +139,8 @@ const columns = [
}, },
{ {
title: '成本价', title: '成本价',
dataIndex: 'cost_price_min', dataIndex: 'cost_price',
scopedSlots: { customRender: 'cost_price_min' } scopedSlots: { customRender: 'cost_price' }
}, },
{ {
title: '总销量', title: '总销量',

@ -199,7 +199,7 @@
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
extra="成本价仅用于商品页展示" extra="成本价仅用于商品页展示"
> >
<a-input-number :min="0" :precision="2" v-decorator="['cost_price_min']" /> <a-input-number :min="0" :precision="2" v-decorator="['cost_price']" />
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>
<a-form-item <a-form-item
@ -611,7 +611,7 @@ export default {
// //
const tabsFieldsMap = [ const tabsFieldsMap = [
['goods_type', 'goods_name', 'categorys', 'imagesIds', 'delivery_id', 'is_ind_delivery_type', 'delivery_type','is_brand', 'is_in_store'], ['goods_type', 'goods_name', 'categorys', 'imagesIds', 'delivery_id', 'is_ind_delivery_type', 'delivery_type','is_brand', 'is_in_store'],
['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single', 'cost_price_min'], ['spec_type', 'goods_price', 'is_restrict', 'restrict_total', 'restrict_single', 'cost_price'],
['content'], ['content'],
['alone_grade_equity', 'first_money', 'second_money', 'third_money'] ['alone_grade_equity', 'first_money', 'second_money', 'third_money']
] ]

@ -71,8 +71,8 @@
:precision="2" :precision="2"
/> />
<a-input-number <a-input-number
v-model="multiSpecData.skuBatchForm.line_price" v-model="multiSpecData.skuBatchForm.cost_price"
placeholder="划线价格" placeholder="成本价"
:min="0" :min="0"
:precision="2" :precision="2"
/> />
@ -112,9 +112,9 @@
<template slot="goods_price" slot-scope="text, item"> <template slot="goods_price" slot-scope="text, item">
<a-input-number v-model="item.goods_price" size="small" :min="0.01" :precision="2" /> <a-input-number v-model="item.goods_price" size="small" :min="0.01" :precision="2" />
</template> </template>
<!-- 划线价格 --> <!-- 成本价格 -->
<template slot="line_price" slot-scope="text, item"> <template slot="cost_price" slot-scope="text, item">
<a-input-number v-model="item.line_price" size="small" :min="0" :precision="2" /> <a-input-number v-model="item.cost_price" size="small" :min="0" :precision="2" />
</template> </template>
<!-- 库存数量 --> <!-- 库存数量 -->
<template slot="stock_num" slot-scope="text, item"> <template slot="stock_num" slot-scope="text, item">

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

@ -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="['line_price', { initialValue: 1, rules: [{ required: true, message: '请输入划线价格' }] }]" v-decorator="['cost_price', { initialValue: 1, rules: [{ required: true, message: '请输入成本价' }] }]"
/> />
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>

@ -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="['line_price', { initialValue: 1, rules: [{ required: true, message: '请输入划线价格' }] }]" v-decorator="['cost_price', { initialValue: 1, rules: [{ required: true, message: '请输入成本价' }] }]"
/> />
<span class="ml-10"></span> <span class="ml-10"></span>
</a-form-item> </a-form-item>
@ -156,7 +156,7 @@ export default {
'category_id', 'category_id',
'status', 'status',
'server_price', 'server_price',
'line_price', 'cost_price',
'sort', 'sort',
'content', 'content',
'comment_rate', 'comment_rate',

Loading…
Cancel
Save