| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-rich-text');
- ComponentHelper::loadComponentView('com-dialog-select');
- ComponentHelper::loadComponentView('com-qq-map');
- ?>
- <div id="app" v-cloak>
- <el-card v-loading="loading" style="border:0" shadow="never" body-style="background-color: #f3f3f3;padding: 0 0;">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="基础信息" name="basic_setting">
- <?php ComponentHelper::loadComponentView('detail-basic', __DIR__ . '/');
- ?>
- </el-tab-pane>
- <el-tab-pane label="商户设置" name="store_setting" class="cashier-tabs">
- <?php ComponentHelper::loadComponentView('detail-store', __DIR__ . '/'); ?>
- </el-tab-pane>
- </el-tabs>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- var validatePass = (rule, value, callback) => {
- if (value === '') {
- callback(new Error('两次输入密码不一致'));
- } else if (value !== this.storeForm.password) {
- callback(new Error('两次输入密码不一致!'));
- } else {
- callback();
- }
- };
- var validateTime = (rule, value, callback) => {
- if (!this.times.length && this.storeForm.shop_status == 1) {
- callback(new Error('请设置营业时间'));
- } else {
- callback();
- }
- };
- var validateStoreServiceRatio = (rule, value, callback) => {
- console.log(value, 'jsldsl');
- if (this.storeForm.store_service_fee == 1 && value <= 0) {
- callback(new Error('请填写服务费收取比例'));
- } else {
- callback();
- }
- };
- return {
- mch_id: 0,
- loading: false,
- switchStoreLoading: false,
- submitLoading: false,
- activeName: 'basic_setting',
- times: null,
- basicForm: {
- goods_auth: 0,
- service_fee: 0,
- settle_type: 0,
- platform_ratio: 0,
- risk_management: 0,
- risk_management_ratio: 0,
- settle_scene: 1,
- store_distribution_status: 0,
- store_agent_status: 0,
- store_area_status: 0,
- store_boss_status: 0,
- customer_service: {
- web_service_url: ''
- },
- },
- storeForm: {
- shop_status: 1,
- store_background: '',
- username: '',
- password: '',
- repassword: '',
- individual_fee_setting: 0,
- store_service_fee: 0,
- store_service_ratio: 0,
- store_settle_type: 1,
- store_settle_scene: 2,
- store_commission_authority: {
- distribution: 0,
- agent: 0,
- area: 0,
- boss: 0,
- },
- business_time_start: '',
- business_time_end: '',
- is_balance_cash_service_fee: 0,
- balance_cash_service_fee: '',
- },
- cashierForm: {
- is_distribution_enable: 1,
- is_agent_enable: 1,
- service_fee_ratio: 0,
- member_status: 0,
- members: [{
- level: 0,
- level_name: '默认等级',
- discount: 0
- }],
- is_distribution: 0,
- deepNames: ['一级分销', '二级分销'],
- distribution_settings: [{
- level: 0,
- level_name: '默认等级',
- name: '佣金',
- commission_rate: [10, 15]
- }, ],
- is_agent: 0,
- agent_settings: {
- team_rewards: [{
- level: 0,
- level_name: '默认等级',
- commission_rate: 0
- }, ],
- equal_rewards: [{
- level: 0,
- level_name: '默认等级',
- commission_rate: 0
- }, ],
- over_rewards: [{
- level: 0,
- level_name: '默认等级',
- commission_rate: 0
- }, ],
- },
- },
- categorys: [],
- basicFormRules: {},
- storeRules: {
- shop_status: [{
- required: true,
- message: '请设置营业状态',
- trigger: 'blur'
- }],
- range_time: [{
- required: true,
- validator: validateTime,
- trigger: 'blur'
- }],
- store_service_fee: [{
- required: true,
- message: '请设置是否收取服务器',
- trigger: 'blur'
- }],
- store_service_ratio: [{
- validator: validateStoreServiceRatio,
- trigger: 'blur'
- }],
- store_settle_type: [{
- required: true,
- message: '请选择计算方式',
- trigger: 'blur'
- }],
- store_settle_scene: [{
- required: true,
- message: '请选择结算方式',
- trigger: 'blur'
- }],
- repassword: [{
- validator: validatePass,
- trigger: 'blur'
- }],
- },
- cashierFormRules: {},
- statisticsData: { // 基础信息数据统计对象
- 'total_money': '累计收入',
- 'balance': '当前余额',
- 'total_expenses': '累计支出',
- 'unsettled_amount': '累计提现',
- 'user_nums': '门店会员数',
- 'good_counts': '商品数',
- 'total_order_number': '订单支付数',
- 'total_order_money': '订单支付金额',
- 'total_settled_amount': '结算佣金'
- },
- isDisable: false, // 是否禁用门店
- baseDialogVisible: false,
- shareDialogVisible: false,
- serviceDialogVisible: false,
- form: {
- name: '',
- region: '',
- date1: '',
- date2: '',
- delivery: false,
- type: [],
- resource: '',
- desc: ''
- },
- captcha: '发送验证码',
- address: '',
- latitude: 0,
- longitude: 0,
- expireDate: null,
- editExpireTime: false,
- };
- },
- mounted: function() {
- this.mch_id = getQuery('mch_id');
- this.loadData();
- },
- methods: {
- mapEvent(e) {
- console.log(e, '----')
- this.basicForm.address = e.address;
- this.basicForm.latitude = e.lat;
- this.basicForm.longitude = e.long;
- this.$forceUpdate();
- },
- storeSwitch() { // 启用/禁用门店
- let self = this;
- self.switchStoreLoading = true;
- let status = null;
- if (self.isDisable) {
- status = 1;
- } else {
- status = 3;
- }
- request({
- params: {
- r: 'mch/store/switch-status',
- },
- method: 'post',
- data: {
- mch_id: self.mch_id,
- status: status,
- }
- }).then(e => {
- self.switchStoreLoading = false;
- if (e.data.code == 0) {
- self.isDisable = !self.isDisable;
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.switchStoreLoading = false;
- console.log(e);
- self.$message.error('网络错误');
- return false;
- });
- },
- storeEdit(name) { // 编辑
- this[name] = true;
- },
- storeDetailSelectedImg(e, key) { // 选中图片
- console.log(e, 'upload----')
- this.basicForm[key] = e[0].url;
- },
- // 删除图片
- storeDetailDeletePic(key) {
- this.basicForm[key] = '';
- },
- // sendCode() { // 发送验证码
- // this.captcha = 60
- // this.countDown()
- // },
- // // 倒计时
- // countDown() {
- // var timer = setInterval(() => {
- // this.captcha--
- // if (this.captcha <= 0) {
- // clearInterval(timer)
- // this.captcha = '重新获取'
- // }
- // }, 1000)
- // },
- // 输入值过滤处理
- changeHandle(key) {
- try {
- this.flierValue(this.activeName, key);
- } catch (err) {
- this.$message.error(err);
- let tabs = this.activeName.split('_');
- let formName = tabs[0] + 'Form';
- if (this[formName][key] < 0) {
- this[formName][key] = Math.abs(this[formName][key]);
- } else if (this[formName][key] > 100) {
- this[formName][key] = 0;
- }
- return false;
- }
- },
- // 过滤和处理值
- flierValue(group, key) {
- // console.log(group, key);
- let configs = {
- store_service_ratio: {
- text: `服务费比例取值在 0~100 之间`,
- max: '100',
- min: '0',
- },
- // expired_days: {
- // text: '请填写门店有效天数',
- // min: '0',
- // },
- // service_fee_ratio: {
- // text: `服务费比例取值在 0~100 之间`,
- // max: '100',
- // min: '0',
- // },
- };
- let datas = {
- basic_setting: this.basicForm,
- cashier_setting: this.cashierForm,
- store_setting: this.storeForm,
- };
- let val = datas[group][key];
- if (configs[key]) {
- if (configs[key].max && val > parseInt(configs[key].max)) {
- throw new Error(configs[key].text);
- }
- if (configs[key].min && val < parseInt(configs[key].min)) {
- throw new Error(configs[key].text);
- }
- }
- },
- loadData() {
- let self = this;
- // this.loading = true;
- request({
- params: {
- r: 'mch/store/detail',
- mch_id: self.mch_id,
- },
- method: 'get'
- }).then(e => {
- console.log('LLLLLLL: ', e);
- self.loading = false;
- if (e.data.code === 0) {
- self.categorys = e.data.data.categorys;
- if (e.data.data.basic_setting) {
- self.basicForm = e.data.data.basic_setting;
- if (1 == e.data.data.basic_setting.status) {
- this.isDisable = false;
- } else {
- this.isDisable = true;
- }
- }
- if (e.data.data.store_setting) {
- self.storeForm = e.data.data.store_setting;
- self.times = [e.data.data.store_setting.business_time_start, e.data.data.store_setting.business_time_end];
- }
- if (e.data.data.cashier_setting) {
- self.cashierForm = e.data.data.cashier_setting;
- }
- console.log(self.times);
- console.log('self.storeForm: ', self.storeForm);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- // console.log(e);
- self.$message.error('网络错误');
- });
- },
- // 配置提交
- submit(formName) {
- // console.log('5555555555: ', formName, this.activeName, this.basicForm);return null;
- let self = this;
- let keys = [];
- if ('basic_setting' == self.activeName) {
- keys = [];
- } else if ('cashier_setting' == self.activeName) {
- keys = ['service_fee_ratio'];
- // 会员等级折扣验证
- if (1 == self.cashierForm.member_status) {
- let memberForNum = self.cashierForm.members.length;
- for (let i = 0; i < memberForNum; i++) {
- let discount_val = self.cashierForm.members[i].discount;
- if (discount_val < 0 || discount_val > 100) {
- self.$message.error('会员折扣比例取值在 0~100 之间');
- return false;
- }
- }
- }
- // 分销佣金比例验证
- if (1 == self.cashierForm.is_distribution && 1 == self.cashierForm.is_distribution_enable) {
- let forNum = self.cashierForm.distribution_settings.length;
- for (let i = 0; i < forNum; i++) {
- let val = self.cashierForm.distribution_settings[i].commission_rate;
- let valForNum = val.length;
- for (let i = 0; i < valForNum; i++) {
- if (val[i] < 0 || val[i] > 100) {
- self.$message.error('分销佣金比例取值在 0~100 之间');
- return false;
- }
- }
- }
- }
- // 经销佣金比例验证
- if (1 == self.cashierForm.is_agent && 1 == self.cashierForm.is_agent_enable) {
- for (key in self.cashierForm.agent_settings) {
- let settings = self.cashierForm.agent_settings[key];
- let forNum = settings.length;
- for (let i = 0; i < forNum; i++) {
- let val = settings[i].commission_rate;
- if (val < 0 || val > 100) {
- self.$message.error('经销佣金比例取值在 0~100 之间');
- return false;
- }
- }
- }
- }
- } else if ('store_setting' == self.activeName) {
- keys = ['store_service_ratio'];
- if (self.storeForm.password && self.storeForm.password != self.storeForm.repassword) {
- self.$message.error('两次输入密码不一致');
- return false;
- }
- }
- let forNum = keys.length;
- for (let i = 0; i < forNum; i++) {
- try {
- self.flierValue(self.activeName, keys[i]);
- } catch (err) {
- self.$message.error(err);
- return false;
- }
- }
- self.$refs[formName].validate(valid => {
- if (valid) {
- self.submitLoading = true;
- let activeName = self.activeName;
- let formData = {};
- formData[activeName] = self[formName];
- formData.group = activeName;
- formData.mch_id = this.mch_id;
- // console.log(formData);return null;
- request({
- params: {
- r: 'mch/store/detail',
- },
- method: 'post',
- data: formData,
- }).then(e => {
- self.submitLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- } else {
- self.$message.error(e.data.msg);
- return false;
- }
- }).catch(e => {
- self.submitLoading = false;
- console.log(e);
- self.$message.error('网络错误');
- return false;
- });
- } else {
- self.$message.error('参数验证未通过');
- return false;
- }
- });
- },
- handleClick(tab, event) {
- this.activeName = tab.name;
- },
- // 时间改变回调
- selectTime(e) {
- // console.log('kkkkkkk ==== : ', e, this.times);
- if (e) {
- this.storeForm.business_time_start = this.times[0];
- this.storeForm.business_time_end = this.times[1];
- } else {
- this.times = null;
- this.storeForm.business_time_start = '';
- this.storeForm.business_time_end = '';
- }
- },
- // 选择图片
- selectedImg(e, key) {
- // console.log('ddddd: ', e, key);
- this.storeForm[key] = e[0].url;
- this.$forceUpdate();
- },
- // 删除图片
- delPic(key) {
- this.storeForm[key] = '';
- this.$forceUpdate();
- },
- expireDateChange(e) {
- // console.log(e, '=============== ', this.basicForm.expire_time);
- this.basicForm.expire_time = Math.ceil(e / 1000) +86399;
- },
- },
- computed: {
- }
- });
- </script>
- <style>
- .grid-box {
- padding: 0 40px;
- background: #fff;
- border-radius: 0 0 4px 4px;
- }
- .grid-item {
- height: 130px;
- }
- .grid-text {
- font-size: 15px;
- }
- .grid-val {
- font-size: 20px;
- padding-top: 10px;
- }
- .grid-icon {
- color: #999;
- cursor: pointer;
- font-size: 18px;
- }
- .store-card {
- margin-top: 15px;
- }
- .store-card.el-card {
- border: 0;
- }
- .store-card-body .store-name {
- padding-left: 10px;
- }
- .store-card-body .el-descriptions__body {
- padding: 20px 40px;
- }
- .store-send-code {
- padding-left: 10px;
- font-size: 12px;
- cursor: pointer;
- }
- .el-tabs__header {
- padding: 0 20px;
- height: 56px;
- line-height: 56px;
- background-color: #fff;
- margin-bottom: 0;
- }
- .title {
- padding: 0px 8px;
- border-left: 5px solid #1479F0;
- background-color: #fff;
- font-size: 18px;
- position: relative;
- left: 32px;
- margin: 20px 0;
- }
- .form-body {
- background-color: #fff;
- padding: 20px 50% 20px 0;
- }
- .button-item {
- padding: 9px 25px;
- margin-bottom: 15px;
- }
- .form-body .item {
- width: 300px;
- margin-bottom: 50px;
- margin-right: 25px;
- }
- .item-img {
- height: 550px;
- padding: 25px 10px;
- border-radius: 30px;
- border: 1px solid #CCCCCC;
- background-color: #fff;
- }
- .item .el-form-item {
- width: 300px;
- margin: 20px auto;
- }
- .left-setting-menu {
- width: 260px;
- }
- .left-setting-menu .el-form-item {
- height: 60px;
- padding-left: 20px;
- display: flex;
- align-items: center;
- margin-bottom: 0;
- cursor: pointer;
- }
- .left-setting-menu .el-form-item .el-form-item__label {
- cursor: pointer;
- }
- .left-setting-menu .el-form-item.active {
- background-color: #F3F5F6;
- border-top-left-radius: 10px;
- width: 105%;
- border-bottom-left-radius: 10px;
- }
- .left-setting-menu .el-form-item .el-form-item__content {
- margin-left: 0 !important
- }
- .no-radius {
- border-top-left-radius: 0 !important;
- }
- .reset {
- position: absolute;
- top: 3px;
- left: 90px;
- }
- .app-tip {
- position: absolute;
- right: 24px;
- top: 16px;
- height: 72px;
- line-height: 72px;
- max-width: calc(100% - 78px);
- }
- .app-tip:before {
- content: ' ';
- width: 0;
- height: 0;
- border-color: inherit;
- position: absolute;
- top: -32px;
- right: 100px;
- border-width: 16px;
- border-style: solid;
- }
- .tip-content {
- display: block;
- white-space: nowrap;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- margin: 0 28px;
- font-size: 28px;
- }
- .btn-abs {
- position: absolute;
- top: 12px;
- right: 18px;
- }
- .form-body .app-share {
- padding-top: 12px;
- border-top: 1px solid #e2e2e2;
- margin-top: -20px;
- }
- .form-body .app-share .app-share-bg {
- position: relative;
- width: 310px;
- height: 360px;
- background-repeat: no-repeat;
- background-size: contain;
- background-position: center
- }
- .form-body .app-share .app-share-bg .title {
- width: 160px;
- height: 29px;
- line-height: 1;
- word-break: break-all;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- .form-body .app-share .app-share-bg .pic-image {
- background-repeat: no-repeat;
- background-position: 0 0;
- background-size: cover;
- width: 160px;
- height: 130px;
- }
- .cashier-tabs .el-tabs__header {
- padding: 0;
- height: 45px;
- line-height: 45px;
- /* background-color: #F5F7FA; */
- margin-bottom: 0;
- }
- .cashier-tabs .el-tabs__item {
- height: 43px;
- line-height: 43px;
- }
- .cashier-tabs .el-tabs__content {
- margin-top: 20px;
- }
- .form-body {
- background-color: #fff;
- padding: 20px 50% 20px 0;
- }
- .button-item {
- margin-top: 12px;
- padding: 9px 25px;
- }
- .form-body .item {
- width: 300px;
- margin-bottom: 50px;
- margin-right: 25px;
- }
- .item-img {
- height: 550px;
- padding: 25px 10px;
- border-radius: 30px;
- border: 1px solid #CCCCCC;
- background-color: #fff;
- }
- .item .el-form-item {
- width: 300px;
- margin: 20px auto;
- }
- .left-setting-menu {
- width: 260px;
- }
- .left-setting-menu .el-form-item {
- height: 60px;
- padding-left: 20px;
- display: flex;
- align-items: center;
- margin-bottom: 0;
- cursor: pointer;
- }
- .left-setting-menu .el-form-item .el-form-item__label {
- cursor: pointer;
- }
- .left-setting-menu .el-form-item.active {
- background-color: #F3F5F6;
- border-top-left-radius: 10px;
- width: 105%;
- border-bottom-left-radius: 10px;
- }
- .left-setting-menu .el-form-item .el-form-item__content {
- margin-left: 0 !important
- }
- .no-radius {
- border-top-left-radius: 0 !important;
- }
- .del-btn {
- position: absolute;
- right: -8px;
- top: -8px;
- padding: 4px 4px;
- }
- .reset {
- position: absolute;
- top: 3px;
- left: 90px;
- }
- .app-tip {
- position: absolute;
- right: 24px;
- top: 16px;
- height: 72px;
- line-height: 72px;
- max-width: calc(100% - 78px);
- }
- .app-tip:before {
- content: ' ';
- width: 0;
- height: 0;
- border-color: inherit;
- position: absolute;
- top: -32px;
- right: 100px;
- border-width: 16px;
- border-style: solid;
- }
- .tip-content {
- display: block;
- white-space: nowrap;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- margin: 0 28px;
- font-size: 28px;
- }
- .add-image-btn {
- width: 100px;
- height: 100px;
- color: #419EFB;
- border: 1px solid #e2e2e2;
- cursor: pointer;
- }
- .addon-no-install {
- margin-top: 15px;
- margin-left: 40px;
- }
- .desc-container {
- padding: 20px;
- }
- .el-descriptions__body {
- color: #606266;
- background-color: #FFF;
- padding: 40px;
- }
- .el-descriptions__body .el-descriptions__table .el-descriptions-item__cell {
- line-height: 3;
- }
- .stat-item-label {
- font-size: 18px;
- line-height: 3;
- /* width: 38%; */
- }
- .stat-itme-content {
- font-size: 18px;
- line-height: 3;
- }
- .delele-img-btn {
- position: absolute;
- left: 64px;
- top: -13px;
- }
- </style>
|