Commit 9e023b16 by cwq0219

服务4s点

1 parent b82f74ed
import request from './request'
import RequestMethods from './request.methods'
const path = 'dj.api.'
......@@ -22,5 +23,5 @@ export function serviceGetMerchantList(data) {
// 新增商户门店
export function addServiceMerchant(data) {
data.method = `${path}servicemerchantref.add`
return request(data)
return request(data, RequestMethods.POST)
}
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @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'
......@@ -13,7 +13,7 @@ export const BASE_DATA_URL = 'fims.configuration.from.conftype'
const path = 'dj.api.'
// 获取商品分类列表
export function getGoodsType(data) {
export function getProductType(data) {
data.method = `${path}goods.type.list`
return request(data)
}
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-09-01 19:06:01
* @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'
......@@ -22,7 +22,8 @@ export const TYPE_NAME = 'confType'
* 前端基础数据管理对应的接口名称的key
*/
export const BaseData = {
CHANNELTYPE: 'channelType'
channelType: 'channelType',
productType: 'productType'
}
/**
* 注册类型
......
......@@ -2,23 +2,27 @@
* @Author: limin
* @Date: 2019-09-01 17:56:57
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-11 14:28:37
* @Last Modified time: 2020-11-11 17:42:11
*/
import {
getChannelType
getChannelType,
getProductType
} from '@/api/sys.base'
import {
BaseData
} from '@/common/constants'
const map = {
[BaseData.CHANNELTYPE]: getChannelType
[BaseData.channelType]: getChannelType,
[BaseData.productType]: getProductType
}
export default {
namespaced: true,
state: {
// 渠道类型
channelType: []
channelType: [],
// 产品分类
productType: []
},
actions: {
/**
......@@ -33,9 +37,11 @@ export default {
}) {
return new Promise(async resolve => {
Promise.all([
getChannelType({})
]).then(async([channelType]) => {
getChannelType({}),
getProductType({})
]).then(async([channelType, productType]) => {
state.channelType = channelType
state.productType = productType
await dispatch('save2db', {
name: '',
value: state
......@@ -51,6 +57,7 @@ export default {
}) {
return new Promise(async resolve => {
state.channelType = []
state.productType = []
await dispatch('save2db', {
name: '',
value: state
......@@ -112,8 +119,8 @@ export default {
if (state.channelType.length === 0) {
state = await dispatch('getFromdb', 'base') || await dispatch('init')
}
const { channelType } = state
resolve({ channelType })
const { channelType, productType } = state
resolve({ channelType, productType })
})
},
/**
......
......@@ -107,7 +107,8 @@
<script>
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 storeDetail from './storeDetail'
export default {
......@@ -187,17 +188,18 @@ export default {
},
mounted() {
getGoodsType({}).then(res => {
// console.log(res)
this.baseData.goodsType = res
})
this.getBaseData()
console.log(this.$route.params)
var allOpt = { confId: '', confKey: '全部' }
this.baseData.goodsType.unshift(allOpt)
this.baseData.brandList.unshift(allOpt)
// var allOpt = { confId: '', confKey: '全部' }
// this.baseData.goodsType.unshift(allOpt)
// this.baseData.brandList.unshift(allOpt)
},
methods: {
...mapActions('d2admin/base', ['get']),
async getBaseData() {
this.baseData.goodsType = await this.get(BaseData.productType)
},
beforeSearchFn() {
return new Promise(resolve => {
console.log('搜索前操作--')
......
<!-- 产品编辑 -->
<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>
<script>
import { mapActions } from 'vuex'
import { BaseData } from '@/common/constants.js'
export default {
name: 'editProduct',
data() {
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: {},
computed: {},
mounted() {},
mounted() {
this.getBaseData()
},
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>
......
......@@ -176,6 +176,7 @@ export default {
},
handleAdd(form) {
console.log(form)
this.$router.push({ name: 'editProduct' })
},
handleExport() { },
handleEdit(row) {
......
......@@ -167,7 +167,7 @@ export default {
})
},
async getBaseData() {
this.baseData.channelType = await this.get(BaseData.CHANNELTYPE)
this.baseData.channelType = await this.get(BaseData.channelType)
},
handleReset() {
this.searchForm = {
......@@ -184,9 +184,12 @@ export default {
merchantIdName: ''
}
},
handleRelateStoreConfirm() {
addServiceMerchant({}).then(res => {
handleRelateStoreConfirm(selectedData) {
console.log(selectedData)
addServiceMerchant({ list: selectedData }).then(res => {
this.relateStoreVisible = false
this.$refs.serviceStoreTable.refreshTable()
this.notice.okTips()
this.relateCloseReset()
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!