|
|
|
@ -23,7 +23,7 @@ |
|
|
|
<FormItem label="商家名" prop="value"> |
|
|
|
<Select v-model="form.merchantId" filterable @on-change="checkShop" |
|
|
|
:remote-method="sreachShop" :loading="loading1"> |
|
|
|
<Option v-for="item in shopList" v-model="item.value" :key="item.value">{{ item.label }} |
|
|
|
<Option v-for="item in shopList" :value="item.value" :label="item.label" :key="item.value">{{ item.label }} |
|
|
|
</Option> |
|
|
|
</Select> |
|
|
|
</FormItem> |
|
|
|
@ -370,19 +370,50 @@ |
|
|
|
this.form.productList1.productName = v.productName |
|
|
|
this.aaVisiable = false |
|
|
|
}, |
|
|
|
getCurrentShopOption() { |
|
|
|
if (!this.form.merchantId) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
let linkParams = {}; |
|
|
|
if (this.form.linkParams) { |
|
|
|
try { |
|
|
|
linkParams = JSON.parse(this.form.linkParams); |
|
|
|
} catch (e) { |
|
|
|
linkParams = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
const shopName = this.form.merchantName || linkParams.shopName; |
|
|
|
if (!shopName) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
return Object.assign({}, linkParams, { |
|
|
|
id: this.form.merchantId, |
|
|
|
shopName, |
|
|
|
shopIcon: this.form.merchantImage || linkParams.shopIcon, |
|
|
|
label: shopName, |
|
|
|
value: this.form.merchantId |
|
|
|
}); |
|
|
|
}, |
|
|
|
setShopList(list) { |
|
|
|
const shopList = (list || []).map(item => Object.assign({}, item, { |
|
|
|
label: item.shopName, |
|
|
|
value: item.id |
|
|
|
})); |
|
|
|
const currentShop = this.getCurrentShopOption(); |
|
|
|
if (currentShop && !shopList.some(item => item.value == currentShop.value)) { |
|
|
|
shopList.unshift(currentShop); |
|
|
|
} |
|
|
|
this.shopList = shopList; |
|
|
|
}, |
|
|
|
sreachShop(v) { |
|
|
|
|
|
|
|
this.searchForm.keyWord = v |
|
|
|
// 多条件搜索用户列表 |
|
|
|
this.loading = true; |
|
|
|
this.loading1 = true; |
|
|
|
getShopData(this.searchForm).then((res) => { |
|
|
|
this.loading = false; |
|
|
|
this.loading1 = false; |
|
|
|
if (res.success) { |
|
|
|
this.shopList = res.result.content; |
|
|
|
for (let i = 0; i < this.shopList.length; i++) { |
|
|
|
this.shopList[i].label = this.shopList[i].shopName |
|
|
|
this.shopList[i].value = this.shopList[i].id |
|
|
|
} |
|
|
|
this.setShopList(res.result.content); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
@ -464,6 +495,7 @@ |
|
|
|
this.$refs.form.resetFields(); |
|
|
|
this.originalPosition = ""; |
|
|
|
this.form = this.getDefaultForm(); |
|
|
|
this.shopList = []; |
|
|
|
this.adList = [{ |
|
|
|
pic: '' |
|
|
|
}]; |
|
|
|
@ -493,14 +525,11 @@ |
|
|
|
pic: adImage.trim() |
|
|
|
}]; |
|
|
|
} |
|
|
|
this.setShopList([]); |
|
|
|
getShopData(this.searchForm).then((res) => { |
|
|
|
this.loading = false; |
|
|
|
this.loading1 = false; |
|
|
|
if (res.success) { |
|
|
|
this.shopList = res.result.content; |
|
|
|
for (let i = 0; i < this.shopList.length; i++) { |
|
|
|
this.shopList[i].label = this.shopList[i].shopName |
|
|
|
this.shopList[i].value = this.shopList[i].id |
|
|
|
} |
|
|
|
this.setShopList(res.result.content); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (data.productList && data.productList.length > 0) { |
|
|
|
|