rainbro 2 months ago
parent
commit
db33b779fe
  1. 18
      src/components/domainBind.vue
  2. 77
      src/components/site/addSiteStep/step1.vue
  3. 19
      src/components/site/addSiteStep/step3.vue
  4. 17
      src/components/site/serviceSetting/menuColorSet.vue
  5. 6
      src/utils/common.js
  6. 13
      src/views/agent/siteAdd.vue
  7. 19
      src/views/agent/siteServiceList.vue
  8. 24
      src/views/agent/siteTemplate.vue

18
src/components/domainBind.vue

@ -1,10 +1,11 @@
<template>
<div>
<el-form class="el-row demo-ruleForm" ref="formRef" :rules="rules" :model="data">
<el-form class="el-row demo-ruleForm" ref="bindFormRef" :rules="rules" :model="data">
<GuipFormItem column="column" class="combo-formItem w540" :label="label" :class="label ? '' : 'combo-formItem-nolabel'">
<div slot="formDom" class="self-drop-wrap flex w540">
<GuipInput prop="prefix" v-model="data.prefix" style="width: 60%;" placeholder="仅支持数字、字母" @blur="inputEnd"></GuipInput>
<!-- 只用作选中内容展示 -->
<GuipInput prop="prefix" v-model="data.prefix" style="width: 60%;" placeholder="仅支持数字、字母" @blur="inputEnd">
<i slot="suffix" v-if="data.prefix" class="el-icon-close" @click="handleClear"></i>
</GuipInput>
<div @click="toggleDrop" class="point flex appendDrop" style="width: 40%;">{{data.domain}}</div>
</div>
<!--触发 真实下拉操作 -->
@ -55,7 +56,7 @@ export default {
},
rules:{
prefix: [
{ required: true, message: '请输入域名前缀', trigger: 'blur' }
{ required: true, message: '请输入域名前缀', trigger: []}
],
},
isShowAddDomainDialog: false,
@ -74,6 +75,8 @@ export default {
}
},
mounted(){
this.data.prefix = this.defaultPrefix
this.data.domain = this.defaultDomain
this.getDomainList()
},
methods:{
@ -86,7 +89,9 @@ export default {
label: '.'+item,
value: '.'+item
}));
if(!response.data.includes(this.data.domain) || !this.data.domain) this.data.domain = '.'+response.data[0]
let domain = this.data.domain.startsWith('.') ? this.data.domain.slice(1) : this.data.domain;
if(!response.data.includes(domain) || !domain) this.data.domain = '.'+response.data[0]
} else {
if(!this.data.domain) this.data.domain = '暂无域名'
}
@ -97,6 +102,9 @@ export default {
console.error(error, 'error')
})
},
handleClear() {
this.data.prefix = '';
},
toggleDrop(e) {
this.$refs.dropDomain.toggleDropdown(e)
},

77
src/components/site/addSiteStep/step1.vue

