Browse Source

站点价格同步+菜单icon展示

pull/97/head
pengda 1 month ago
parent
commit
5803d5d555
  1. 2
      src/components/SliderScond.vue
  2. 23
      src/components/site/serviceSetting/priceSet.vue
  3. 155
      src/components/site/serviceSetting/syncPrice.vue
  4. 4
      src/components/site/serviceSetting/valueAdded.vue
  5. 2
      src/style/theme/common.scss
  6. 42
      src/views/agent/siteServiceAdd.vue
  7. 8
      src/views/agent/siteServiceList.vue

2
src/components/SliderScond.vue

@ -6,7 +6,7 @@
<div class="flex-between gap8 collapse-item"> <div class="flex-between gap8 collapse-item">
<div class="flex gap8 "> <div class="flex gap8 ">
<GuipToolTip :content="item[renderKeyNew.menuTitle]"> <GuipToolTip :content="item[renderKeyNew.menuTitle]">
<span class="menu-name">{{ item[renderKeyNew.menuTitle] }}</span> <span class="flex gap8 menu-name"><img width="20px" :src="require('@/assets/serviceIcon/ver_'+item.type+'.svg')" alt="">{{ item[renderKeyNew.menuTitle] }}</span>
</GuipToolTip> </GuipToolTip>
<span v-if="item[renderKeyNew.selected]" class="menu-select"></span> <span v-if="item[renderKeyNew.selected]" class="menu-select"></span>
</div> </div>

23
src/components/site/serviceSetting/priceSet.vue

