Commit 7c231a91 by cwq0219

服务门店;商品编辑

1 parent 061e922d
...@@ -7,6 +7,29 @@ ...@@ -7,6 +7,29 @@
:ref="formRef + 'd2FormRuleForm'" :ref="formRef + 'd2FormRuleForm'"
v-loading="$store.state.d2admin.loading.value" v-loading="$store.state.d2admin.loading.value"
> >
<div>
<el-form-item
id="yqMerchantId"
label="园区店:"
prop="yqMerchantId"
v-show="userInfo.beSuper"
>
<el-select
v-model="formData.yqMerchantId"
:disabled="merchantDisable"
placeholder="请选择"
class="el_select itd"
@change="handleMerchantChange"
>
<el-option
v-for="x in parkServiceList"
:key="x.merchantId"
:value="x.merchantId"
:label="x.merchantName"
></el-option>
</el-select>
</el-form-item>
</div>
<div <div
v-for="(i, idx) in formList" v-for="(i, idx) in formList"
:key="idx" :key="idx"
...@@ -126,28 +149,6 @@ ...@@ -126,28 +149,6 @@
>{{item.btnTxt}}</el-button> >{{item.btnTxt}}</el-button>
<span>已为该商品组合分配<span class="relate-btn-txt">{{formData[item.name] ? formData[item.name].length : 0}}</span>家可见店铺</span> <span>已为该商品组合分配<span class="relate-btn-txt">{{formData[item.name] ? formData[item.name].length : 0}}</span>家可见店铺</span>
</div> </div>
<div>
<el-form-item
id="yqMerchantId"
label="服务门店:"
prop="yqMerchantId"
v-show="userInfo.beSuper"
>
<el-select
v-model="formData.yqMerchantId"
placeholder="请选择"
class="el_select itd"
@change="handleMerchantChange"
>
<el-option
v-for="x in parkServiceList"
:key="x.merchantId"
:value="x.merchantId"
:label="x.merchantName"
></el-option>
</el-select>
</el-form-item>
</div>
<el-table <el-table
:data="formData[item.name]" :data="formData[item.name]"
style="width: 690px" style="width: 690px"
...@@ -199,6 +200,7 @@ ...@@ -199,6 +200,7 @@
<div class="add-btns"> <div class="add-btns">
<el-button <el-button
type="primary" type="primary"
:disabled="!formData.yqMerchantId"
@click="handleAddPro(item)" @click="handleAddPro(item)"
>添加绑定</el-button> >添加绑定</el-button>
<span>已将基础商品绑定<span class="relate-btn-txt">{{formData[item.name] ? formData[item.name].length : 0}}</span>件升级商品</span> <span>已将基础商品绑定<span class="relate-btn-txt">{{formData[item.name] ? formData[item.name].length : 0}}</span>件升级商品</span>
...@@ -526,6 +528,7 @@ export default { ...@@ -526,6 +528,7 @@ export default {
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
merchantDisable: true,
// 关联商品弹窗 // 关联商品弹窗
relateProVisible: false, relateProVisible: false,
relateStoreVisible: false, relateStoreVisible: false,
...@@ -587,6 +590,10 @@ export default { ...@@ -587,6 +590,10 @@ export default {
storeApi: { storeApi: {
type: Function, type: Function,
default: () => { } default: () => { }
},
formName: {
type: String,
default: () => { }
} }
}, },
...@@ -597,22 +604,25 @@ export default { ...@@ -597,22 +604,25 @@ export default {
mounted() { mounted() {
this.formData = _.cloneDeep(this.originData) this.formData = _.cloneDeep(this.originData)
this.merchantDisable = this.addOrEdit === 'edit'
if (this.userInfo.beSuper) { if (this.userInfo.beSuper) {
getParkStore({}).then(res => { getParkStore({}).then(res => {
// console.log(res)
this.parkServiceList = res this.parkServiceList = res
}) })
} }
if (this.formData.hasOwnProperty('upgradeGoods')) { if (this.formData.hasOwnProperty('upgradeGoods')) {
this.profitOldVal = this.formData.upgradeGoods.map(item => item.profitValue) this.profitOldVal = this.formData.upgradeGoods.map(item => item.profitValue)
this.getGoodsList() // this.getGoodsList()
} }
}, },
methods: { methods: {
getGoodsList() { getGoodsList(merchantId) {
getGoodsList({}).then(res => { return new Promise(resolve => {
getGoodsList({ yqMerchantId: merchantId }).then(res => {
this.proList = res this.proList = res
resolve()
})
}) })
}, },
// 选择框-添加其他属性 // 选择框-添加其他属性
...@@ -628,6 +638,8 @@ export default { ...@@ -628,6 +638,8 @@ export default {
// } // }
}, },
handleAddPro(targetItem) { handleAddPro(targetItem) {
// formData.yqMerchantId
this.getGoodsList(this.formData.yqMerchantId).then(res => {
if (!this.formData[targetItem.relateAttr]) { if (!this.formData[targetItem.relateAttr]) {
// this.notice.warningTips('请选择基础商品') // this.notice.warningTips('请选择基础商品')
this.$message({ this.$message({
...@@ -646,9 +658,11 @@ export default { ...@@ -646,9 +658,11 @@ export default {
item.disabled = proSelectedIds.includes(item.goodsCode) item.disabled = proSelectedIds.includes(item.goodsCode)
}) })
this.relateProVisible = true this.relateProVisible = true
})
}, },
handleProChange(item, targetItem, targetIndex) { handleProChange(item, targetItem, targetIndex) {
console.log(targetItem) console.log(targetItem)
this.getGoodsList(this.formData.yqMerchantId).then(res => {
var proSelectedIds = this.formData.upgradeGoods.map(item => item.goodsCode) var proSelectedIds = this.formData.upgradeGoods.map(item => item.goodsCode)
proSelectedIds.push(this.formData[item.relateAttr]) proSelectedIds.push(this.formData[item.relateAttr])
this.proList.forEach(item => { this.proList.forEach(item => {
...@@ -661,11 +675,13 @@ export default { ...@@ -661,11 +675,13 @@ export default {
this.proIndex = targetIndex this.proIndex = targetIndex
this.originProInfo = targetItem this.originProInfo = targetItem
this.relateProVisible = true this.relateProVisible = true
})
}, },
judgeIsDisable() { judgeIsDisable() {
// console.log(this.markTarget) // console.log(this.markTarget)
if (this.addOrEdit === 'add') { if (this.addOrEdit === 'add') {
this.formList[0].formBlock[0].isDisabled = this.formData[this.markTarget.name].length this.formList[0].formBlock[0].isDisabled = this.formData[this.markTarget.name].length
this.merchantDisable = this.formData[this.markTarget.name].length
} }
}, },
handleRelateProConfirm(proInfo) { handleRelateProConfirm(proInfo) {
...@@ -775,8 +791,14 @@ export default { ...@@ -775,8 +791,14 @@ export default {
this.imageUrl = src this.imageUrl = src
}, },
// 服务门店更改 // 服务门店更改
handleMerchantChange() { handleMerchantChange(value) {
// console.log(value)
if (this.formName === 'commodity') {
this.$emit('ydMerchantChange', value)
this.formData.goodsCode = ''
this.formData.upgradeGoods = []
this.formData.linkMerchantIds = [] this.formData.linkMerchantIds = []
}
}, },
// 验证分账比例 // 验证分账比例
handleProfitInput(value, index) { handleProfitInput(value, index) {
......
...@@ -179,7 +179,6 @@ export default { ...@@ -179,7 +179,6 @@ export default {
0: '已下架', 0: '已下架',
1: '上架' 1: '上架'
}[cellValue.status] }[cellValue.status]
// return '上架'
} }
}, { }, {
label: '创建时间', label: '创建时间',
......
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
ref="d2Form" ref="d2Form"
:formItemWidth="formItemWidth" :formItemWidth="formItemWidth"
:storeApi="commodityAddSeviceMerchant" :storeApi="commodityAddSeviceMerchant"
formName="commodity"
:rules="rules" :rules="rules"
:addOrEdit="addOrEdit" :addOrEdit="addOrEdit"
:originData="editData" :originData="editData"
:formList="editForm" :formList="editForm"
:formRef="comFormRef" :formRef="comFormRef"
@ydMerchantChange="getGoodsList"
@handleAddConfirm="handleAddConfirm" @handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose" @handleClose="handleAddClose"
></d2-form> ></d2-form>
...@@ -57,7 +59,24 @@ export default { ...@@ -57,7 +59,24 @@ export default {
// attr: 'thumbUrl' // attr: 'thumbUrl'
// }, // },
comFormRef: 'com', comFormRef: 'com',
editForm: [{ editForm: [
// {
// title: '',
// formBlock: [{
// name: 'yqMerchantId',
// label: '园区店',
// isRequired: true,
// type: 'select',
// isHide: true,
// // tips: '选择基础商品',
// isClear: false,
// optionList: [],
// isDisabled: true,
// optionId: 'merchantId',
// optionLabel: 'merchantName'
// }]
// },
{
title: '基础商品信息', title: '基础商品信息',
width: '50%', width: '50%',
headImg: { headImg: {
...@@ -172,11 +191,15 @@ export default { ...@@ -172,11 +191,15 @@ export default {
// console.log(this.editData) // console.log(this.editData)
// add - 新增;edit - 编辑 // add - 新增;edit - 编辑
this.addOrEdit = this.$route.params.addOrEdit this.addOrEdit = this.$route.params.addOrEdit
this.getGoodsList() // !this.userInfo.beSuper && (this.editForm.splice(0, 1)) && this.getGoodsList(this.userInfo.detail.merchantId)
!this.userInfo.beSuper && this.getGoodsList(this.userInfo.detail.merchantId)
console.log(this.editForm)
if (this.addOrEdit === 'edit') { if (this.addOrEdit === 'edit') {
getGoodsInfoById({ id: this.$route.params.row.id }).then(res => { getGoodsInfoById({ id: this.$route.params.row.id }).then(res => {
// console.log(res) // console.log(res)
this.editForm[0].formBlock[0].isDisabled = true var tempIndex = this.editForm.findIndex(i => i.title === '基础商品信息')
console.log(tempIndex)
this.editForm[tempIndex].formBlock[0].isDisabled = true
this.editData = { this.editData = {
yqMerchantId: this.userInfo.beSuper ? '' : this.userInfo.detail.merchantId, yqMerchantId: this.userInfo.beSuper ? '' : this.userInfo.detail.merchantId,
id: res.id, id: res.id,
...@@ -215,9 +238,9 @@ export default { ...@@ -215,9 +238,9 @@ export default {
methods: { methods: {
...mapActions({ close: 'd2admin/page/close' }), ...mapActions({ close: 'd2admin/page/close' }),
// ...mapActions('d2admin/page', ['close']), // ...mapActions('d2admin/page', ['close']),
getGoodsList() { getGoodsList(merchantId) {
// var params = this.addOrEdit === 'edit' ? {} : { exceptBase: true } // var params = this.addOrEdit === 'edit' ? {} : { exceptBase: true }
getGoodsList({}).then(res => { getGoodsList({ yqMerchantId: merchantId }).then(res => {
// console.log(res) // console.log(res)
this.editForm[0].formBlock[0].optionList = res this.editForm[0].formBlock[0].optionList = res
}) })
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
ref="d2ProductForm" ref="d2ProductForm"
:formItemWidth="formItemWidth" :formItemWidth="formItemWidth"
:rules="rules" :rules="rules"
addOrEdit="add" :addOrEdit="addOrEdit"
formName="product"
:originData="editData" :originData="editData"
:formList="editForm" :formList="editForm"
:formRef="proFormRef" :formRef="proFormRef"
...@@ -56,11 +57,13 @@ export default { ...@@ -56,11 +57,13 @@ export default {
proFormRef: 'pro', proFormRef: 'pro',
editForm: [{ editForm: [{
title: '素材基本信息', title: '素材基本信息',
formBlock: [{ formBlock: [
name: 'yqMerchantId', // {
label: '园区店', // name: 'yqMerchantId',
type: 'select' // label: '园区店',
}, { // type: 'select'
// },
{
name: 'goodsName', name: 'goodsName',
label: '素材名称', label: '素材名称',
type: 'input', type: 'input',
......
...@@ -53,6 +53,32 @@ ...@@ -53,6 +53,32 @@
@handleRelateStoreClose="handleRelateStoreClose" @handleRelateStoreClose="handleRelateStoreClose"
> >
<el-row slot> <el-row slot>
<el-form
:model="storeSearchForm"
:rules="rules"
ref="relate"
>
<el-col>
<el-form-item
id="yqMerchantId"
label="园区店:"
prop="yqMerchantId"
v-show="userInfo.beSuper"
>
<el-select
v-model="storeSearchForm.yqMerchantId"
placeholder="请选择"
class="el_select itd"
>
<el-option
v-for="x in parkServiceList"
:key="x.merchantId"
:value="x.merchantId"
:label="x.merchantName"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col <el-col
class="service-search" class="service-search"
:span="6" :span="6"
...@@ -66,6 +92,7 @@ ...@@ -66,6 +92,7 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-col> </el-col>
</el-form>
<el-col :span="8"> <el-col :span="8">
<el-input <el-input
v-model="storeSearchForm.merchantIdName" v-model="storeSearchForm.merchantIdName"
...@@ -84,6 +111,7 @@ ...@@ -84,6 +111,7 @@
<script> <script>
import { Util } from '@/common/util' import { Util } from '@/common/util'
import { getParkStore } from '@api/editCustomer'
import { getList, deleteMerchant, serviceGetMerchantList, addServiceMerchant } 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'
...@@ -91,9 +119,13 @@ export default { ...@@ -91,9 +119,13 @@ export default {
name: 'serviceStore', name: 'serviceStore',
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info,
searchForm: { searchForm: {
merchantName: '' merchantName: ''
}, },
rules: {
yqMerchantId: [{ required: true, message: '请选择园区店', trigger: 'change' }]
},
showFormData: [{ showFormData: [{
label: '商户名称', label: '商户名称',
name: 'merchantName', name: 'merchantName',
...@@ -177,7 +209,14 @@ export default { ...@@ -177,7 +209,14 @@ export default {
this.getBaseData() this.getBaseData()
}, },
mounted() { }, mounted() {
// if (this.userInfo.beSuper) {
!this.userInfo.beSuper && (this.storeSearchForm.yqMerchantId = this.userInfo.detail.merchantId)
getParkStore({}).then(res => {
this.parkServiceList = res
})
// }
},
methods: { methods: {
...mapActions('d2admin/base', ['get']), ...mapActions('d2admin/base', ['get']),
...@@ -187,6 +226,7 @@ export default { ...@@ -187,6 +226,7 @@ export default {
resolve() resolve()
}) })
}, },
async getBaseData() { async getBaseData() {
this.baseData.channelType = await this.get(BaseData.channelType) this.baseData.channelType = await this.get(BaseData.channelType)
}, },
...@@ -208,6 +248,9 @@ export default { ...@@ -208,6 +248,9 @@ export default {
}, },
handleRelateStoreConfirm(selectedData) { handleRelateStoreConfirm(selectedData) {
// console.log(selectedData) // console.log(selectedData)
this.$refs.relate.validate(valid => {
console.log(valid)
if (valid) {
if (!selectedData.length) { if (!selectedData.length) {
// this.notice.warningTips('请选择关联门店') // this.notice.warningTips('请选择关联门店')
this.$message({ this.$message({
...@@ -221,12 +264,19 @@ export default { ...@@ -221,12 +264,19 @@ export default {
this.$message.error(`一次只能选择${this.maxLength}个门店`) this.$message.error(`一次只能选择${this.maxLength}个门店`)
return true return true
} }
var merchantName = this.parkServiceList.find(item => item.merchantId === this.storeSearchForm.yqMerchantId).merchantName
selectedData.forEach(item => {
item.yqMerchantId = this.storeSearchForm.yqMerchantId
item.yqMerchantName = merchantName
})
addServiceMerchant({ list: selectedData }).then(res => { addServiceMerchant({ list: selectedData }).then(res => {
this.relateStoreVisible = false this.relateStoreVisible = false
this.$refs.serviceStoreTable.refreshTable() this.$refs.serviceStoreTable.refreshTable()
this.notice.okTips() this.notice.okTips()
this.relateCloseReset() this.relateCloseReset()
}) })
}
})
}, },
handleRelateStoreClose() { handleRelateStoreClose() {
this.relateStoreVisible = false this.relateStoreVisible = false
...@@ -235,6 +285,10 @@ export default { ...@@ -235,6 +285,10 @@ export default {
handleSearchStore() { handleSearchStore() {
this.$refs.relateStore.getSelectingList() this.$refs.relateStore.getSelectingList()
}, },
// handleMerchantChange(value) {
// this.storeSearchForm.yqMerchantId = value
// this.$refs.relateStore.getSelectingList()
// },
handleDelete(row) { handleDelete(row) {
// console.log(row) // console.log(row)
this.$confirm('是否要进行删除操作?', '提示', { this.$confirm('是否要进行删除操作?', '提示', {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!