Commit 3176d2a3 by Jings

add: 页面添加

parent 9e9115f8
<!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2019-03-20 14:36:37
* @LastEditors: Drama
* @LastEditTime: 2022-09-14 11:21:41
-->
<template>
<div class="app-detail-wrap">
<!-- <div class="app-detail-pane border-box p-20">
<div class="m-b-20">
<span class="font-14 p-r-10">商品展示:</span>
<el-checkbox v-model="myCustomData.salesGoodsFlag">已上架商品</el-checkbox><el-checkbox v-model="myCustomData.notSalesGoodsFlag">未上架商品</el-checkbox>
</div>
<div><el-switch v-model="myCustomData.showPriceFlag"></el-switch><span class="font-14 color-303133 p-l-10">商品详情屏蔽价格</span><span class="font-12 color-909399 p-l-10">注:开启后,商品列表及商品详情中会屏蔽价格字段。关闭后显示价格。</span></div>
<div class="m-t-46">
<el-button v-if="$getButtonLimit($buttonCode.saveGoodsSet)" :limit-code="$buttonCode.saveGoodsSet" type="primary" :loading="loading" @click="submit('searchFlag')" :disabled="$store.state.wxEnterpriseType">保 存</el-button>
</div>
</div> -->
<div class="p-l-40 border-box p-t-30">
<el-form v-model="myCustomData" label-width="130px">
<el-form-item label="商品展示"><el-checkbox v-model="myCustomData.salesGoodsFlag">已上架商品</el-checkbox><el-checkbox v-model="myCustomData.notSalesGoodsFlag">未上架商品</el-checkbox></el-form-item>
<el-form-item label="商品详情价格" prop="showPriceFlag">
<div class="setting-radio-item">
<el-radio v-model="myCustomData.showPriceFlag" :label="false">屏蔽</el-radio>
<div class="set-tip-txt">商品列表及商品详情中不显示价格字段</div>
</div>
<div class="setting-radio-item">
<el-radio v-model="myCustomData.showPriceFlag" :label="true">不屏蔽</el-radio>
<div class="set-tip-txt">商品列表及商品详情中显示价格字段</div>
</div>
</el-form-item>
<!-- TODO: 字段确定 -->
<el-form-item label="商品品类名称" prop="test">
<div class="setting-radio-item m-b-30">
<el-radio v-model="myCustomData.test" label="1">一级品类名称</el-radio>
<div v-show="myCustomData.test == 1" class="tip-fixed">好办小程序 [客户详情] - [消费记录]的消费衣橱商品将按照此设置划分</div>
</div>
<div class="setting-radio-item m-b-30">
<el-radio v-model="myCustomData.test" label="2">二级品类名称</el-radio>
<div v-show="myCustomData.test == 2" class="tip-fixed">好办小程序 [客户详情] - [消费记录]的消费衣橱商品将按照此设置划分</div>
</div>
<div class="setting-radio-item m-b-30">
<el-radio v-model="myCustomData.test" label="3">三级品类名称</el-radio>
<div v-show="myCustomData.test == 3" class="tip-fixed">好办小程序 [客户详情] - [消费记录]的消费衣橱商品将按照此设置划分</div>
</div>
</el-form-item>
</el-form>
</div>
<!-- TODO: save按钮 -->
<div class="fixed-save-btn border-box" v-if="$getButtonLimit($buttonCode.saveGoodsSet)">
<el-button :limit-code="$buttonCode.saveGoodsSet" type="primary" :loading="loading" @click="submit('searchFlag')" :disabled="$store.state.wxEnterpriseType">保存</el-button>
</div>
</div>
</template>
<script>
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
import { _debounce } from '@/common/js/public';
import { postRequest } from '@/api/api';
export default {
name: 'app-detail',
props: {
brandId: {
type: String,
default() {
return '';
}
}
},
data() {
return {
projectName: '', // 当前项目名
wxEnterpriseRelatedId: sessionStorage.getItem('userInfos') ? JSON.parse(sessionStorage.getItem('userInfos')).wxEnterpriseId : '',
myCustomData: {
salesGoodsFlag: false,
notSalesGoodsFlag: false,
showPriceFlag: false,
test: '1'
},
activeId: '1',
loading: false
};
},
methods: {
/**
* 保存
*/
submit: _debounce(function(type) {
const that = this;
that.loading = true;
that.setData(type);
}, 500),
/**
* 保存-API
*/
setData(type) {
const that = this;
let para = {
enterpriseId: that.brandId,
// wxEnterpriseRelatedId: that.wxEnterpriseRelatedId,
salesGoodsFlag: that.myCustomData.salesGoodsFlag ? 1 : '0',
notSalesGoodsFlag: that.myCustomData.notSalesGoodsFlag ? 1 : '0',
showPriceFlag: that.myCustomData.showPriceFlag ? 1 : '0'
};
console.log(para, 'para---');
const url = '/haoban-app-aggregation-web/save-goods-setting';
postRequest(url, para)
.then(res => {
let resData = res.data;
that.loading = false;
that.getCustomerSet();
if (resData.errorCode == 1) {
showMsg.showmsg('保存成功', 'success');
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.loading = false;
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 获取数据
*/
getCustomerSet(brandId) {
const that = this;
let para = {
enterpriseId: that.brandId,
wxEnterpriseRelatedId: that.wxEnterpriseRelatedId
};
postRequest('/haoban-app-aggregation-web/find-goods-setting', para)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
if (!!resData.result) {
that.myCustomData.salesGoodsFlag = resData.result.salesGoodsFlag == 1 ? true : false;
that.myCustomData.notSalesGoodsFlag = resData.result.notSalesGoodsFlag == 1 ? true : false;
that.myCustomData.showPriceFlag = resData.result.showPriceFlag == 1 ? true : false;
}
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
}
},
watch: {
brandId: function(newData, oldData) {
const that = this;
if (newData) {
that.getCustomerSet(that.brandId);
}
}
},
mounted() {
const that = this;
if (that.brandId) {
that.getCustomerSet(that.brandId);
}
},
components: {}
};
</script>
<style lang="scss" scoped>
.w-500 {
width: 500px;
}
.w-195 {
width: 195px;
}
.color-1890ff {
color: #2f54eb;
}
.p-20 {
padding: 20px;
}
.p-l-38 {
padding-left: 38px;
}
.p-l-199 {
padding-left: 199px;
}
.p-t-30 {
padding-top: 30px;
}
.m-b-30 {
margin-bottom: 30px;
}
.damolish .el-form-item {
margin-bottom: 30px;
}
.damolish .el-button {
padding: 8px 26px;
}
.app-detail-wrap {
height: 100%;
background: #fff;
.el-tabs {
background: #fff;
>>> .el-tabs__nav-wrap {
/* height: 48px;
line-height: 48px; */
&::after {
height: 1px;
}
/* .el-tabs__nav-scroll {
padding-left: 20px;
} */
}
}
.condition-tip {
width: 740px;
.el-alert--info {
background: #e6f7ff;
border: 1px solid rgba(145, 213, 255, 1);
.el-alert__icon {
font-size: 12px;
}
}
}
.setting-radio-item {
position: relative;
& + .setting-radio-item {
margin-top: 15px;
}
.set-tip-txt,
.tip-fixed {
padding: 0 0 0 25px;
font-size: 12px;
font-weight: 400;
color: #909399;
line-height: 15px;
}
.tip-fixed {
position: absolute;
top: 10;
}
}
.fixed-save-btn {
position: fixed;
display: flex;
-webkit-box-pack: center;
-webkit-box-align: center;
align-items: center;
justify-content: center;
bottom: 0;
width: calc(100% - 206px);
height: 56px;
background: #ffffff;
box-shadow: 1px -2px 8px 0px rgba(220, 223, 230, 0.6);
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment