|
@ -1,5 +1,5 @@ |
|
|
<template> |
|
|
<template> |
|
|
<GuipDialog :dialogVisible="dialogVisible" :showFooterButton="showFooterButton" |
|
|
<GuipDialog :dialogVisible="dialogVisible" :showFooterButton="list.length>0" |
|
|
title="搜索商品" @confirm="handleConfirm" @cancel="handleCancel" @close="handleCancel"> |
|
|
title="搜索商品" @confirm="handleConfirm" @cancel="handleCancel" @close="handleCancel"> |
|
|
<div class="domain-wrap"> |
|
|
<div class="domain-wrap"> |
|
|
<el-form class="el-row demo-ruleForm" ref="formRef"> |
|
|
<el-form class="el-row demo-ruleForm" ref="formRef"> |
|
@ -12,9 +12,10 @@ |
|
|
<GuipButton type="primary" @click="handleSearch()">搜索</GuipButton> |
|
|
<GuipButton type="primary" @click="handleSearch()">搜索</GuipButton> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="goods-list"> |
|
|
<template v-if="loading"> |
|
|
|
|
|
<div class="goods-list" v-if="list.length>0"> |
|
|
<div class="goods-item" v-for="(row) in list" :key="row.num_iid"> |
|
|
<div class="goods-item" v-for="(row) in list" :key="row.num_iid"> |
|
|
<img src="@/assets/site/kefuTem.png" alt=""> |
|
|
<img :src="row.pic_url" alt=""> |
|
|
<div class="goods-info"> |
|
|
<div class="goods-info"> |
|
|
<p>{{row.title}}</p> |
|
|
<p>{{row.title}}</p> |
|
|
<p>¥{{row.price}}</p> |
|
|
<p>¥{{row.price}}</p> |
|
@ -24,12 +25,13 @@ |
|
|
<el-checkbox v-model="row.selected" @change="handleSelectGood(row)"></el-checkbox> |
|
|
<el-checkbox v-model="row.selected" @change="handleSelectGood(row)"></el-checkbox> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<el-empty v-else :image="emptyImg" :description="empty_text"></el-empty> |
|
|
|
|
|
</template> |
|
|
</el-form> |
|
|
</el-form> |
|
|
</div> |
|
|
</div> |
|
|
</GuipDialog> |
|
|
</GuipDialog> |
|
|
</template> |
|
|
</template> |
|
|
<script> |
|
|
<script> |
|
|
|
|
|
|
|
|
import GuipDialog from "@/components/GuipDialog.vue"; |
|
|
import GuipDialog from "@/components/GuipDialog.vue"; |
|
|
import GuipToolTip from "@/components/GuipToolTip.vue"; |
|
|
import GuipToolTip from "@/components/GuipToolTip.vue"; |
|
|
import GuipInput from "@/components/GuipInput.vue"; |
|
|
import GuipInput from "@/components/GuipInput.vue"; |
|
@ -38,7 +40,7 @@ import GuipSelect from "@/components/GuipSelect.vue"; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: '', |
|
|
name: '', |
|
|
props:['uid','type','isPdd'], |
|
|
props:['uid','type','pdd_pati','pdd_pagecode'], |
|
|
components: { |
|
|
components: { |
|
|
GuipSelect, |
|
|
GuipSelect, |
|
|
GuipButton, |
|
|
GuipButton, |
|
@ -49,21 +51,36 @@ export default { |
|
|
data(){ |
|
|
data(){ |
|
|
return { |
|
|
return { |
|
|
dialogVisible: true, |
|
|
dialogVisible: true, |
|
|
showFooterButton: false, |
|
|
|
|
|
keywords: '', |
|
|
keywords: '', |
|
|
pati: '', |
|
|
loading: false, |
|
|
pageCode: '', |
|
|
|
|
|
list: [], |
|
|
list: [], |
|
|
|
|
|
emptyImg:require('@/assets/table_empty.png'), |
|
|
empty_text: '', |
|
|
empty_text: '', |
|
|
bindData: {} |
|
|
bindData: {} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
|
|
|
if(this.isPdd) this.initPddSdk() |
|
|
|
|
|
}, |
|
|
|
|
|
methods:{ |
|
|
methods:{ |
|
|
handleConfirm(){ |
|
|
handleConfirm(){ |
|
|
this.dialogVisible = false; |
|
|
this.dialogVisible = false; |
|
|
|
|
|
const that = this |
|
|
|
|
|
this.$http('POST', '/agentnew/ajax_bind_service_goods', { |
|
|
|
|
|
uid: that.uid, |
|
|
|
|
|
type: that.type, |
|
|
|
|
|
bind_list: that.bindData, |
|
|
|
|
|
}, { |
|
|
|
|
|
headers: { |
|
|
|
|
|
'Auth': this.token |
|
|
|
|
|
} |
|
|
|
|
|
}).then(response => { |
|
|
|
|
|
if(response.status){ |
|
|
|
|
|
that.$message.success('绑定成功'); |
|
|
|
|
|
this.$emit('handleBind', this.bindData) |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
that.$message.error(response.info); |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
console.error(error, 'error') |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
handleCancel(){ |
|
|
handleCancel(){ |
|
|
this.dialogVisible = false; |
|
|
this.dialogVisible = false; |
|
@ -71,6 +88,8 @@ export default { |
|
|
}, |
|
|
}, |
|
|
handleSearch(){ |
|
|
handleSearch(){ |
|
|
const that = this |
|
|
const that = this |
|
|
|
|
|
that.list = [] |
|
|
|
|
|
that.loading = false |
|
|
this.$http('POST', '/agentnew/ajax_get_goods_list', { |
|
|
this.$http('POST', '/agentnew/ajax_get_goods_list', { |
|
|
uid: that.uid, |
|
|
uid: that.uid, |
|
|
type: that.type, |
|
|
type: that.type, |
|
@ -82,6 +101,7 @@ export default { |
|
|
'Auth': this.token |
|
|
'Auth': this.token |
|
|
} |
|
|
} |
|
|
}).then(response => { |
|
|
}).then(response => { |
|
|
|
|
|
that.loading = true |
|
|
if(response.status){ |
|
|
if(response.status){ |
|
|
if(response.data.length>0){ |
|
|
if(response.data.length>0){ |
|
|
response.data.forEach((item) => { |
|
|
response.data.forEach((item) => { |
|
@ -95,7 +115,6 @@ export default { |
|
|
}); |
|
|
}); |
|
|
that.$nextTick(() => { |
|
|
that.$nextTick(() => { |
|
|
that.list = response.data |
|
|
that.list = response.data |
|
|
that.showFooterButton = true |
|
|
|
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
that.empty_text = '未查询到相关商品' |
|
|
that.empty_text = '未查询到相关商品' |
|
@ -116,7 +135,7 @@ export default { |
|
|
this.$message.warning('请选择SKU'); |
|
|
this.$message.warning('请选择SKU'); |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
this.bindData[row.num_iid] = row.skuid |
|
|
this.bindData[row.num_iid] = !row.skuid ? 0 : row.skuid |
|
|
}else{ |
|
|
}else{ |
|
|
this.$delete(this.bindData, row.num_iid); |
|
|
this.$delete(this.bindData, row.num_iid); |
|
|
} |
|
|
} |
|
@ -126,46 +145,6 @@ export default { |
|
|
this.bindData[row.num_iid] = row.skuid |
|
|
this.bindData[row.num_iid] = row.skuid |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
async getPddPageCode(){ |
|
|
|
|
|
const that = this |
|
|
|
|
|
this.$http('POST', '/agentnew/ajax_get_pdd_page_code', { |
|
|
|
|
|
uid: that.uid, |
|
|
|
|
|
}, { |
|
|
|
|
|
headers: { |
|
|
|
|
|
'Auth': this.token |
|
|
|
|
|
} |
|
|
|
|
|
}).then(response => { |
|
|
|
|
|
return response.data |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
console.error(error, 'error') |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
async initPddSdk() { |
|
|
|
|
|
const that = this |
|
|
|
|
|
this.pageCode = await this.getPddPageCode() |
|
|
|
|
|
|
|
|
|
|
|
const script = document.createElement('script'); |
|
|
|
|
|
script.src = 'https://pfile.pddpic.com/galerie-go/open_sdk/pc.202102201613.js'; |
|
|
|
|
|
script.onload = () => { |
|
|
|
|
|
if (typeof window.PDD_OPEN_init === 'function') { |
|
|
|
|
|
window.PDD_OPEN_init({ |
|
|
|
|
|
code: that.pageCode |
|
|
|
|
|
// 对于获取 code 接口或未登录态,可不传 code:PDD_OPEN_init({}, function () { ... }) |
|
|
|
|
|
}, function () { |
|
|
|
|
|
// 初始化已完成 |
|
|
|
|
|
window.PDD_OPEN_getPati().then(function (pati) { |
|
|
|
|
|
that.pati = pati |
|
|
|
|
|
}).catch(error => console.log(error)) |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
console.error('PDD_OPEN_init 不存在,SDK 未正确加载'); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
script.onerror = () => { |
|
|
|
|
|
console.error('拼多多 SDK 加载失败'); |
|
|
|
|
|
}; |
|
|
|
|
|
document.head.appendChild(script); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
@ -176,6 +155,9 @@ export default { |
|
|
.el-dialog{ |
|
|
.el-dialog{ |
|
|
min-height: 0; |
|
|
min-height: 0; |
|
|
} |
|
|
} |
|
|
|
|
|
.el-empty{ |
|
|
|
|
|
padding: 20px 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.goods-list{ |
|
|
.goods-list{ |
|
|
max-height: 400px; |
|
|
max-height: 400px; |
|
|