@ -74,9 +74,20 @@
</div> </div>
<div class="flex service-opt mt12"> <div class="flex service-opt mt12">
<GuipButton type="ignore" @click="resetPrice">重置</GuipButton> <GuipButton type="ignore" @click="resetPrice">重置</GuipButton>
<syncPrice v-if="serviceAddInfo && serviceAddInfo.is_sync" :type="serviceAddInfo.type" :type_name="serviceAddInfo.type_name"
:price="serviceInfo.price" :unit_num="serviceInfo.unit_num" :unit_name="serviceAddInfo.unit_name"></syncPrice>
<GuipButton type="primary" @click="savePrice" size="medium">保存</GuipButton> <GuipButton type="primary" @click="savePrice" size="medium">保存</GuipButton>
</div> </div>
</el-form> </el-form>
<template v-if="serviceAddInfo.value_added.length>0">
<div class="price-top">
<span class="title">增值服务</span>
<span class="desc"></span>
</div>
<valueAdded v-for="(added_type, index) in serviceAddInfo.value_added" :key="index" :uid="uid" :type="added_type"></valueAdded>
</template>
</div> </div>
<!-- 店铺售价--> <!-- 店铺售价-->
@ -200,6 +211,8 @@ import GuipSelect from "@/components/GuipSelect.vue";
import bindGoods from "@/components/bindGoods.vue"; import bindGoods from "@/components/bindGoods.vue";
import GuipDialog from "@/components/GuipDialog.vue"; import GuipDialog from "@/components/GuipDialog.vue";
import PromptText from "@/components/PromptText.vue"; import PromptText from "@/components/PromptText.vue";
import SyncPrice from "@/components/site/serviceSetting/syncPrice.vue";
import ValueAdded from "@/components/site/serviceSetting/valueAdded.vue";
export default { export default {
name: 'priceSet', name: 'priceSet',
@ -210,6 +223,8 @@ export default {
} }
}, },
components: { components: {
ValueAdded,
SyncPrice,
GuipSelect, GuipSelect,
GuipInput, GuipInput,
GuipButton, GuipButton,
@ -294,8 +309,8 @@ export default {
resetPrice() { resetPrice() {
this.info.price = '' this.info.price = ''
this.info.unit_num = '' this.info.unit_num = ''
this.info.b_unit_price = '' this.info.base_unit_price = ''
this.info.b_unit_num = '' this.info.base_unit_num = ''
}, },
savePrice() { savePrice() {
const that = this const that = this
@ -330,8 +345,8 @@ export default {
resetShopPrice() { resetShopPrice() {
this.info.unit_piece = '' this.info.unit_piece = ''
this.info.unit_num = '' this.info.unit_num = ''
this.info.b_unit_piece = '' this.info.base_unit_piece = ''
this.info.b_unit_num = '' this.info.base_unit_num = ''
}, },
saveShopPrice() { saveShopPrice() {
const that = this const that = this

155
src/components/site/serviceSetting/syncPrice.vue

@ -0,0 +1,155 @@
<template>
<GuipButton type="ignore" @click="syncPriceClick" size="medium">
同步价格
<GuipDialog width="800px" :dialogVisible="dialogSyncPrice" :title="'同步价格_'+type_name" confirmText="保存价格"
@confirm="handleSavePrice" @close="handleSyncPriceClose"
:show-cancel-button="priceDesc!==''" :cancelText="priceDesc" @cancel="handleSyncPrice">
<GuipTable :tableData="siteList" ref="multipleTable" autoColumn="true" :loading="tableLoading">
<el-table-column prop="site_name" label="站点"></el-table-column>
<el-table-column prop="price" label="当前价格">
<template slot-scope="scope">
{{scope.row.price}}/{{scope.row.unit_format}}
</template>
</el-table-column>
<el-table-column prop="price_set" label="设置价格">
<template slot-scope="scope">
<div class="flex mr12">
<GuipInput v-if="scope.row.unit_num === '1'" v-model="scope.row.price"
ref="GuipInput" :unit="'元/'+scope.row.unit_name"></GuipInput>
<template v-else>
<GuipInput v-model="scope.row.price" ref="GuipInput" unit="元">
</GuipInput>
<GuipInput v-model="scope.row.unit_num" ref="GuipInput" :unit="scope.row.unit_name">
</GuipInput>
</template>
</div>
</template>
</el-table-column>
</GuipTable>
</GuipDialog>
</GuipButton>
</template>
<script>
import GuipButton from "@/components/GuipButton.vue";
import GuipDialog from "@/components/GuipDialog.vue";
import GuipTable from "@/components/GuipTable.vue";
import GuipInput from "@/components/GuipInput.vue";
export default {
name: 'syncPrice',
props: ['type', 'type_name', 'price', 'unit_num', 'unit_name'],
components: {
GuipInput,
GuipTable,
GuipDialog,
GuipButton
},
data(){
return {
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTI2NDY1NDUsIm5iZiI6MTc1MjY0NjU0NSwiZXhwIjoxNzU1MjM4NTQ1LCJ1c2VyIjoic3VidXNlciIsImxvZ2luX3R5cGUiOjAsImFpZCI6IjEifQ.G-Is-x9qPMiV_urOlDPQVRjfAIozySxL5EK2k82d46k',
dialogSyncPrice: false,
tableLoading: false,
siteList:[] ,
}
},
computed:{
priceDesc(){
if(this.price) {
let priceDesc = '同步为'+this.price+'元/'+this.unit_num+this.unit_name;
if(this.unit_num === '1') priceDesc = '同步为'+this.price+'元/'+this.unit_name;
return priceDesc
}
return "";
}
},
mounted() {
this.getSiteList()
},
methods:{
getSiteList(){
this.tableLoading = true
const that = this
that.serviceList = []
this.$http('POST', '/agentnew/ajax_get_service_sites', {
type: that.type,
},{
headers:{
'Auth': that.token
}
}).then(response => {
that.tableLoading = false
if(response.status){
that.$nextTick(() => {
that.siteList = response.data
})
}
}).catch(error => {
console.error(error, 'error')
})
},
syncPriceClick(){
this.dialogSyncPrice = true
},
handleSyncPriceClose(){
this.dialogSyncPrice = false
},
handleSavePrice(){
this.dialogSyncPrice = false
console.log(this.siteList)
this.savePrice(0)
},
handleSyncPrice(){
this.dialogSyncPrice = false
console.log(this.siteList)
this.savePrice(1)
},
savePrice(sync){
let price_config = []
this.siteList.forEach((item)=>{
let config = {
'id' : item.id,
'price' : sync === 1 ? this.price : item.price,
'unit_num' : sync === 1 ? this.unit_num : item.unit_num
}
price_config.push(config)
})
const that = this
this.$http('POST', "/agentnew/ajax_update_services_price", {
type: that.type,
price_config: price_config,
is_sync: sync
}, {
headers: {
'Auth': this.token
}
}).then(response => {
if (response.status) {
that.$message.success('保存成功');
if(sync === 1){
that.$nextTick(() => {
that.siteList.forEach((item)=>{
item.price = this.price
item.unit_num = this.unit_num
})
})
}
return true;
}
that.$message.error(response.info);
}).catch(error => {
console.error(error, 'error')
})
}
}
}
</script>
<style lang="scss" scoped>
.mr12{
margin-right: 12px;
}
::v-deep .el-table__body-wrapper{
height: 300px;
overflow-y: auto;
}
</style>

4
src/components/site/serviceSetting/valueAdded.vue

@ -41,6 +41,8 @@
</div> </div>
<div class="flex service-opt mt12"> <div class="flex service-opt mt12">
<GuipButton type="ignore" @click="resetPrice">重置</GuipButton> <GuipButton type="ignore" @click="resetPrice">重置</GuipButton>
<syncPrice v-if="serviceAddInfo && serviceAddInfo.is_sync" :type="serviceAddInfo.type" :type_name="serviceAddInfo.type_name"
:price="serviceInfo.price" :unit_num="serviceInfo.unit_num" :unit_name="serviceAddInfo.unit_name"></syncPrice>
<GuipButton type="primary" @click="savePrice" size="medium">保存</GuipButton> <GuipButton type="primary" @click="savePrice" size="medium">保存</GuipButton>
</div> </div>
</el-form> </el-form>
@ -53,11 +55,13 @@ import GuipInput from "@/components/GuipInput.vue";
import GuipSelect from "@/components/GuipSelect.vue"; import GuipSelect from "@/components/GuipSelect.vue";
import GuipButton from "@/components/GuipButton.vue"; import GuipButton from "@/components/GuipButton.vue";
import PromptText from "@/components/PromptText.vue"; import PromptText from "@/components/PromptText.vue";
import SyncPrice from "@/components/site/serviceSetting/syncPrice.vue";
export default { export default {
name: 'valueAdded', name: 'valueAdded',
props: ['uid','type'], props: ['uid','type'],
components: { components: {
SyncPrice,
PromptText, PromptText,
GuipButton, GuipSelect, GuipInput GuipButton, GuipSelect, GuipInput

2
src/style/theme/common.scss

@ -983,7 +983,7 @@ body {
width: 100%; width: 100%;
justify-content: flex-end !important; justify-content: flex-end !important;
button { button {
width: 96px; width: auto;
height: 38px; height: 38px;
} }
} }

42
src/views/agent/siteServiceAdd.vue

@ -100,9 +100,20 @@
</div> </div>
<div class="flex service-opt mt12"> <div class="flex service-opt mt12">
<GuipButton type="ignore" @click="resetPrice">重置</GuipButton> <GuipButton type="ignore" @click="resetPrice">重置</GuipButton>
<syncPrice v-if="serviceAddInfo && serviceAddInfo.is_sync" :type="serviceAddInfo.type" :type_name="serviceAddInfo.type_name"
:price="serviceInfo.price" :unit_num="serviceInfo.unit_num" :unit_name="serviceAddInfo.unit_name"></syncPrice>
<GuipButton type="primary" @click="savePrice" size="medium">保存</GuipButton> <GuipButton type="primary" @click="savePrice" size="medium">保存</GuipButton>
</div> </div>
</el-form> </el-form>
<template v-if="serviceAddInfo.value_added.length>0">
<div class="price-top">
<span class="title">增值服务</span>
<span class="desc"></span>
</div>
<valueAdded v-for="(added_type, index) in serviceAddInfo.value_added" :key="index" :uid="uid" :type="added_type"></valueAdded>
</template>
</div> </div>
<!-- 店铺售价--> <!-- 店铺售价-->
@ -222,11 +233,9 @@
@confirm="handleDelServiceConfirm" @cancel="handleDelServiceCancel"> @confirm="handleDelServiceConfirm" @cancel="handleDelServiceCancel">
确定要移除服务吗? 确定要移除服务吗?
</GuipDialog> </GuipDialog>
</div> </div>
<div class="register-btns"> <div class="register-btns">
<GuipButton type="primary" :btnstyle="{ width: '144px', height: '46px' }" @click="jumpStep">添加完成 <GuipButton type="primary" :btnstyle="{ width: '144px', height: '46px' }" @click="jumpStep">添加完成</GuipButton>
</GuipButton>
</div> </div>
</div> </div>
@ -240,11 +249,15 @@ import GuipSelect from "@/components/GuipSelect.vue";
import GuipInput from "@/components/GuipInput.vue"; import GuipInput from "@/components/GuipInput.vue";
import bindGoods from "@/components/bindGoods.vue"; import bindGoods from "@/components/bindGoods.vue";
import GuipDialog from "@/components/GuipDialog.vue"; import GuipDialog from "@/components/GuipDialog.vue";
import ValueAdded from "@/components/site/serviceSetting/valueAdded.vue";
import SyncPrice from "@/components/site/serviceSetting/syncPrice.vue";
export default { export default {
name: 'siteServiceAdd', name: 'siteServiceAdd',
props: [''], props: [''],
components: { components: {
SyncPrice,
ValueAdded,
GuipDialog, GuipDialog,
GuipInput, GuipInput,
GuipSelect, GuipSelect,
@ -281,6 +294,8 @@ export default {
watch: { watch: {
'$store.state.currentMenuItem'(newVal) { '$store.state.currentMenuItem'(newVal) {
this.type = newVal.type this.type = newVal.type
//
this.getServiceInfo()
this.getServiceAddInfo(); this.getServiceAddInfo();
}, },
}, },
@ -339,9 +354,6 @@ export default {
that.service_unit = that.serviceAddInfo.unit that.service_unit = that.serviceAddInfo.unit
// //
if (that.serviceAddInfo.shop_name === '拼多多') this.initPddParam(that.uid) if (that.serviceAddInfo.shop_name === '拼多多') this.initPddParam(that.uid)
//
that.getServiceInfo()
store.commit('SET_BREADRIGHTTEXT', that.serviceAddInfo.site_short_name); store.commit('SET_BREADRIGHTTEXT', that.serviceAddInfo.site_short_name);
}) })
return true return true
@ -434,8 +446,8 @@ export default {
resetPrice() { resetPrice() {
this.serviceInfo.price = '' this.serviceInfo.price = ''
this.serviceInfo.unit_num = '' this.serviceInfo.unit_num = ''
this.serviceInfo.b_unit_price = '' this.serviceInfo.base_unit_price = ''
this.serviceInfo.b_unit_num = '' this.serviceInfo.base_unit_num = ''
}, },
savePrice() { savePrice() {
const that = this const that = this
@ -474,8 +486,8 @@ export default {
resetShopPrice() { resetShopPrice() {
this.serviceInfo.unit_piece = '' this.serviceInfo.unit_piece = ''
this.serviceInfo.unit_num = '' this.serviceInfo.unit_num = ''
this.serviceInfo.b_unit_piece = '' this.serviceInfo.base_unit_piece = ''
this.serviceInfo.b_unit_num = '' this.serviceInfo.base_unit_num = ''
}, },
saveShopPrice() { saveShopPrice() {
const that = this const that = this
@ -696,11 +708,11 @@ export default {
letter-spacing: 0.08em; letter-spacing: 0.08em;
} }
::v-deep .prompt-desc { //.prompt-desc {
font-size: 14px; // font-size: 14px;
font-weight: bold; // font-weight: bold;
color: #1E2226; // color: #1E2226;
} //}
} }

8
src/views/agent/siteServiceList.vue

@ -20,7 +20,7 @@
<!-- page content --> <!-- page content -->
<el-form> <el-form>
<GuipTable :tableData="serviceList" ref="multipleTable" autoColumn="true" :loading="tableLoading" <GuipTable :tableData="serviceList" ref="multipleTable" :loading="tableLoading"
@selection-change="handleSelectionChange" @select="handleSelect"> @selection-change="handleSelectionChange" @select="handleSelect">
<el-table-column type="selection" width="100"> <el-table-column type="selection" width="100">
<template slot="header"> <template slot="header">
@ -248,13 +248,13 @@ export default {
const that = this const that = this
that.serviceList = [] that.serviceList = []
this.$http('POST', '/agentnew/ajax_get_service_list', { this.$http('POST', '/agentnew/ajax_get_service_list', {
uid: this.uid, uid: that.uid,
},{ },{
headers:{ headers:{
'Auth': this.token 'Auth': that.token
} }
}).then(response => { }).then(response => {
this.tableLoading = false that.tableLoading = false
if(response.status){ if(response.status){
that.$nextTick(() => { that.$nextTick(() => {
that.addProd = response.data.add_proids that.addProd = response.data.add_proids

Loading…
Cancel
Save