detail.php 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-rich-text');
  4. ComponentHelper::loadComponentView('com-dialog-select');
  5. ComponentHelper::loadComponentView('com-qq-map');
  6. $addons_settings = empty($addons_settings) ? [] : $addons_settings;
  7. foreach ($addons_settings as $key => $item) {
  8. ComponentHelper::loadComponentView($item['components'], Yii::$app->basePath . '/../addons/' . ucfirst($key) . '/backend/views/goods');
  9. }
  10. $addons_settings = \yii\helpers\Json::encode($addons_settings);
  11. ?>
  12. <div id="app" v-cloak>
  13. <el-card v-loading="loading" style="border:0" shadow="never" body-style="background-color: #f3f3f3;padding: 0 0;">
  14. <el-tabs v-model="activeName" @tab-click="handleClick">
  15. <el-tab-pane label="基础信息" name="basic_setting">
  16. <?php ComponentHelper::loadComponentView('detail-basic', __DIR__ . '/');
  17. ?>
  18. </el-tab-pane>
  19. <el-tab-pane label="门店设置" name="store_setting" class="cashier-tabs">
  20. <?php ComponentHelper::loadComponentView('detail-store', __DIR__ . '/'); ?>
  21. </el-tab-pane>
  22. <el-tab-pane label="收银设置" name="cashier_setting">
  23. <?php ComponentHelper::loadComponentView('detail-cashier', __DIR__ . '/'); ?>
  24. </el-tab-pane>
  25. </el-tabs>
  26. </el-card>
  27. </div>
  28. <script>
  29. const app = new Vue({
  30. el: '#app',
  31. data() {
  32. var validatePass = (rule, value, callback) => {
  33. if (value === '') {
  34. callback(new Error('两次输入密码不一致'));
  35. } else if (value !== this.storeForm.password) {
  36. callback(new Error('两次输入密码不一致!'));
  37. } else {
  38. callback();
  39. }
  40. };
  41. var validateTime = (rule, value, callback) => {
  42. if ((!this.times || !this.times.length) && this.storeForm.shop_status == 1) {
  43. callback(new Error('请设置营业时间'));
  44. } else {
  45. callback();
  46. }
  47. };
  48. var validateStoreServiceRatio = (rule, value, callback) => {
  49. if (this.storeForm.store_service_fee == 1 && value <= 0) {
  50. callback(new Error('请填写服务费收取比例'));
  51. } else {
  52. callback();
  53. }
  54. };
  55. var validateCachierServiceRatio = (rule, value, callback) => {
  56. if (value < 0) {
  57. callback(new Error('服务费不能小于0'));
  58. }
  59. if (value > 100) {
  60. callback(new Error('服务费不能大于100'));
  61. }
  62. callback();
  63. };
  64. return {
  65. store_id: 0,
  66. loading: false,
  67. switchStoreLoading: false,
  68. submitLoading: false,
  69. activeName: 'basic_setting',
  70. times: null,
  71. basicForm: {
  72. goods_auth: 0,
  73. service_fee: 0,
  74. settle_type: 0,
  75. platform_ratio: 0,
  76. risk_management: 0,
  77. risk_management_ratio: 0,
  78. settle_scene: 1,
  79. store_distribution_status: 0,
  80. store_agent_status: 0,
  81. store_area_status: 0,
  82. store_boss_status: 0,
  83. payment_settlement_type: 0,
  84. address: '',
  85. province_id: '',
  86. province_name: '',
  87. city_id: '',
  88. city_name: '',
  89. district_id: '',
  90. district_name: '',
  91. street_id: '',
  92. street_name: '',
  93. community_id: '',
  94. community_name: '',
  95. c_id: '',
  96. cate_name:'',
  97. },
  98. category: [],
  99. storeForm: {
  100. shop_status: 1,
  101. store_background: '',
  102. username: '',
  103. password: '',
  104. repassword: '',
  105. store_service_fee: 0,
  106. store_service_fee_type: 0,
  107. store_service_ratio: 0,
  108. huifu_mch_no: '',
  109. store_settle_type: 1,
  110. store_service_fee_settle_type: 1,
  111. store_settle_scene: 2,
  112. store_commission_authority: {
  113. distribution: 0,
  114. agent: 0,
  115. area: 0,
  116. boss: 0,
  117. },
  118. business_time_start: '',
  119. business_time_end: '',
  120. status: 0,
  121. show_sync_goods: 0,
  122. is_enable_withdraw_setting: 0,
  123. balance_cash_service_fee: 0,
  124. balance_cash_service_fee_limit: 0,
  125. balance_cash_service_fee_month: 0,
  126. balance_cash_service_fee_diff: 0,
  127. },
  128. cashierForm: {
  129. is_preferential_gift: 0,//优惠赠送开关
  130. is_preferential_undertaking: 0,//优惠谁承担独立设置
  131. preferential_undertaking: '1',//优惠谁承担
  132. is_distribution_enable: 1,
  133. is_agent_enable: 1,
  134. service_fee_ratio: 0,
  135. member_status: 0,
  136. enable_discount_price: 0,
  137. discount_price_scale: 0,
  138. cashier_is_open_discount: 0,
  139. members: [
  140. // {
  141. // level: 0,
  142. // level_name: '默认等级',
  143. // discount: 0
  144. // }
  145. ],
  146. is_area_enable_cashier: 1, // 区域管理是否安装
  147. cashier_area_settings: { // 区域管理配置
  148. is_enable: 1, // 是否开启区域管理
  149. },
  150. area_currency: [],
  151. is_distribution: 0,
  152. deepNames: ['一级分销', '二级分销'],
  153. distribution_settings: [
  154. // {
  155. // level: 0,
  156. // level_name: '默认等级',
  157. // name: '佣金',
  158. // commission_rate: [10, 15]
  159. // },
  160. ],
  161. is_agent: 0,
  162. agent_settings: {
  163. // team_rewards: [{
  164. // level: 0,
  165. // level_name: '默认等级',
  166. // commission_rate: 0
  167. // }, ],
  168. // equal_rewards: [{
  169. // level: 0,
  170. // level_name: '默认等级',
  171. // commission_rate: 0
  172. // }, ],
  173. // over_rewards: [{
  174. // level: 0,
  175. // level_name: '默认等级',
  176. // commission_rate: 0
  177. // }, ],
  178. },
  179. cashier_goods_complete_direct: 0
  180. },
  181. categorys: [],
  182. basicFormRules: {},
  183. storeRules: {
  184. shop_status: [{
  185. required: true,
  186. message: '请设置营业状态',
  187. trigger: 'blur'
  188. }],
  189. range_time: [{
  190. required: true,
  191. validator: validateTime,
  192. trigger: 'blur'
  193. }],
  194. store_service_fee: [{
  195. required: true,
  196. message: '请设置是否收取服务器',
  197. trigger: 'blur'
  198. }],
  199. store_service_ratio: [{
  200. validator: validateStoreServiceRatio,
  201. trigger: 'blur'
  202. }],
  203. store_settle_type: [{
  204. required: true,
  205. message: '请选择计算方式',
  206. trigger: 'blur'
  207. }],
  208. store_service_fee_settle_type: [{
  209. required: true,
  210. message: '请选择计算方式',
  211. trigger: 'blur'
  212. }],
  213. store_settle_scene: [{
  214. required: true,
  215. message: '请选择结算方式',
  216. trigger: 'blur'
  217. }],
  218. repassword: [{
  219. validator: validatePass,
  220. trigger: 'blur'
  221. }],
  222. balance_cash_service_fee: [{
  223. required: true,
  224. message: '请输入提现手续费',
  225. trigger: 'blur'
  226. }],
  227. balance_cash_service_fee_month: [{
  228. required: true,
  229. message: '请输入当月商家累计提现',
  230. trigger: 'blur'
  231. }],
  232. balance_cash_service_fee_diff: [{
  233. required: true,
  234. message: '请输入超出手续费',
  235. trigger: 'blur'
  236. }],
  237. huifu_mch_no: [{
  238. required: true,
  239. message: '请输入汇付分账商户号',
  240. trigger: 'blur'
  241. }],
  242. },
  243. cashierFormRules: {
  244. cachier_service_ratio: [
  245. {
  246. validator: validateCachierServiceRatio,
  247. trigger: 'blur'
  248. }
  249. ],
  250. },
  251. basicRules: {},
  252. statisticsData: { // 基础信息数据统计对象
  253. 'total_money': '累计收入',
  254. 'balance': '当前余额',
  255. 'total_expenses': '累计支出',
  256. 'unsettled_amount': '累计提现',
  257. 'user_nums': '门店会员数',
  258. 'good_counts': '商品数',
  259. 'total_order_number': '订单支付数',
  260. 'total_order_money': '订单支付金额',
  261. 'total_settled_amount': '结算货款',
  262. 'share_amount': '已分帐金额',
  263. },
  264. isDisable: false, // 是否禁用门店
  265. baseDialogVisible: false,
  266. shareDialogVisible: false,
  267. addressDialogVisible: false,
  268. form: {
  269. name: '',
  270. region: '',
  271. date1: '',
  272. date2: '',
  273. delivery: false,
  274. type: [],
  275. resource: '',
  276. desc: ''
  277. },
  278. captcha: '发送验证码',
  279. address: '',
  280. latitude: 0,
  281. longitude: 0,
  282. addonsSettings: <?= $addons_settings ?? '{}'; ?>, // 各个插件模式配置
  283. goods: {},
  284. setting: {},
  285. commission_type_map: {},
  286. coupon_type_map: {},
  287. level: {},
  288. expireDate: null,
  289. editExpireTime: false,
  290. cashierDistributionName: 'commission',
  291. areaName: 'area-detail',
  292. huifu_addons: <?= $huifu_addons ?>,
  293. provinces: [],
  294. provinceInfo: {},
  295. citys: [],
  296. cityInfo: {},
  297. districts: [],
  298. districtInfo: {},
  299. streets: [],
  300. streetInfo: {},
  301. communitys: [],
  302. communityInfo: {},
  303. show_address:'',
  304. address_names:'',
  305. community_status: 0
  306. };
  307. },
  308. mounted: function() {
  309. this.store_id = getQuery('store_id');
  310. this.loadData();
  311. },
  312. methods: {
  313. handleCancel() {
  314. this.addressDialogVisible = false; // 关闭弹框
  315. // 可以在这里添加更多的取消逻辑
  316. },
  317. tabClickHandles(tab, key) {
  318. this[key] = tab.name
  319. },
  320. mapEvent(e) {
  321. console.log(e, '----')
  322. this.basicForm.address = e.address;
  323. this.basicForm.latitude = e.lat;
  324. this.basicForm.longitude = e.long;
  325. this.$forceUpdate();
  326. },
  327. storeSwitch() { // 启用/禁用门店
  328. let self = this;
  329. self.switchStoreLoading = true;
  330. let status = null;
  331. if (self.isDisable) {
  332. status = 1;
  333. } else {
  334. status = 3;
  335. }
  336. request({
  337. params: {
  338. r: 'store/store/switch-status',
  339. },
  340. method: 'post',
  341. data: {
  342. store_id: self.store_id,
  343. status: status,
  344. }
  345. }).then(e => {
  346. self.switchStoreLoading = false;
  347. if (e.data.code == 0) {
  348. self.isDisable = !self.isDisable;
  349. } else {
  350. self.$message.error(e.data.msg);
  351. }
  352. }).catch(e => {
  353. self.switchStoreLoading = false;
  354. console.log(e);
  355. self.$message.error('网络错误');
  356. return false;
  357. });
  358. },
  359. storeEdit(name) { // 编辑
  360. this[name] = true;
  361. },
  362. storeDetailSelectedImg(e, key) { // 选中图片
  363. console.log(e, 'upload----')
  364. this.basicForm[key] = e[0].url;
  365. },
  366. // 删除图片
  367. storeDetailDeletePic(key) {
  368. this.basicForm[key] = '';
  369. },
  370. addressDialog(){
  371. this.addressDialogVisible = false
  372. this.streetInfo.name = this.streetInfo.name ? this.streetInfo.name : '';
  373. this.communityInfo.name = this.communityInfo.name ? this.communityInfo.name : '';
  374. this.basicForm.province_id = this.provinceInfo.id;
  375. this.basicForm.city_id = this.cityInfo.id;
  376. this.basicForm.district_id = this.districtInfo.id;
  377. this.basicForm.street_id = this.streetInfo.id ? this.streetInfo.id : 0;
  378. this.basicForm.community_id = this.communityInfo.id ? this.communityInfo.id : 0;
  379. this.basicForm.address = this.address
  380. let address = this.address;
  381. let reg = new RegExp(/(.*?(?:省|自治区|北京市|天津市|上海市|重庆市))+(.*?(?:市|自治州|地区|区划|县))+(.*?(?:市|区|县|镇|乡|街道))/);
  382. let rst = address.match(reg);
  383. let addr = '';
  384. if (rst) {
  385. addr += this.provinceInfo.name + '/' + this.cityInfo.name + '/' + this.districtInfo.name;
  386. }
  387. this.basicForm.addr = addr;
  388. this.basicForm.show_address = this.provinceInfo.name + this.cityInfo.name + this.districtInfo.name + this.streetInfo.name + this.communityInfo.name + this.address
  389. //如果有从经纬度获取值,那么拼接后面的
  390. },
  391. // sendCode() { // 发送验证码
  392. // this.captcha = 60
  393. // this.countDown()
  394. // },
  395. // // 倒计时
  396. // countDown() {
  397. // var timer = setInterval(() => {
  398. // this.captcha--
  399. // if (this.captcha <= 0) {
  400. // clearInterval(timer)
  401. // this.captcha = '重新获取'
  402. // }
  403. // }, 1000)
  404. // },
  405. // 输入值过滤处理
  406. changeHandle(key) {
  407. try {
  408. this.flierValue(this.activeName, key);
  409. } catch (err) {
  410. this.$message.error(err);
  411. let tabs = this.activeName.split('_');
  412. let formName = tabs[0] + 'Form';
  413. if (this[formName][key] < 0) {
  414. this[formName][key] = Math.abs(this[formName][key]);
  415. } else if (this[formName][key] > 100) {
  416. this[formName][key] = 0;
  417. }
  418. return false;
  419. }
  420. },
  421. // 过滤和处理值
  422. flierValue(group, key) {
  423. // console.log(group, key);
  424. let configs = {
  425. store_service_ratio: {
  426. text: `服务费比例取值在 0~100 之间`,
  427. max: '100',
  428. min: '0',
  429. },
  430. // expired_days: {
  431. // text: '请填写门店有效天数',
  432. // min: '0',
  433. // },
  434. // service_fee_ratio: {
  435. // text: `服务费比例取值在 0~100 之间`,
  436. // max: '100',
  437. // min: '0',
  438. // },
  439. };
  440. let datas = {
  441. basic_setting: this.basicForm,
  442. cashier_setting: this.cashierForm,
  443. store_setting: this.storeForm,
  444. };
  445. let val = datas[group][key];
  446. if (configs[key]) {
  447. if (configs[key].max && val > parseInt(configs[key].max)) {
  448. throw new Error(configs[key].text);
  449. }
  450. if (configs[key].min && val < parseInt(configs[key].min)) {
  451. throw new Error(configs[key].text);
  452. }
  453. }
  454. },
  455. regionChange(val,level) {
  456. if (level < 4 && val.lng !== "" && val.lat !== "") {
  457. this.basicForm.longitude = val.lng;
  458. this.basicForm.latitude = val.lat;
  459. }
  460. switch (level) {
  461. case 1:
  462. this.provinceInfo.id = val.id;
  463. this.provinceInfo.name = val.name;
  464. this.cityInfo = {};
  465. this.districtInfo = {};
  466. this.streetInfo = {};
  467. this.communityInfo = {};
  468. this.citys = '';
  469. this.districts = '';
  470. this.streets = '';
  471. this.communitys = '';
  472. break;
  473. case 2:
  474. this.cityInfo.id = val.id;
  475. this.cityInfo.name = val.name;
  476. this.districtInfo = {};
  477. this.streetInfo = {};
  478. this.communityInfo = {};
  479. this.districts = '';
  480. this.streets = '';
  481. this.communitys = '';
  482. break;
  483. case 3:
  484. this.districtInfo.id = val.id;
  485. this.districtInfo.name = val.name;
  486. this.streetInfo = {};
  487. this.communityInfo = {};
  488. this.streets = '';
  489. this.communitys = '';
  490. break;
  491. case 4:
  492. this.streetInfo.id = val.id;
  493. this.streetInfo.name = val.name;
  494. this.communityInfo = {};
  495. this.communitys = '';
  496. break;
  497. case 5:
  498. this.communityInfo.id = val.id;
  499. this.communityInfo.name = val.community_name;
  500. break;
  501. }
  502. this.getCity(level, val.id);
  503. },
  504. // 省市区三级联动
  505. getCity(level, id ) {
  506. let self = this;
  507. request({
  508. params: {
  509. r: 'store/store/get-regions',
  510. region_id: id,
  511. level: level,
  512. },
  513. method: 'get',
  514. }).then(e => {
  515. if (e.data.code == 0) {
  516. switch (level) {
  517. case 1:
  518. self.citys = e.data.data;
  519. break;
  520. case 2:
  521. self.districts = e.data.data;
  522. break;
  523. case 3:
  524. self.streets = e.data.data;
  525. break;
  526. case 4:
  527. self.communitys = e.data.data;
  528. break;
  529. }
  530. } else {
  531. self.$message.error(e.data.msg);
  532. }
  533. }).catch(e => {
  534. console.log(e);
  535. self.$message.error('网络错误');
  536. return false;
  537. });
  538. },
  539. //选定社区
  540. communityChange(val) {
  541. this.communityInfo = val
  542. },
  543. loadData() {
  544. let self = this;
  545. this.loading = true;
  546. request({
  547. params: {
  548. r: 'store/store/detail',
  549. store_id: self.store_id,
  550. },
  551. method: 'get'
  552. }).then(e => {
  553. // console.log('LLLLLLL: ', e);
  554. self.loading = false;
  555. if (e.data.code === 0) {
  556. self.provinces = e.data.data.provinces;
  557. this.community_status = e.data.data.community_status
  558. if (e.data.data.basic_setting) {
  559. self.basicForm = e.data.data.basic_setting;
  560. self.address_names = e.data.data.basic_setting.address_names.split('-');
  561. if(self.basicForm.province_id){
  562. self.provinceInfo.id = self.basicForm.province_id;
  563. self.provinceInfo.name = self.address_names[0];
  564. }
  565. if(self.basicForm.city_id){
  566. this.getCity(1,self.basicForm.province_id)
  567. self.cityInfo.id = self.basicForm.city_id;
  568. self.cityInfo.name = self.address_names[1];
  569. }
  570. if(self.basicForm.district_id){
  571. this.getCity(2,self.basicForm.city_id)
  572. self.districtInfo.id = self.basicForm.district_id;
  573. self.districtInfo.name = self.address_names[2];
  574. }
  575. if(self.basicForm.street_id){
  576. this.getCity(3,self.basicForm.district_id)
  577. self.streetInfo.id = self.basicForm.street_id;
  578. self.streetInfo.name = self.address_names[3];
  579. }
  580. if(self.basicForm.community_id){
  581. this.getCity(4,self.basicForm.street_id)
  582. self.communityInfo.id = self.basicForm.community_id;
  583. self.communityInfo.name = self.address_names[4];
  584. }
  585. self.address = self.basicForm.address;
  586. if (1 == e.data.data.basic_setting.status) {
  587. this.isDisable = false;
  588. } else {
  589. this.isDisable = true;
  590. }
  591. }
  592. if (e.data.data.store_setting) {
  593. e.data.data.store_setting.status=0;
  594. self.storeForm = e.data.data.store_setting;
  595. self.times = [e.data.data.store_setting.business_time_start, e.data.data.store_setting.business_time_end];
  596. }
  597. if (e.data.data.cashier_setting) {
  598. self.cashierForm = e.data.data.cashier_setting;
  599. self.cashierForm.preferential_undertaking = self.cashierForm.preferential_undertaking.toString();
  600. }
  601. // console.log(self.times);
  602. // console.log('self.storeForm: ', self.storeForm);
  603. this.getCategory();
  604. this.getModelDetail();
  605. } else {
  606. self.$message.error(e.data.msg);
  607. }
  608. }).catch(e => {
  609. // console.log(e);
  610. self.$message.error('网络错误');
  611. });
  612. },
  613. // 配置提交
  614. submit(formName) {
  615. // console.log('5555555555: ', formName, this.activeName, this.storeForm);return null;
  616. let self = this;
  617. let keys = [];
  618. if ('basic_setting' == self.activeName) {
  619. keys = [];
  620. } else if ('cashier_setting' == self.activeName) {
  621. keys = ['service_fee_ratio'];
  622. // 会员等级折扣验证
  623. if (1 == self.cashierForm.member_status) {
  624. let memberForNum = self.cashierForm.members.length;
  625. for (let i = 0; i < memberForNum; i++) {
  626. let discount_val = self.cashierForm.members[i].discount;
  627. if (discount_val < 0 || discount_val > 100) {
  628. self.$message.error('会员折扣比例取值在 0~100 之间');
  629. return false;
  630. }
  631. }
  632. }
  633. // 分销佣金比例验证
  634. if (1 == self.cashierForm.is_distribution && 1 == self.cashierForm.is_distribution_enable) {
  635. let forNum = self.cashierForm.distribution_settings.length;
  636. for (let i = 0; i < forNum; i++) {
  637. let val = self.cashierForm.distribution_settings[i].commission_rate;
  638. let valForNum = val.length;
  639. for (let i = 0; i < valForNum; i++) {
  640. if (val[i] < 0 || val[i] > 100) {
  641. self.$message.error('分销佣金比例取值在 0~100 之间');
  642. return false;
  643. }
  644. }
  645. }
  646. }
  647. // 经销佣金比例验证
  648. if (1 == self.cashierForm.is_agent && 1 == self.cashierForm.is_agent_enable) {
  649. for (key in self.cashierForm.agent_settings) {
  650. let settings = self.cashierForm.agent_settings[key];
  651. let forNum = settings.length;
  652. for (let i = 0; i < forNum; i++) {
  653. let val = settings[i].commission_rate;
  654. if (val < 0 || val > 100) {
  655. self.$message.error('经销佣金比例取值在 0~100 之间');
  656. return false;
  657. }
  658. }
  659. }
  660. }
  661. } else if ('store_setting' == self.activeName) {
  662. keys = ['store_service_ratio'];
  663. if (self.storeForm.password && self.storeForm.password != self.storeForm.repassword) {
  664. self.$message.error('两次输入密码不一致');
  665. return false;
  666. }
  667. }
  668. let forNum = keys.length;
  669. for (let i = 0; i < forNum; i++) {
  670. try {
  671. self.flierValue(self.activeName, keys[i]);
  672. } catch (err) {
  673. self.$message.error(err);
  674. return false;
  675. }
  676. }
  677. // console.log(self.$refs);return null;
  678. self.$refs[formName].validate(valid => {
  679. if (valid) {
  680. self.submitLoading = true;
  681. let activeName = self.activeName;
  682. let formData = {};
  683. formData[activeName] = self[formName];
  684. formData.group = activeName;
  685. formData.store_id = this.store_id;
  686. // console.log(formData);return null;
  687. request({
  688. params: {
  689. r: 'store/store/detail',
  690. },
  691. method: 'post',
  692. data: formData,
  693. }).then(e => {
  694. self.submitLoading = false;
  695. if (e.data.code === 0) {
  696. self.$message.success(e.data.msg);
  697. } else {
  698. self.$message.error(e.data.msg);
  699. return false;
  700. }
  701. }).catch(e => {
  702. self.submitLoading = false;
  703. console.log(e);
  704. self.$message.error('网络错误');
  705. return false;
  706. });
  707. } else {
  708. self.$message.error('参数验证未通过');
  709. return false;
  710. }
  711. });
  712. },
  713. handleClick(tab, event) {
  714. this.activeName = tab.name;
  715. },
  716. // 时间改变回调
  717. selectTime(e) {
  718. // console.log('kkkkkkk ==== : ', e, this.times);
  719. if (e) {
  720. this.storeForm.business_time_start = this.times[0];
  721. this.storeForm.business_time_end = this.times[1];
  722. } else {
  723. this.times = null;
  724. this.storeForm.business_time_start = '';
  725. this.storeForm.business_time_end = '';
  726. }
  727. },
  728. // 选择图片
  729. selectedImg(e, key) {
  730. // console.log('ddddd: ', e, key);
  731. this.storeForm[key] = e[0].url;
  732. this.$forceUpdate();
  733. },
  734. // 删除图片
  735. delPic(key) {
  736. this.storeForm[key] = '';
  737. this.$forceUpdate();
  738. },
  739. handleCascaderChange(selectedValues) {
  740. // 方法1:使用$refs获取选中节点(推荐)
  741. const cascader = this.$refs.cascaderRef;
  742. const selectedNodes = cascader.getCheckedNodes();
  743. if (selectedNodes && selectedNodes.length > 0) {
  744. // 获取第一个选中节点的完整路径(单选情况)
  745. const pathLabels = selectedNodes[0].pathLabels;
  746. this.basicForm.cate_name = pathLabels.join(' / ');
  747. this.basicForm.c_id = selectedValues[selectedValues.length -1];
  748. } else {
  749. this.basicForm.cate_name = '';
  750. }
  751. },
  752. // 获取门店模式设置详情
  753. getModelDetail() {
  754. let self = this;
  755. self.cardLoading = true;
  756. request({
  757. params: {
  758. r: 'store/store/model-detail',
  759. store_id: self.store_id,
  760. },
  761. method: 'get',
  762. }).then(e => {
  763. // console.log(e, 'model-detail ============== ');
  764. self.cardLoading = false;
  765. if (e.data.code == 0) {
  766. self.level = e.data.data.level;
  767. if (!isEmpty(e.data.data.setting)) {
  768. self.setting = e.data.data.setting;
  769. for (let key in self.setting) {
  770. // 将空的
  771. if (isEmpty(self.setting[key])) self.setting[key] = {};
  772. }
  773. }
  774. self.commission_type_map = e.data.data.commission_type_map;
  775. self.coupon_type_map = e.data.data.coupon_type_map;
  776. self.storeForm.status = e.data.data.status;
  777. } else {
  778. self.$message.error(e.data.msg);
  779. }
  780. }).catch(e => {
  781. console.log(e);
  782. });
  783. },
  784. getData(val, key) {
  785. this.storeForm[key] = val;
  786. },
  787. getCategory() {
  788. request({
  789. params: {
  790. r: 'store/store/store-cate-tree',
  791. }
  792. }).then(res => {
  793. if (res.data.code == 0) {
  794. this.category = res.data.data.list
  795. } else {
  796. this.$message.error(res.data.msg);
  797. }
  798. });
  799. },
  800. expireDateChange(e) {
  801. // console.log(e, '=============== ', this.basicForm.expire_time);
  802. this.basicForm.expire_time = Math.ceil(e / 1000) +86399;
  803. },
  804. suonaTest() {
  805. let self = this;
  806. if (isEmpty(self.storeForm.device_id)) {
  807. self.$message.error('设备ID不能为空');
  808. return false;
  809. }
  810. request({
  811. params: {
  812. r: 'store/store/suona-test',
  813. },
  814. method: 'post',
  815. data: {
  816. store_id: self.store_id,
  817. device_id: self.storeForm.device_id
  818. },
  819. }).then(e => {
  820. if (e.data.code === 0) {
  821. self.$message.success(e.data.msg);
  822. } else {
  823. self.$message.error(e.data.msg);
  824. }
  825. }).catch(e => {
  826. self.$message.error('网络错误');
  827. });
  828. },
  829. onChangeStoreServiceFee(val) {
  830. console.log('onChangeStoreServiceFee', val)
  831. this.storeForm.store_settle_type = 2
  832. },
  833. handleFeeTypeChange(val) {
  834. console.log('handleFeeTypeChange', val)
  835. if (val === 0) {
  836. this.storeForm.store_settle_type = 2;
  837. }
  838. },
  839. },
  840. computed: {
  841. }
  842. });
  843. </script>
  844. <style>
  845. .grid-box {
  846. padding: 0 40px;
  847. background: #fff;
  848. border-radius: 0 0 4px 4px;
  849. }
  850. .grid-item {
  851. height: 130px;
  852. }
  853. .grid-text {
  854. font-size: 15px;
  855. }
  856. .grid-val {
  857. font-size: 20px;
  858. padding-top: 10px;
  859. }
  860. .grid-icon {
  861. color: #999;
  862. cursor: pointer;
  863. font-size: 18px;
  864. }
  865. .store-card {
  866. margin-top: 15px;
  867. }
  868. .store-card.el-card {
  869. border: 0;
  870. }
  871. .store-card-body .store-name {
  872. padding-left: 10px;
  873. }
  874. .store-card-body .el-descriptions__body {
  875. padding: 20px 40px;
  876. }
  877. .store-send-code {
  878. padding-left: 10px;
  879. font-size: 12px;
  880. cursor: pointer;
  881. }
  882. .el-tabs__header {
  883. padding: 0 20px;
  884. height: 56px;
  885. line-height: 56px;
  886. background-color: #fff;
  887. margin-bottom: 0;
  888. }
  889. .title {
  890. padding: 0px 8px;
  891. border-left: 5px solid #1479F0;
  892. background-color: #fff;
  893. font-size: 18px;
  894. position: relative;
  895. left: 32px;
  896. margin: 20px 0;
  897. }
  898. .form-body {
  899. background-color: #fff;
  900. padding: 20px 50% 20px 0;
  901. }
  902. .button-item {
  903. padding: 9px 25px;
  904. margin-bottom: 15px;
  905. }
  906. .form-body .item {
  907. width: 300px;
  908. margin-bottom: 50px;
  909. margin-right: 25px;
  910. }
  911. .item-img {
  912. height: 550px;
  913. padding: 25px 10px;
  914. border-radius: 30px;
  915. border: 1px solid #CCCCCC;
  916. background-color: #fff;
  917. }
  918. .item .el-form-item {
  919. width: 300px;
  920. margin: 20px auto;
  921. }
  922. .left-setting-menu {
  923. width: 260px;
  924. }
  925. .left-setting-menu .el-form-item {
  926. height: 60px;
  927. padding-left: 20px;
  928. display: flex;
  929. align-items: center;
  930. margin-bottom: 0;
  931. cursor: pointer;
  932. }
  933. .left-setting-menu .el-form-item .el-form-item__label {
  934. cursor: pointer;
  935. }
  936. .left-setting-menu .el-form-item.active {
  937. background-color: #F3F5F6;
  938. border-top-left-radius: 10px;
  939. width: 105%;
  940. border-bottom-left-radius: 10px;
  941. }
  942. .left-setting-menu .el-form-item .el-form-item__content {
  943. margin-left: 0 !important
  944. }
  945. .no-radius {
  946. border-top-left-radius: 0 !important;
  947. }
  948. .reset {
  949. position: absolute;
  950. top: 3px;
  951. left: 90px;
  952. }
  953. .app-tip {
  954. position: absolute;
  955. right: 24px;
  956. top: 16px;
  957. height: 72px;
  958. line-height: 72px;
  959. max-width: calc(100% - 78px);
  960. }
  961. .app-tip:before {
  962. content: ' ';
  963. width: 0;
  964. height: 0;
  965. border-color: inherit;
  966. position: absolute;
  967. top: -32px;
  968. right: 100px;
  969. border-width: 16px;
  970. border-style: solid;
  971. }
  972. .tip-content {
  973. display: block;
  974. white-space: nowrap;
  975. width: 100%;
  976. overflow: hidden;
  977. text-overflow: ellipsis;
  978. margin: 0 28px;
  979. font-size: 28px;
  980. }
  981. .btn-abs {
  982. position: absolute;
  983. top: 12px;
  984. right: 18px;
  985. }
  986. .form-body .app-share {
  987. padding-top: 12px;
  988. border-top: 1px solid #e2e2e2;
  989. margin-top: -20px;
  990. }
  991. .form-body .app-share .app-share-bg {
  992. position: relative;
  993. width: 310px;
  994. height: 360px;
  995. background-repeat: no-repeat;
  996. background-size: contain;
  997. background-position: center
  998. }
  999. .form-body .app-share .app-share-bg .title {
  1000. width: 160px;
  1001. height: 29px;
  1002. line-height: 1;
  1003. word-break: break-all;
  1004. text-overflow: ellipsis;
  1005. display: -webkit-box;
  1006. -webkit-box-orient: vertical;
  1007. -webkit-line-clamp: 2;
  1008. overflow: hidden;
  1009. }
  1010. .form-body .app-share .app-share-bg .pic-image {
  1011. background-repeat: no-repeat;
  1012. background-position: 0 0;
  1013. background-size: cover;
  1014. width: 160px;
  1015. height: 130px;
  1016. }
  1017. .cashier-tabs .el-tabs__header {
  1018. padding: 0;
  1019. height: 45px;
  1020. line-height: 45px;
  1021. /* background-color: #F5F7FA; */
  1022. margin-bottom: 0;
  1023. }
  1024. .cashier-tabs .el-tabs__item {
  1025. height: 43px;
  1026. line-height: 43px;
  1027. }
  1028. .cashier-tabs .el-tabs__content {
  1029. margin-top: 20px;
  1030. }
  1031. .form-body {
  1032. background-color: #fff;
  1033. padding: 20px 50% 20px 0;
  1034. }
  1035. .button-item {
  1036. margin-top: 12px;
  1037. padding: 9px 25px;
  1038. }
  1039. .form-body .item {
  1040. width: 300px;
  1041. margin-bottom: 50px;
  1042. margin-right: 25px;
  1043. }
  1044. .item-img {
  1045. height: 550px;
  1046. padding: 25px 10px;
  1047. border-radius: 30px;
  1048. border: 1px solid #CCCCCC;
  1049. background-color: #fff;
  1050. }
  1051. .item .el-form-item {
  1052. width: 300px;
  1053. margin: 20px auto;
  1054. }
  1055. .left-setting-menu {
  1056. width: 260px;
  1057. }
  1058. .left-setting-menu .el-form-item {
  1059. height: 60px;
  1060. padding-left: 20px;
  1061. display: flex;
  1062. align-items: center;
  1063. margin-bottom: 0;
  1064. cursor: pointer;
  1065. }
  1066. .left-setting-menu .el-form-item .el-form-item__label {
  1067. cursor: pointer;
  1068. }
  1069. .left-setting-menu .el-form-item.active {
  1070. background-color: #F3F5F6;
  1071. border-top-left-radius: 10px;
  1072. width: 105%;
  1073. border-bottom-left-radius: 10px;
  1074. }
  1075. .left-setting-menu .el-form-item .el-form-item__content {
  1076. margin-left: 0 !important
  1077. }
  1078. .no-radius {
  1079. border-top-left-radius: 0 !important;
  1080. }
  1081. .del-btn {
  1082. position: absolute;
  1083. right: -8px;
  1084. top: -8px;
  1085. padding: 4px 4px;
  1086. }
  1087. .reset {
  1088. position: absolute;
  1089. top: 3px;
  1090. left: 90px;
  1091. }
  1092. .app-tip {
  1093. position: absolute;
  1094. right: 24px;
  1095. top: 16px;
  1096. height: 72px;
  1097. line-height: 72px;
  1098. max-width: calc(100% - 78px);
  1099. }
  1100. .app-tip:before {
  1101. content: ' ';
  1102. width: 0;
  1103. height: 0;
  1104. border-color: inherit;
  1105. position: absolute;
  1106. top: -32px;
  1107. right: 100px;
  1108. border-width: 16px;
  1109. border-style: solid;
  1110. }
  1111. .tip-content {
  1112. display: block;
  1113. white-space: nowrap;
  1114. width: 100%;
  1115. overflow: hidden;
  1116. text-overflow: ellipsis;
  1117. margin: 0 28px;
  1118. font-size: 28px;
  1119. }
  1120. .add-image-btn {
  1121. width: 100px;
  1122. height: 100px;
  1123. color: #419EFB;
  1124. border: 1px solid #e2e2e2;
  1125. cursor: pointer;
  1126. }
  1127. .addon-no-install {
  1128. margin-top: 15px;
  1129. margin-left: 40px;
  1130. }
  1131. .desc-container {
  1132. padding: 20px;
  1133. }
  1134. .el-descriptions__body {
  1135. color: #606266;
  1136. background-color: #FFF;
  1137. padding: 40px;
  1138. }
  1139. .el-descriptions__body .el-descriptions__table .el-descriptions-item__cell {
  1140. line-height: 3;
  1141. }
  1142. .stat-item-label {
  1143. font-size: 18px;
  1144. line-height: 3;
  1145. /* width: 38%; */
  1146. }
  1147. .stat-itme-content {
  1148. font-size: 18px;
  1149. line-height: 3;
  1150. }
  1151. .delele-img-btn {
  1152. position: absolute;
  1153. left: 64px;
  1154. top: -13px;
  1155. }
  1156. .goods-box {
  1157. position: relative;
  1158. left: -104px;
  1159. }
  1160. .mode-switch-btn {
  1161. position: relative;
  1162. left: -106px;
  1163. }
  1164. .mode-switch-box {
  1165. margin-bottom: 30px;
  1166. }
  1167. .form-body {
  1168. padding: 10px 20px 20px;
  1169. background-color: #fff;
  1170. margin-bottom: 30px;
  1171. }
  1172. </style>