@ -23,16 +23,19 @@
<div class="flex-right">
<GuipFormItem column="column" class="mb24">
<div slot="formLeft">域名来源</div>
<GuipRadio slot="formDom" v-model="formData.domain_type" :options="formData.domain_types" prop="domain" :rules="formRules.domain"
@change="radioDomainChange" />
<GuipRadio slot="formDom" v-model="formData.domain_type" :options="formData.domain_types" prop="domain"/>
</GuipFormItem>
<GuipFormItem column="column">
<GuipFormItem column="column" v-if="formData.domain_type==='1'">
<div slot="formLeft">域名设置</div>
<GuipInput v-show="formData.domain_type==='1'" slot="formDom" v-model="formData.domain_prefix" class="w540">
<i slot="suffix" class="el-icon-close" @click="handleClear"></i>
<span slot="appendshow">{{formData.domain_name}}</span>
<GuipInput slot="formDom" ref="GuipInput" prop="domain_prefix" placeholder="仅支持数字、字母"
v-model="formData.domain_prefix" :rules="formRules.domain_prefix" class="w540">
<i slot="suffix" v-if="formData.domain_prefix" class="el-icon-close" @click="handleClear"></i>
<span slot="appendshow">{{formData.plat_domain}}</span>
</GuipInput>
<domainBind v-show="formData.domain_type==='2'" slot="formDom" :defaultPrefix="formData.domain_prefix" :defaultDomain="formData.domain_name" @handleEvent="handleChangeDomain" />
</GuipFormItem>
<GuipFormItem column="column" v-if="formData.domain_type==='2'">
<div slot="formLeft">域名设置</div>
<domainBind ref="domainBind" slot="formDom" :defaultPrefix="formData.domain_prefix" :defaultDomain="formData.domain_name" @handleEvent="handleChangeDomain" />
</GuipFormItem>
</div>
</div>
@ -142,9 +145,15 @@ export default {
},
computed: {
submitData() {
let domain = "";
if (this.formData.domain_type === '1') {
domain = this.formData.domain_prefix + this.formData.plat_domain
} else if (this.formData.domain_type === '2') {
domain = this.formData.domain_prefix + this.formData.domain_name
}
return {
short_name: this.formData.short_name,
domain: this.formData.domain_prefix + this.formData.domain_name,
domain: domain,
sale_channel: this.formData.sale_channel,
site_type: this.formData.site_type,
site_tpl: this.formData.site_tpl,
@ -163,6 +172,7 @@ export default {
return true;
}
console.log(this.siteInfo)
this.getAddInfo()
},
methods:{
@ -172,19 +182,12 @@ export default {
this.formData.site_tpl = siteTplInfo.site_tpl
this.formData.site_tpl_name = siteTplInfo.site_tpl_name
this.formData.picture = siteTplInfo.picture
localStorage.removeItem('site_tpl_info')
}
const ico = await db.get('ico')
if(ico){
this.formData.site_tpl_ico = ico
await db.remove('ico')
}
if(ico) this.formData.site_tpl_ico = ico
const logo = await db.get('logo')
if(logo){
this.formData.site_tpl_logo = logo
await db.remove('logo')
}
if(logo) this.formData.site_tpl_logo = logo
},
getAddInfo() {
const that = this
@ -197,7 +200,6 @@ export default {
that.formData.domain_type = String(addInfo.domain_type)
that.formData.domain_types = addInfo.domain_types
that.formData.plat_domain = addInfo.plat_domain
that.formData.domain_name = addInfo.plat_domain
that.formData.site_type = String(addInfo.site_type)
that.formData.site_types = addInfo.site_types
@ -218,12 +220,9 @@ export default {
that.formData.picture = that.siteInfo.picture
that.formData.not_finished_uid = that.siteInfo.uid
//
if(that.siteInfo.domain){
that.formData.domain_type = String(that.siteInfo.domain_type)
that.formData.domain_prefix = that.siteInfo.domain_prefix;
that.formData.domain_name = that.siteInfo.domain_name;
}
})
}
return true
@ -238,9 +237,6 @@ export default {
const value = this.formData.sale_channel;
this.formData.sale_channel_label = labels && labels[value] ? labels[value] : '';
},
radioDomainChange(){
this.formData.domain_name = this.formData.domain_type === '1' ? this.formData.plat_domain : ''
},
radioTypeChange(){
if(this.formData.site_type){
this.formData.site_tpl = this.formData.site_type_tpl[this.formData.site_type].site_tpl
@ -264,15 +260,33 @@ export default {
return false;
}
localStorage.setItem('formData', JSON.stringify(this.formData))
if(this.formData.not_finished_uid){
this.$router.push(`/agent/siteTemplate?uid=${this.formData.not_finished_uid}`)
}else{
this.$router.push(`/agent/siteTemplate?site_type=${this.formData.site_type}`)
}
},
saveConfirm() {
const that = this
let formValid = false;
that.$refs.formRef.validate((valid) => {
if (valid) {
const that = this
that.$http('POST', '/agentnew/ajax_add_new_site', that.submitData).then(response => {
formValid = valid
});
let domainValid = false;
if(that.formData.domain_type === '2'){
that.$refs.domainBind.$refs.bindFormRef.validate(valid => {
domainValid = valid
})
}else{
domainValid = true
}
if (formValid && domainValid) {
that.$http('POST', '/agentnew/ajax_add_new_site', that.submitData).then(async response => {
if(response.status && response.data.uid){
await that.deleteSiteTplData()
that.formData.uid = response.data.uid
that.$emit('handelSiteInfo', that.formData)
@ -289,7 +303,12 @@ export default {
console.error(error, 'error')
})
}
});
},
async deleteSiteTplData(){
localStorage.removeItem('activeStep')
localStorage.removeItem('site_tpl_info')
await db.remove('ico')
await db.remove('logo')
},
}
}
@ -357,7 +376,7 @@ export default {
}
.channel-radio .el-radio{
min-width: 120px;
margin-bottom: 12px;
line-height: 16px;
}
}
</style>

19
src/components/site/addSiteStep/step3.vue

@ -31,9 +31,9 @@
<div style="text-align: center">
<div class="flex">
<GuipInput ref="GuipInput" width="133px" v-model="row.price" label="售价" placeholder="请输入售价" :unit="row.price_unit"></GuipInput>
<template v-if="row.price_unit_num>1">
<template v-if="row.freedom_set || row.supply_unit_num>1">
<span class="shortspan">/</span>
<GuipInput ref="GuipInput" width="133px" v-model="row.price_unit_num" unit="字符">
<GuipInput ref="GuipInput" width="133px" v-model="row.unit_num" :unit="row.unit_name" @input="inputPrice(row)">
</GuipInput>
</template>
</div>
@ -313,6 +313,17 @@ export default {
item.removeAttribute('aria-hidden')
})
},
inputPrice(row){
if(row.freedom_set){
if(row.unit_num == 1) {
row.unit_name = '篇';
}else{
row.unit_name = '字符';
}
}else{
row.unit_name = row.supply_unit_name;
}
},
//
saveEdit(row, type) {
row[type + 'PopoverVisible'] = false; //
@ -335,7 +346,7 @@ export default {
let obj = {}
obj.uid = this.siteInfo.uid
obj.type = row.type
obj.unit_num = row.price_unit_num
obj.unit_num = row.unit_num
if(row.price_unit == '元'){
obj.unit_price = row.price
}else{
@ -343,7 +354,7 @@ export default {
}
const res = await this.saveRequest('/agentnew/ajax_set_service_price', obj)
if(res) row.price_desc = getServicePriceDesc(row.price, row.price_unit, row.price_unit_num);
if(res) row.price_desc = getServicePriceDesc(row.price, row.price_unit, row.unit_num, row.unit_name);
},
async onSwitchChange(row){
let obj = {}

17
src/components/site/serviceSetting/menuColorSet.vue

@ -34,7 +34,7 @@
<GuipFormItem column="column" label="主题颜色">
<span class="desc" slot="formRight"> 按钮及提示文字颜色</span>
<div class="flex gap12" slot="formDom">
<el-color-picker popper-class="color-drop" v-model="themeColor"></el-color-picker>
<el-color-picker class="color-drop" popper-class="color-drop" v-model="themeColor"></el-color-picker>
<GuipInput ref="GuipInput" style="flex:1" v-model="themeColor" placeholder="请输入主题颜色"
@change="changeThemeColor">
</GuipInput>
@ -43,7 +43,7 @@
<GuipFormItem column="column" class="mt24" label="选中颜色">
<span class="desc" slot="formRight"> 分页导航栏选中色</span>
<div class="flex gap12" slot="formDom">
<el-color-picker popper-class="color-drop" v-model="tabColor"></el-color-picker>
<el-color-picker class="color-drop" popper-class="color-drop" v-model="tabColor"></el-color-picker>
<GuipInput ref="GuipInput" style="flex:1" v-model="tabColor" placeholder="请输入选中颜色"
@change="changetabColor">
</GuipInput>
@ -52,7 +52,7 @@
<GuipFormItem column="column" class="mt24" label="导航栏色">
<span class="desc" slot="formRight"> logo处导航栏背景色</span>
<div class="flex gap12" slot="formDom">
<el-color-picker popper-class="color-drop" v-model="navColor"></el-color-picker>
<el-color-picker class="color-drop" popper-class="color-drop" v-model="navColor"></el-color-picker>
<GuipInput ref="GuipInput" style="flex:1" v-model="navColor" placeholder="请输入导航栏色"
@change="changeNavColor">
</GuipInput>
@ -196,13 +196,18 @@ export default {
}
</script>
<style lang="scss">
.color-drop .el-color-dropdown__btns{
.color-drop {
.el-color-dropdown__btns{
display: flex;
justify-content: space-between;
}
.color-drop .el-button {
.el-button {
width: 70px;
height: 30px;
}
.el-icon-close:before{
content: "";
}
}
</style>

6
src/utils/common.js

@ -8,11 +8,11 @@ export function setHighActive(dom) {
},1000)
}
export function getServicePriceDesc(price, price_unit, unit_num) {
export function getServicePriceDesc(price, price_unit, unit_num, unit_name) {
let unit = 0;
let unit_str = "";
if (unit_num == 1) return price + price_unit +'/';
if (unit_num == 1) return price + price_unit +'/'+unit_name;
if (unit_num/10000 < 10) {
unit = Math.ceil(unit_num/10000);
@ -27,6 +27,6 @@ export function getServicePriceDesc(price, price_unit, unit_num) {
unit_str = unit == 1 ? '百' : unit+'百';
}
return price + price_unit + "/" +unit_str + "字符";
return price + price_unit + "/" +unit_str + unit_name;
}

13
src/views/agent/siteAdd.vue

@ -51,7 +51,7 @@
<!-- 参数 在子组件页面一样用 props接收 ref绑定的组件示例 -->
<!-- 默认页面展示 的初始组件 Franchise-->
<component :is="process" :siteInfo="siteInfo" ref="dynamicComponent" @handelSiteInfo="handelSiteInfo" @handelStep="handelStep"/>
<component :is="process" :key="stepKey" :siteInfo="siteInfo" ref="dynamicComponent" @handelSiteInfo="handelSiteInfo" @handelStep="handelStep"/>
</div>
</template>
<script>
@ -73,6 +73,7 @@ export default {
return {
siteInfo:{},
showAlert:true,
stepKey: Date.now(),
activeStep: '1',//
process: '', //
prodid: '',//
@ -102,13 +103,20 @@ export default {
methods: {
getNotFinishedSite() {
const that = this
that.payList = []
this.$http('POST', '/agentnew/ajax_get_not_finished_site', {}).then(response => {
if(response.status){
that.$nextTick(() => {
const unsiteInfo = response.data
if(Object.keys(unsiteInfo).length>0){
that.siteInfo = unsiteInfo
that.stepKey = Date.now();
const step = localStorage.getItem('activeStep')
if(step){
that.activeStep = step
return true
}
if(that.siteInfo.open_process === '3'){
if(that.siteInfo.sale_channel === '2'){
that.activeStep = 3 //
@ -137,6 +145,7 @@ export default {
goCurActiveStep(step) {
if (step < this.activeStep) {
this.activeStep = step
localStorage.setItem('activeStep', step)
}
},
renderStepDesc(step) {

19
src/views/agent/siteServiceList.vue

@ -40,9 +40,9 @@
<div style="text-align: center">
<div class="flex">
<GuipInput ref="GuipInput" width="133px" v-model="row.price" label="售价" placeholder="请输入售价" :unit="row.price_unit"></GuipInput>
<template v-if="row.price_unit_num>1">
<template v-if="row.freedom_set || row.supply_unit_num>1">
<span class="shortspan">/</span>
<GuipInput ref="GuipInput" width="133px" v-model="row.price_unit_num" unit="字符">
<GuipInput ref="GuipInput" width="133px" v-model="row.unit_num" :unit="row.unit_name" @input="inputPrice(row)">
</GuipInput>
</template>
</div>
@ -362,6 +362,17 @@ export default {
item.removeAttribute('aria-hidden')
})
},
inputPrice(row){
if(row.freedom_set){
if(row.unit_num == 1) {
row.unit_name = '篇';
}else{
row.unit_name = '字符';
}
}else{
row.unit_name = row.supply_unit_name;
}
},
//
saveEdit(row, type) {
row[type + 'PopoverVisible'] = false; //
@ -388,7 +399,7 @@ export default {
let obj = {}
obj.uid = this.uid
obj.type = row.type
obj.unit_num = row.price_unit_num
obj.unit_num = row.unit_num
if(row.price_unit == '元'){
obj.unit_price = row.price
}else{
@ -396,7 +407,7 @@ export default {
}
const res = await this.saveRequest('/agentnew/ajax_set_service_price', obj)
if(res) row.price_desc = getServicePriceDesc(row.price, row.price_unit, row.price_unit_num);
if(res) row.price_desc = getServicePriceDesc(row.price, row.price_unit, row.unit_num, row.unit_name);
},
async onSwitchChange(row){
let obj = {}

24
src/views/agent/siteTemplate.vue

@ -157,6 +157,16 @@ export default {
this.$router.push('/')
return false;
}
//
const siteTplInfo = JSON.parse(localStorage.getItem('site_tpl_info'))
if(!this.$route.query.uid && siteTplInfo) {
this.tpl_id = siteTplInfo.site_tpl
this.pictureUrl = siteTplInfo.picture
this.previewUrl = siteTplInfo.preview
this.previewLogo = siteTplInfo.previewLogo
this.previewIco = siteTplInfo.previewIco
}
this.get_site_tpl_list();
},
methods: {
@ -169,14 +179,16 @@ export default {
this.$http('POST', '/agentnew/ajax_get_site_tpl_list', obj).then(response => {
if(response.status) {
this.$nextTick(() => {
if(!this.tpl_id) {
this.tpl_id = response.data.tpl_data.tpl_id
this.pictureUrl = response.data.tpl_data.picture
this.previewUrl = response.data.tpl_data.thumbnail
this.tpl_customize = response.data.tpl_data.tpl_customize
this.is_public_tpl = response.data.tpl_data.is_public_tpl
this.priv_down_url = response.data.tpl_data.priv_down_url
this.previewLogo = response.data.tpl_data.site_tpl_logo
this.previewIco = response.data.tpl_data.site_tpl_ico
this.tpl_customize = response.data.tpl_data.tpl_customize
this.priv_down_url = response.data.tpl_data.priv_down_url
}
this.is_public_tpl = response.data.tpl_data.is_public_tpl
this.templeteList = [...response.data.list]
})
@ -200,6 +212,9 @@ export default {
site_tpl: this.tpl_id,
site_tpl_name: this.tpl_name,
picture: this.pictureUrl,
preview: this.previewUrl,
previewLogo: this.previewLogo,
previewIco: this.previewIco,
}
localStorage.setItem('site_tpl_info', JSON.stringify(site_tpl_info))
this.$router.go(-1)
@ -211,9 +226,10 @@ export default {
this.formData.set('is_public_tpl', this.is_public_tpl)
this.$http('POST', '/agentnew/ajax_update_site_tpl', this.formData).then(response => {
if(response.status){
this.$Message.success(response.info)
this.$router.go(-1)
return true
}
this.$Message.error(response.info)
}).catch(error => {
console.error(error, 'error')
})

Loading…
Cancel
Save