| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-rich-text');
- ComponentHelper::loadComponentView('com-dialog-select');
- ?>
- <div id="app" v-cloak>
- <el-card class="box-card" v-loading="loading" shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div style="position: relative;">
- <template>
- <el-card>
- <el-form :model="ruleForm" size="small" ref="ruleForm" label-width="150px" id="settingForm">
- <el-row>
- <div style="display:flex;justify-content:space-between;">
- <el-col :span="24">
- <el-tabs v-model="activeName" type="card">
- <el-tab-pane label="基础设置" name="basic">
- <?php ComponentHelper::loadComponentView('basic', __DIR__ . '/'); ?>
- </el-tab-pane>
- <el-tab-pane label="充值设置" name="recharge">
- <?php ComponentHelper::loadComponentView('recharge', __DIR__ . '/'); ?>
- </el-tab-pane>
- <el-tab-pane label="模式设置" name="mode">
- <?php ComponentHelper::loadComponentView('mode', __DIR__ . '/'); ?>
- </el-tab-pane>
- <el-tab-pane label="提现设置" name="withdraw">
- <?php ComponentHelper::loadComponentView('withdraw', __DIR__ . '/'); ?>
- </el-tab-pane>
- <el-tab-pane label="协议" name="protocol">
- <?php ComponentHelper::loadComponentView('protocol', __DIR__ . '/'); ?>
- </el-tab-pane>
- <el-tab-pane label="营销设置" name="marketing">
- <?php ComponentHelper::loadComponentView('marketing', __DIR__ . '/'); ?>
- </el-tab-pane>
- <el-tab-pane label="收银台设置" name="cashier">
- <?php ComponentHelper::loadComponentView('cashier', __DIR__ . '/'); ?>
- </el-tab-pane>
- </el-tabs>
- </el-col>
- </div>
- <div style="position:absolute;right:0;top:0">
- <el-button :loading="btnLoading" class="button-item" type="primary" @click="store('ruleForm')" size="small">保存
- </el-button>
- </div>
- </el-row>
- </el-form>
- </el-card>
- </template>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- select_user_type: 1,
- activeCollapseNames: ['hei-go-setting', 'hi-bei-setting', 'hi-value-setting'],
- activeName: 'basic',
- // activeName: 'customize_text',
- loading: false,
- btnLoading: false,
- dialogTableVisible: false,
- dialogVisible: false,
- list: [],
- pagination: null, //分页数据
- selectItem: {}, //被选中的券
- confirmItem: {}, //确认选择该券
- page: 1,
- user_levels: [],
- levels: [],
- selectUser: '', //选中的用户
- searchForm: {
- inviter_id: '',
- keyword: '',
- },
- searchInfo: [],
- listLoading: false,
- templateSelection: {},
- radioSelection: 0,
- activeModeDistribution: 'hiBei',
- activeModeAgent: 'hiBei',
- activeModeArea: 'hiBei',
- activeModeBusinessBonus: 'hiBei',
- commission_type: [{
- label: '嗨贝',
- name: 'hiBei'
- },
- {
- label: '嗨值',
- name: 'hiValue'
- },
- ],
- goods_market_arr: [{
- label: 1,
- name: '嗨贝、嗨值赠送'
- },
- {
- label: 2,
- name: '嗨值、嗨贝抵扣'
- },
- ],
- ruleForm: {
- // 基础设置
- basic: {
- is_enable: 0,
- hi_value_name: '',
- hi_bei_name: '',
- hi_value_decimal: 2,
- merchant_profit_multiple: 0,
- merchant_reduce_profit_enable: 0,
- merchant_reduce_profit_min: 0,
- merchant_reduce_profit_max: 0,
- consumer_profit_multiple: 0,
- commissioner_profit_multiple: 0,
- mode_reward_method: 0,
- merchant_buy_goods: 0,
- destroy_method: 0, //销毁方式
- destroy_ratio: 0, //销毁比例
- destroy_formula: 0, //销毁公式
- destroy_time: '00:00',
- hi_bei_total_issuance: 0, //
- hi_bei_decimal: 2,
- airdrop_method: 0,
- airdrop_years_config: [],
- airdrop_years_type: 0,
- airdrop_everyday_number: 0,
- airdrop_time: '00:00',
- hi_bei_pricing_method: 0,
- hi_bei_pricing: 0,
- hi_bei_pricing_radio: 0,
- hi_bei_ratio_pricing: 0,
- buy_product_prompt: '',
- is_order_settings: 0,
- destroy_settings: 0,
- enable_platform_account: 0,
- platform_account_user: {
- user_id: 0,
- nickname: '',
- mobile: '',
- created_at: '',
- avatar_url: '',
- ratio: 0
- },
- hi_bei_transfer_fee_platform: {
- user_id: 0,
- nickname: '',
- mobile: '',
- created_at: '',
- avatar_url: '',
- ratio: 0
- },
- hi_bei_transfer_fee_destroy: 0,
- hi_bei_transfer_fee: 0,
- hi_bei_transfer_enable: 0,
- merchant_rewards: 0,
- consumer_rewards: 0,
- merchants_incentives: 0,
- payment_method: 0,
- remaining_rewards: 0,
- },
- recharge: {
- enable: 0,
- price_setting_method: 0,
- price_setting_ratio: 0,
- price_ladder: []
- },
- merchant: {
- enable_reward: 0,
- reward_ratio: 0,
- handling_fee: 0,
- enable_hold_hi_order: false,
- destroy_ratio: 0,
- enable_platform_account: 0,
- rest_hibe: 0,
- goods_market: [],
- },
- protocol: {
- member_notice: '',
- reward_rules: '',
- },
- mode: {
- enable: 0,
- checkout_counter_enable: 0,
- is_install_distribution: 0,
- is_install_agent: 0,
- is_install_area: 0,
- is_install_business_bonus: 0,
- distribution: {
- hiBei: {
- enable: 0,
- remaining_part_ratio: 0,
- type: 0,
- level_setting: [],
- },
- hiValue: {
- enable: 0,
- remaining_part_ratio: 0,
- type: 0,
- level_setting: [],
- },
- },
- agent: {
- hiBei: {
- enable: 0,
- remaining_part_ratio: 0,
- level_setting: [],
- },
- hiValue: {
- enable: 0,
- remaining_part_ratio: 0,
- level_setting: [],
- },
- },
- area: {
- hiBei: {
- enable: 0,
- remaining_part_ratio: 0,
- level_setting: [{
- level: [],
- type: 0,
- setting_type: 'normal',
- title: '嗨贝配置',
- },
- {
- level: [],
- type: 0,
- setting_type: 'same_level',
- title: '嗨贝平级奖配置',
- }
- ],
- },
- hiValue: {
- enable: 0,
- remaining_part_ratio: 0,
- level_setting: [{
- level: [],
- type: 0,
- setting_type: 'normal',
- title: '嗨值配置',
- },
- {
- level: [],
- type: 0,
- setting_type: 'same_level',
- title: '嗨值平级奖配置',
- }
- ],
- },
- },
- businessBonus: {
- hiBei: {
- enable: 0,
- remaining_part_ratio: 0,
- type: 0,
- level_setting: [],
- },
- hiValue: {
- enable: 0,
- remaining_part_ratio: 0,
- type: 0,
- level_setting: [],
- },
- }
- },
- withdraw: {
- cash_status: {
- title: '开启提现',
- value: '',
- remark: ''
- },
- cash_type: {
- title: '联系号码',
- value: [],
- remark: '自动打款支付,需要申请相应小程序的相应功能,例如:微信需要申请企业付款到零钱功能',
- extra_type: 'checkbox',
- extra: {
- // auto:'微信自动打款',
- // wechat:'微信线下转账',
- // alipay:'支付宝线下转账',
- // bank:'银行卡线下转账',
- // joinpay:'提现到银行卡-汇聚'
- }
- },
- cash_service_fee: {
- title: '提现手续费',
- value: '0',
- remark: '单位:% (提现手续费额外从提现中扣除,例如:10%的提现手续费:提现100元,扣除手续费10元,实际到手90元)'
- },
- },
- marketing: {
- enable: 0,
- send_hi_value_type: 0,
- parent_send_hi_value: 0,
- register_send_hi_value: 0,
- goods_list: [],
- active_goods_list: [],
- },
- cashier: {
- status: 0,
- hi_value: 0,
- hi_bei: 0,
- parent_hi_value: 0,
- },
- },
- }
- },
- mounted: function() {
- this.loadData();
- },
- watch: {
- 'ruleForm.basic.destroy_settings': {
- handler(newVal, oldVal) {
- this.ruleForm.basic.remaining_rewards = 100 - newVal - this.ruleForm.basic.platform_account_user.ratio;
- },
- immediate: true,
- deep: false
- },
- 'ruleForm.basic.platform_account_user.ratio': {
- handler(newVal, oldVal) {
- this.ruleForm.basic.remaining_rewards = 100 - newVal - this.ruleForm.basic.destroy_settings;
- },
- immediate: true,
- deep: false
- },
- 'ruleForm.basic.hi_bei_transfer_fee_destroy': {
- handler(newVal, oldVal) {
- this.ruleForm.basic.hi_bei_transfer_fee_platform.ratio = 100 - newVal;
- },
- immediate: true,
- deep: true
- },
- },
- methods: {
- assiginObj(target = {}, sources = {}) {
- let obj = target;
- if (typeof target != 'object' || typeof sources != 'object') {
- return sources; // 如果其中一个不是对象 就返回sources
- }
- for (let key in sources) {
- // 如果target也存在 那就再次合并
- if (target.hasOwnProperty(key)) {
- obj[key] = this.assiginObj(target[key], sources[key]);
- } else {
- // 不存在就直接添加
- obj[key] = sources[key];
- }
- }
- return obj;
- },
- loadData() {
- if (this.loading === true) return;
- this.loading = true;
- request({
- params: {
- r: 'hi-go/setting/index',
- },
- method: 'get'
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- let basic = e.data.data.configs.basic;
- let protocol = e.data.data.configs.protocol;
- let recharge = e.data.data.configs.recharge;
- let withdraw = e.data.data.configs.withdraw;
- let marketing = e.data.data.configs.marketing;
- let cashier = e.data.data.configs.cashier;
- // let merchant = e.data.data.configs.merchant;
- let mode = e.data.data.configs.mode;
- this.ruleForm.basic = this.assiginObj(this.ruleForm.basic, basic);
- this.ruleForm.protocol = this.assiginObj(this.ruleForm.protocol, protocol);
- this.ruleForm.recharge = this.assiginObj(this.ruleForm.recharge, recharge);
- this.ruleForm.mode = this.assiginObj(this.ruleForm.mode, mode);
- this.ruleForm.withdraw = this.assiginObj(this.ruleForm.withdraw, withdraw);
- this.ruleForm.marketing = this.assiginObj(this.ruleForm.marketing, marketing);
- this.ruleForm.cashier = this.assiginObj(this.ruleForm.cashier, cashier);
- // this.ruleForm.merchant = this.assiginObj(this.ruleForm.merchant, merchant);
- // this.$nextTick(() => {
- // this.ruleForm.merchant.goods_market = merchant.goods_market;
- // });
- for (let i = 0; i < this.ruleForm.basic.airdrop_years_config.length; i++) {
- let date = new Date();
- date.setFullYear(this.ruleForm.basic.airdrop_years_config[i].year);
- this.ruleForm.basic.airdrop_years_config[i].year = date;
- }
- }
- }).catch(e => {
- this.loading = false;
- })
- },
- forceChange() {
- this.$forceUpdate();
- },
- store(formName) {
- if (this.ruleForm.basic.airdrop_years_config.length > 0) {
- for (let i = 0; i < this.ruleForm.basic.airdrop_years_config.length; i++) {
- if (this.ruleForm.basic.airdrop_years_config[i].year instanceof Date) {
- this.ruleForm.basic.airdrop_years_config[i].year = this.ruleForm.basic.airdrop_years_config[i].year.getFullYear();
- }
- }
- }
- if (this.ruleForm.basic.airdrop_years_type == 1) {
- for (let i = 0; i < this.ruleForm.basic.airdrop_years_config.length; i++) {
- if (this.ruleForm.basic.airdrop_years_config[i].value > 100) {
- this.$message.error('年份对应的比例不能超过100%,请重新输入');
- return;
- }
- }
- }
- if (this.ruleForm.withdraw.cash_status.value == 1 && (this.ruleForm.withdraw.cash_service_fee.value >= 100 || this.ruleForm.withdraw.cash_service_fee.value < 0)) {
- this.$message.error('请设置有效的手续费');
- return;
- }
- this.$refs[formName].validate((valid) => {
- if (valid) {
- if (this.btnLoading) return
- this.btnLoading = true;
- request({
- params: {
- r: 'hi-go/setting/index',
- },
- method: 'post',
- data: this.ruleForm
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code == 0) {
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.$message.error(e);
- this.btnLoading = false;
- })
- } else {
- this.btnLoading = false;
- console.log('error submit!!');
- return false;
- }
- });
- },
- addYearsConfig() {
- let item = {
- year: '',
- value: 0,
- method: 0,
- };
- this.ruleForm.basic.airdrop_years_config.push(item);
- },
- delYearsConfig(index) {
- this.ruleForm.basic.airdrop_years_config.splice(index, 1);
- },
- addPriceLadder() {
- let item = {
- uuid: this.uuid(),
- money: 0,
- give: 0,
- };
- this.ruleForm.recharge.price_ladder.push(item);
- },
- delPriceLadder(index) {
- this.ruleForm.recharge.price_ladder.splice(index, 1);
- },
- uuid() {
- var s = [];
- var hexDigits = "0123456789abcdef";
- for (var i = 0; i < 36; i++) {
- s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
- }
- s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
- s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
- s[8] = s[13] = s[18] = s[23] = "-";
- var uuid = s.join("");
- return uuid;
- },
- dialogVisiblePop(select_user_type) {
- this.select_user_type = select_user_type;
- this.searchForm = {
- inviter_id: '',
- keyword: '',
- }
- this.searchInfo.splice(0, this.searchInfo.length);
- this.radioSelection = 0;
- this.selectUser = null;
- this.dialogVisible = true;
- },
- confirmSelectUser(type = 1) {
- this.dialogVisible = false;
- this.btnLoading = false;
- let userinfo = this.searchInfo[0];
- if (type == 1) {
- this.ruleForm.basic.platform_account_user.user_id = userinfo.id;
- this.ruleForm.basic.platform_account_user.nickname = userinfo.nickname;
- this.ruleForm.basic.platform_account_user.mobile = userinfo.mobile;
- this.ruleForm.basic.platform_account_user.avatar_url = userinfo.avatar_url;
- this.ruleForm.basic.platform_account_user.created_at = userinfo.created_at;
- } else {
- this.ruleForm.basic.hi_bei_transfer_fee_platform.user_id = userinfo.id;
- this.ruleForm.basic.hi_bei_transfer_fee_platform.nickname = userinfo.nickname;
- this.ruleForm.basic.hi_bei_transfer_fee_platform.mobile = userinfo.mobile;
- this.ruleForm.basic.hi_bei_transfer_fee_platform.avatar_url = userinfo.avatar_url;
- this.ruleForm.basic.hi_bei_transfer_fee_platform.created_at = userinfo.created_at;
- }
- },
- // 搜索
- searchFun() {
- if (!this.searchForm.inviter_id && !this.searchForm.keyword) {
- this.$message.error('查询内容不能为空');
- this.listLoading = false;
- return false;
- }
- this.listLoading = true;
- request({
- params: {
- r: 'hi-go/default/get-platform-user',
- inviter_id: this.searchForm.inviter_id,
- keyword: this.searchForm.keyword,
- user_id: this.user_id,
- },
- }).then(e => {
- this.listLoading = false;
- if (e.data.code === 0) {
- this.searchInfo = e.data.data.list.list;
- } else {
- this.$message.error(res.data.msg);
- }
- }).catch(e => {
- this.listLoading = false;
- });
- },
- selectionChange(e) {
- console.log(e, 'dfhkdhkjsfhdjkfhdskjfh');
- this.selectUser = e;
- },
- delPlatformUser(type = 1) {
- if (type == 1) {
- this.ruleForm.basic.platform_account_user.user_id = 0;
- this.ruleForm.basic.platform_account_user.nickname = '';
- this.ruleForm.basic.platform_account_user.mobile = '';
- this.ruleForm.basic.platform_account_user.created_at = '';
- this.ruleForm.basic.platform_account_user.avatar_url = '';
- this.ruleForm.basic.platform_account_user.ratio = 0;
- } else {
- this.ruleForm.basic.hi_bei_transfer_fee_platform.user_id = 0;
- this.ruleForm.basic.hi_bei_transfer_fee_platform.nickname = '';
- this.ruleForm.basic.hi_bei_transfer_fee_platform.mobile = '';
- this.ruleForm.basic.hi_bei_transfer_fee_platform.created_at = '';
- this.ruleForm.basic.hi_bei_transfer_fee_platform.avatar_url = '';
- this.ruleForm.basic.hi_bei_transfer_fee_platform.ratio = 0;
- }
- },
- checkNum(key) {
- if (this.ruleForm.basic.airdrop_years_type == 1) {
- if (this.ruleForm.basic.airdrop_years_config[key].value > 100) {
- this.ruleForm.basic.airdrop_years_config[key].value = 0;
- this.forceChange();
- this.$message.error('年份对应的比例不能超过100%,请重新输入');
- }
- }
- },
- // 选中商品处理
- goodsSelect(param) {
- let params = param;
- //params.push(param);
- for (let j in params) {
- let item = params[j];
- let flag = true;
- if (flag) {
- //this.ruleForm.marketing.goods_list = [];
- this.ruleForm.marketing.goods_list.push({
- id: item.id,
- price: item.price,
- status: item.status,
- goods_stock: item.stock,
- goods_name: item.goods_name,
- cover_pic: item.cover_pic,
- });
- }
- }
- },
- // 选中商品处理
- goodsActiveSelect(param) {
- let params = param;
- //params.push(param);
- for (let j in params) {
- let item = params[j];
- let flag = true;
- if (flag) {
- //this.ruleForm.marketing.active_goods_list = [];
- this.ruleForm.marketing.active_goods_list.push({
- id: item.id,
- price: item.price,
- status: item.status,
- goods_stock: item.stock,
- goods_name: item.goods_name,
- cover_pic: item.cover_pic,
- });
- console.log(this.ruleForm.marketing.active_goods_list);
- }
- }
- },
- // 删除商品
- delFun(index) {
- this.ruleForm.marketing.goods_list.splice(index, 1);
- },
- // 删除商品
- delActiveFun(index) {
- this.ruleForm.marketing.active_goods_list.splice(index, 1);
- },
- },
- });
- </script>
- <style>
- .el-collapse-item__header {
- font-size: 14px;
- }
- #settingForm .el-form-item__label {
- font-size: 13px;
- }
- .my-desc-label {
- font-size: 13px;
- }
- </style>
|