Commit a98c8277 by wangql
2 parents bac2fab6 9e023b16
import request from './request' import request from './request'
import RequestMethods from './request.methods'
const path = 'dj.api.' const path = 'dj.api.'
...@@ -18,3 +19,9 @@ export function serviceGetMerchantList(data) { ...@@ -18,3 +19,9 @@ export function serviceGetMerchantList(data) {
data.method = `${path}merchant.page` data.method = `${path}merchant.page`
return request(data) return request(data)
} }
// 新增商户门店
export function addServiceMerchant(data) {
data.method = `${path}servicemerchantref.add`
return request(data, RequestMethods.POST)
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-26 18:02:55 * @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2020-11-11 14:16:27 * @Last Modified time: 2020-11-11 17:42:10
*/ */
import request from './request' import request from './request'
...@@ -13,7 +13,7 @@ export const BASE_DATA_URL = 'fims.configuration.from.conftype' ...@@ -13,7 +13,7 @@ export const BASE_DATA_URL = 'fims.configuration.from.conftype'
const path = 'dj.api.' const path = 'dj.api.'
// 获取商品分类列表 // 获取商品分类列表
export function getGoodsType(data) { export function getProductType(data) {
data.method = `${path}goods.type.list` data.method = `${path}goods.type.list`
return request(data) return request(data)
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 19:06:01 * @Date: 2019-09-01 19:06:01
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2020-11-11 14:29:52 * @Last Modified time: 2020-11-11 17:38:18
*/ */
// import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account' // import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
...@@ -22,7 +22,8 @@ export const TYPE_NAME = 'confType' ...@@ -22,7 +22,8 @@ export const TYPE_NAME = 'confType'
* 前端基础数据管理对应的接口名称的key * 前端基础数据管理对应的接口名称的key
*/ */
export const BaseData = { export const BaseData = {
CHANNELTYPE: 'channelType' channelType: 'channelType',
productType: 'productType'
} }
/** /**
* 注册类型 * 注册类型
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
@closeDialog="handleRelateStoreClose" @closeDialog="handleRelateStoreClose"
class="relateStore" class="relateStore"
> >
<slot></slot>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-table <el-table
...@@ -24,7 +25,11 @@ ...@@ -24,7 +25,11 @@
type="selection" type="selection"
width="55" width="55"
align="center" align="center"
:selectable="selectable"
></el-table-column> ></el-table-column>
<!-- <el-table-column>
<template slot-scope="scope">{{scope.row.beServed}}</template>
</el-table-column> -->
<el-table-column <el-table-column
prop="merchantName" prop="merchantName"
label="门店名称" label="门店名称"
...@@ -85,6 +90,10 @@ export default { ...@@ -85,6 +90,10 @@ export default {
storeSelected: { storeSelected: {
type: Array, type: Array,
default: () => [] default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
} }
}, },
...@@ -94,6 +103,9 @@ export default { ...@@ -94,6 +103,9 @@ export default {
}, },
methods: { methods: {
selectable(row, index) {
return row.hasOwnProperty('beServed') ? !row.beServed : true
},
recoverySelection() { recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId) var exitIds = this.selectedData.map(item => item.merchantId)
this.selectingData.forEach(item => { this.selectingData.forEach(item => {
...@@ -102,9 +114,11 @@ export default { ...@@ -102,9 +114,11 @@ export default {
}, },
getSelectingList() { getSelectingList() {
this.storeApi({ this.storeApi({
...this.storeSearchForm,
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize pageSize: this.pageSize
}).then(res => { }).then(res => {
console.log(res)
this.selectingData = res.list this.selectingData = res.list
this.total = res.total this.total = res.total
this.$nextTick(() => { this.$nextTick(() => {
......
...@@ -2,23 +2,27 @@ ...@@ -2,23 +2,27 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 17:56:57 * @Date: 2019-09-01 17:56:57
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2020-11-11 14:28:37 * @Last Modified time: 2020-11-11 17:42:11
*/ */
import { import {
getChannelType getChannelType,
getProductType
} from '@/api/sys.base' } from '@/api/sys.base'
import { import {
BaseData BaseData
} from '@/common/constants' } from '@/common/constants'
const map = { const map = {
[BaseData.CHANNELTYPE]: getChannelType [BaseData.channelType]: getChannelType,
[BaseData.productType]: getProductType
} }
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
// 渠道类型 // 渠道类型
channelType: [] channelType: [],
// 产品分类
productType: []
}, },
actions: { actions: {
/** /**
...@@ -33,9 +37,11 @@ export default { ...@@ -33,9 +37,11 @@ export default {
}) { }) {
return new Promise(async resolve => { return new Promise(async resolve => {
Promise.all([ Promise.all([
getChannelType({}) getChannelType({}),
]).then(async([channelType]) => { getProductType({})
]).then(async([channelType, productType]) => {
state.channelType = channelType state.channelType = channelType
state.productType = productType
await dispatch('save2db', { await dispatch('save2db', {
name: '', name: '',
value: state value: state
...@@ -51,6 +57,7 @@ export default { ...@@ -51,6 +57,7 @@ export default {
}) { }) {
return new Promise(async resolve => { return new Promise(async resolve => {
state.channelType = [] state.channelType = []
state.productType = []
await dispatch('save2db', { await dispatch('save2db', {
name: '', name: '',
value: state value: state
...@@ -112,8 +119,8 @@ export default { ...@@ -112,8 +119,8 @@ export default {
if (state.channelType.length === 0) { if (state.channelType.length === 0) {
state = await dispatch('getFromdb', 'base') || await dispatch('init') state = await dispatch('getFromdb', 'base') || await dispatch('init')
} }
const { channelType } = state const { channelType, productType } = state
resolve({ channelType }) resolve({ channelType, productType })
}) })
}, },
/** /**
......
...@@ -107,7 +107,8 @@ ...@@ -107,7 +107,8 @@
<script> <script>
import { getList } from '@api/commodity' import { getList } from '@api/commodity'
import { getGoodsType } from '@api/sys.base.js' import { BaseData } from '@/common/constants.js'
import { mapActions } from 'vuex'
import _ from 'lodash' import _ from 'lodash'
import storeDetail from './storeDetail' import storeDetail from './storeDetail'
export default { export default {
...@@ -187,17 +188,18 @@ export default { ...@@ -187,17 +188,18 @@ export default {
}, },
mounted() { mounted() {
getGoodsType({}).then(res => { this.getBaseData()
// console.log(res)
this.baseData.goodsType = res
})
console.log(this.$route.params) console.log(this.$route.params)
var allOpt = { confId: '', confKey: '全部' } // var allOpt = { confId: '', confKey: '全部' }
this.baseData.goodsType.unshift(allOpt) // this.baseData.goodsType.unshift(allOpt)
this.baseData.brandList.unshift(allOpt) // this.baseData.brandList.unshift(allOpt)
}, },
methods: { methods: {
...mapActions('d2admin/base', ['get']),
async getBaseData() {
this.baseData.goodsType = await this.get(BaseData.productType)
},
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
console.log('搜索前操作--') console.log('搜索前操作--')
......
<!-- 产品编辑 --> <!-- 产品编辑 -->
<template> <template>
<div></div> <div class="edit-product">
<d2-form
ref="d2ProductForm"
:formItemWidth="formItemWidth"
:rules="rules"
:addOrEdit="addOrEdit"
:originData="editData"
:formList="editForm"
@handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose"
></d2-form>
</div>
</template> </template>
<script> <script>
import { mapActions } from 'vuex'
import { BaseData } from '@/common/constants.js'
export default { export default {
name: 'editProduct', name: 'editProduct',
data() { data() {
return { return {
show: false,
addOrEdit: 'add',
rules: {
goodsName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }],
goodsType: [{ required: true, message: '请选择分类', trigger: 'change' }]
},
editData: {
goodsName: '',
goodsType: '',
goodsTypeName: '',
sapCode: '',
brandMerchantCode: '',
brandMerchantName: '',
thumbUrl: '',
goodsImgList: [],
goodsDescList: []
},
editForm: [{
title: '产品基本信息',
formBlock: [{
name: 'goodsName',
label: '产品名称',
type: 'input'
}, {
name: 'goodsType',
label: '分类',
isRequired: true,
type: 'select',
tips: '选择产品分类',
isClear: false,
optionList: [],
optionId: 'goodsType',
optionLabel: 'goodsTypeName'
}, {
name: 'sapCode',
label: 'SAP编码',
type: 'input'
}, {
name: 'brandMerchantCode',
label: '品牌商',
isRequired: true,
type: 'select',
tips: '选择品牌商',
isClear: true,
optionList: [],
optionId: 'goodsType',
optionLabel: 'goodsTypeName'
}]
}],
baseData: {
productType: []
}
} }
}, },
components: {}, mounted() {
this.getBaseData()
computed: {}, },
mounted() {},
methods: {} methods: {
...mapActions({
get: 'd2admin/base/get'
}),
async getBaseData() {
const temp = await this.get(BaseData.productType)
this.baseData.productType = temp
this.editForm[0].formBlock[1].optionList = temp
console.log(this.baseData.productType)
}
}
} }
</script> </script>
......
...@@ -158,6 +158,7 @@ export default { ...@@ -158,6 +158,7 @@ export default {
}, },
handleAdd(form) { handleAdd(form) {
console.log(form) console.log(form)
this.$router.push({ name: 'editProduct' })
}, },
handleExport() { }, handleExport() { },
handleEdit(row) { handleEdit(row) {
......
<!-- 服务4S店 --> <!-- 服务4S店 -->
<template> <template>
<d2-container class="commodity"> <d2-container class="service-store">
<el-form <el-form
:inline="true" :inline="true"
v-model="searchForm" v-model="searchForm"
...@@ -40,17 +40,46 @@ ...@@ -40,17 +40,46 @@
</d2-table> </d2-table>
<relate-store-dialog <relate-store-dialog
v-if="relateStoreVisible" v-if="relateStoreVisible"
ref="relateStore"
:relateStoreVisible="relateStoreVisible" :relateStoreVisible="relateStoreVisible"
:storeApi="storeApi" :storeApi="storeApi"
:storeSearchForm="storeSearchForm"
:storeSelected="storeSelected" :storeSelected="storeSelected"
@handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose" @handleRelateStoreClose="handleRelateStoreClose"
></relate-store-dialog> >
<el-row slot>
<el-col
class="service-search"
:span="6"
>
<el-select v-model="storeSearchForm.channelType">
<el-option
v-for="item in baseData.channelType"
:key="item.value"
:label="item.name"
:value="item.value"
></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-input
v-model="storeSearchForm.merchantIdName"
placeholder="支持按门店、商户号搜索"
clearable
></el-input>
</el-col>
<el-button
type="primary"
@click="handleSearchStore"
>搜索</el-button>
</el-row>
</relate-store-dialog>
</d2-container> </d2-container>
</template> </template>
<script> <script>
import { getList, deleteMerchant, serviceGetMerchantList } from '@api/serviceStore' import { getList, deleteMerchant, serviceGetMerchantList, addServiceMerchant } from '@api/serviceStore'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { BaseData, userType, ghUserType } from '@/common/constants.js' import { BaseData, userType, ghUserType } from '@/common/constants.js'
export default { export default {
...@@ -107,6 +136,10 @@ export default { ...@@ -107,6 +136,10 @@ export default {
}] }]
}, },
// 关联门店 // 关联门店
storeSearchForm: {
channelType: 1,
merchantIdName: ''
},
relateStoreVisible: false, relateStoreVisible: false,
storeApi: serviceGetMerchantList, storeApi: serviceGetMerchantList,
storeSelected: [], storeSelected: [],
...@@ -134,7 +167,7 @@ export default { ...@@ -134,7 +167,7 @@ export default {
}) })
}, },
async getBaseData() { async getBaseData() {
this.baseData.channelType = await this.get(BaseData.CHANNELTYPE) this.baseData.channelType = await this.get(BaseData.channelType)
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
...@@ -145,14 +178,30 @@ export default { ...@@ -145,14 +178,30 @@ export default {
// console.log(form) // console.log(form)
this.relateStoreVisible = true this.relateStoreVisible = true
}, },
handleRelateStoreConfirm() { relateCloseReset() {
this.relateStoreVisible = false this.storeSearchForm = {
channelType: 1,
merchantIdName: ''
}
},
handleRelateStoreConfirm(selectedData) {
console.log(selectedData)
addServiceMerchant({ list: selectedData }).then(res => {
this.relateStoreVisible = false
this.$refs.serviceStoreTable.refreshTable()
this.notice.okTips()
this.relateCloseReset()
})
}, },
handleRelateStoreClose() { handleRelateStoreClose() {
this.relateStoreVisible = false this.relateStoreVisible = false
this.relateCloseReset()
},
handleSearchStore() {
this.$refs.relateStore.getSelectingList()
}, },
handleDelete(row) { handleDelete(row) {
console.log(row) // console.log(row)
this.$confirm('是否要进行删除操作?', '提示', { this.$confirm('是否要进行删除操作?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -170,5 +219,8 @@ export default { ...@@ -170,5 +219,8 @@ export default {
} }
</script> </script>
<style scoped> <style>
.service-store .service-search {
margin-bottom: 10px;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!