index.blade.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. @extends('layouts.base')
  2. @section('title', '余额设置')
  3. @section('content')
  4. <style>
  5. .el-form-item__label {
  6. width: 300px;
  7. text-align: right;
  8. }
  9. .alert.alert-warning {
  10. border: 1px;
  11. color: red;
  12. border-radius: 3px;
  13. box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(255, 152, 0, 0.4);
  14. background-color: #fcf4f4;
  15. }
  16. .note-span {
  17. width: 290px;
  18. text-align: right;
  19. margin-right: 10px;
  20. }
  21. .el-radio-group {
  22. display: inline-block;
  23. line-height: 1;
  24. vertical-align: inherit;
  25. }
  26. .content{
  27. background: #eff3f6;
  28. padding: 10px!important;
  29. }
  30. .con{
  31. padding-bottom:40px;
  32. position:relative;
  33. border-radius: 8px;
  34. min-height:100vh;
  35. }
  36. .con .setting .block{
  37. padding:10px;
  38. background-color:#fff;
  39. border-radius: 8px;
  40. }
  41. .con .setting .block .title{
  42. font-size:18px;
  43. margin-bottom:15px;
  44. display:flex;
  45. align-items:center;
  46. }
  47. .con .confirm-btn{
  48. width: calc(100% - 266px);
  49. position:fixed;
  50. bottom:0;
  51. right:0;
  52. margin-right:10px;
  53. line-height:63px;
  54. background-color: #ffffff;
  55. box-shadow: 0px 8px 23px 1px
  56. rgba(51, 51, 51, 0.3);
  57. background-color:#fff;
  58. text-align:center;
  59. }
  60. b{
  61. font-size:14px;
  62. }
  63. .el-checkbox__inner{
  64. border:solid 1px #56be69!important;
  65. }
  66. </style>
  67. <div id="app" class="main rightlist">
  68. <div class="con">
  69. <div class="setting">
  70. <div style="align-content: center">
  71. <el-form ref="form" :model="balance">
  72. <div class="block">
  73. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>余额设置</b></div>
  74. <div class="alert alert-warning alert-important" style="margin-left:300px;text-align: center;border-style:solid !important;width: 500px;border-color: red !important;border-radius: 5px">
  75. 余额支付开关、及其他支付设置,请到支付方式查看<a style="color: red" href="{{ yzWebUrl('setting.shop.pay') }}" target="_blank">【点击支付方式设置】</a>.
  76. </div>
  77. <el-form-item label="开启账户充值">
  78. <el-switch
  79. v-model="balance.recharge"
  80. active-color="#13ce66"
  81. inactive-color="#bfbfbf"
  82. active-value="1"
  83. inactive-value="0"
  84. >
  85. </el-switch>
  86. <span class='help-block'>是否允许用户对账户余额进行充值</span>
  87. </el-form-item>
  88. <el-form-item label=" " v-if="balance.recharge==1">
  89. <el-radio-group v-model="balance.recharge_activity">
  90. <el-radio :label="1">启用充值活动</el-radio>
  91. <el-radio :label="0">关闭充值活动</el-radio>
  92. <el-radio v-if="re_recharge_activity==1" :label="2">重置充值活动</el-radio>
  93. <span class='help-block'>开启时需选择活动开始及结束时间、会员最多参与次数(-1,0,空则不限参与次数),重置充值活动:开启新充值活动统计</span>
  94. <div v-if="balance.recharge_activity">
  95. <el-input style="width: 350px;margin-right: 20px"
  96. v-model="balance.recharge_activity_fetter">
  97. <template slot="append">次</template>
  98. <template slot="prepend">会员最多参与次数</template>
  99. </el-input>
  100. <el-date-picker
  101. v-model="recharge_activity_time"
  102. type="datetimerange"
  103. :picker-options="pickerOptions"
  104. value-format="timestamp"
  105. range-separator="至"
  106. start-placeholder="开始日期"
  107. end-placeholder="结束日期"
  108. align="right">
  109. </el-date-picker>
  110. </div>
  111. </el-radio-group>
  112. </el-form-item>
  113. <el-form-item label=" " v-if="balance.recharge==1">
  114. <el-radio-group v-model="balance.proportion_status">
  115. <el-radio label="0">赠送固定金额</el-radio>
  116. <el-radio label="1">赠送充值比例</el-radio>
  117. </el-radio-group>
  118. </el-form-item>
  119. <el-form-item label=" " v-if="balance.recharge==1">
  120. 充值满额送:
  121. <el-button @click="addRechargeItem"><i class='fa fa-plus'></i> 增加优惠项</el-button>
  122. <div v-for="(item,index) in balance.sale" :key="index">
  123. <el-input style="width: 350px;margin-left: 300px;margin-top: 20px" v-model="item.enough">
  124. <template slot="append">赠送</template>
  125. <template slot="prepend">满</template>
  126. </el-input>
  127. <el-input style="width: 350px;;margin-top: 20px" v-model="item.give">
  128. <template v-if="balance.proportion_status==1" slot="append">%</template>
  129. <template v-if="balance.proportion_status==0" slot="append">元</template>
  130. </el-input>
  131. <el-button style="margin-top: 20px" class='btn btn-danger' type='button'
  132. @click="removeRechargeItem(index)"><i
  133. class='fa fa-remove'></i>
  134. </el-button>
  135. </div>
  136. <div v-if="balance.recharge==1" style="margin-left: 300px;line-height: 30px;margin-top: 10px">
  137. <span class="help-block">两项都填写才能生效</span>
  138. <span class="help-block">赠送固定金额:充值满100,赠送10元,实际赠送10元</span>
  139. <span class="help-block">赠送充值比例:充值满200,赠送15%,实际赠送30【200*15%】元</span>
  140. </div>
  141. </el-form-item>
  142. </div>
  143. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  144. <div class="block">
  145. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>余额转账设置</b></div>
  146. <el-form-item label="开启余额转账">
  147. <el-switch
  148. v-model="balance.transfer"
  149. active-color="#13ce66"
  150. inactive-color="#bfbfbf"
  151. active-value="1"
  152. inactive-value="0"
  153. >
  154. </el-switch>
  155. <span class='help-block'>是否允许用户对账户余额进行转账</span>
  156. </el-form-item>
  157. <el-form-item label="余额团队转账">
  158. <el-switch
  159. v-model="balance.team_transfer"
  160. active-color="#13ce66"
  161. inactive-color="#bfbfbf"
  162. active-value="1"
  163. inactive-value="0"
  164. >
  165. </el-switch>
  166. <span class='help-block'>开启后用户只能对团队成员转账</span>
  167. </el-form-item>
  168. </div>
  169. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  170. <div class="block" v-if="is_open">
  171. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>余额转换[[love_name]]设置</b></div>
  172. <el-form-item :label="'余额转换'+love_name">
  173. <el-switch
  174. v-model="balance.love_swich"
  175. active-color="#13ce66"
  176. inactive-color="#bfbfbf"
  177. active-value="1"
  178. inactive-value="0"
  179. >
  180. </el-switch>
  181. <div>
  182. <el-input v-if="balance.love_swich==1" style="width: 350px;;margin-top: 20px"
  183. v-model="balance.love_rate">
  184. <template slot="prepend">余额转换比例</template>
  185. <template slot="append">%</template>
  186. </el-input>
  187. <span style="margin-left: 300px;" class='help-block'>转化实例:实际转化10个 [[love_name]],余额转化比例10%,则需要10 / 10%,比例为空或为0则默认为1:1</span>
  188. </div>
  189. </el-form-item>
  190. </div>
  191. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  192. <div class="block">
  193. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>消息提醒</b></div>
  194. <el-form-item label="开启余额定时提醒">
  195. <el-switch
  196. v-model="balance.sms_send"
  197. active-color="#13ce66"
  198. inactive-color="#bfbfbf"
  199. active-value="1"
  200. inactive-value="0"
  201. >
  202. </el-switch>
  203. <div style="margin-left: 300px;" v-if="balance.sms_send==1">
  204. <el-select style="width: 150px;" v-model="balance.sms_hour" placeholder="请选择">
  205. <el-option
  206. v-for="item in cron_time"
  207. :key="item.value"
  208. :label="item.label"
  209. :value="item.value">
  210. </el-option>
  211. </el-select>
  212. <el-input style="width: 350px;" v-model="balance.sms_hour_amount">
  213. <template slot="prepend">金额超过</template>
  214. <template slot="append">元</template>
  215. </el-input>
  216. </div>
  217. <span style="margin-left: 300px;" class='help-block'>重新设置时间后一定要在一分钟后重启队列,若不重启该设置则会在第二天才生效</span>
  218. </el-form-item>
  219. <el-form-item label="开启余额不足消息提醒">
  220. <el-switch
  221. v-model="balance.blance_floor_on"
  222. active-color="#13ce66"
  223. inactive-color="#bfbfbf"
  224. active-value="1"
  225. inactive-value="0"
  226. >
  227. </el-switch>
  228. </el-form-item>
  229. <el-form-item label="" v-if="balance.blance_floor_on==1">
  230. <div>
  231. <label class="note-span">余额不足</label>
  232. <el-input style="width: 350px;" v-model="balance.blance_floor">
  233. <template slot="prepend">余额不足</template>
  234. <template slot="append">元</template>
  235. </el-input>
  236. </div>
  237. <div>
  238. <label class="note-span">消息通知类型</label>
  239. <el-radio-group v-model="balance.balance_message_type">
  240. <el-radio label="1">指定会员</el-radio>
  241. <el-radio label="2">指定会员等级</el-radio>
  242. <el-radio label="3">指定会员分组</el-radio>
  243. </el-radio-group>
  244. </div>
  245. <div style="margin-top: 20px" v-if="balance.balance_message_type==1">
  246. <label class="note-span">选择指定会员:</label>
  247. <el-input style="width: 350px;" v-model="balance.uids"></el-input>
  248. <span style="margin-left: 300px" class='help-block'>请填写会员id,会员id之间用英文逗号隔开</span>
  249. </div>
  250. <div style="margin-top: 20px" v-if="balance.balance_message_type==2">
  251. <label class="note-span">使用条件 - 会员等级</label>
  252. <el-select style="width: 150px;" v-model="balance.level_limit" placeholder="请选择">
  253. <el-option
  254. v-for="item in memberLevels"
  255. :key="item.id"
  256. :label="item.level_name"
  257. :value="item.id">
  258. </el-option>
  259. </el-select>
  260. </div>
  261. <div style="margin-top: 20px" v-if="balance.balance_message_type==3">
  262. <label class="note-span">使用条件 - 会员分组</label>
  263. <el-select style="width: 150px;" v-model="balance.group_type" placeholder="请选择">
  264. <el-option
  265. v-for="item in group_type"
  266. :key="item.id"
  267. :label="item.group_name"
  268. :value="item.id">
  269. </el-option>
  270. </el-select>
  271. </div>
  272. </el-form-item>
  273. </div>
  274. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  275. <div class="block">
  276. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>余额抵扣设置</b></div>
  277. <el-form-item label="余额抵扣">
  278. <el-switch
  279. v-model="balance.balance_deduct"
  280. active-color="#13ce66"
  281. inactive-color="#bfbfbf"
  282. active-value="1"
  283. inactive-value="0"
  284. >
  285. </el-switch>
  286. <span style="margin-left: 300px" class='help-block'>开启后订单不支持余额支付</span>
  287. <div style="margin-top: 20px" v-if="balance.balance_deduct==1">
  288. <label class="note-span">商品抵扣</label>
  289. <el-input style="width: 350px;" v-model="balance.money_max">
  290. <template slot="append">%</template>
  291. <template slot="prepend">最多可抵扣</template>
  292. </el-input>
  293. <span style="margin-left: 300px" class='help-block'>商品最高抵扣比例</span>
  294. </div>
  295. </el-form-item>
  296. <el-form-item label="余额返还">
  297. <el-switch
  298. v-model="balance.balance_deduct_rollback"
  299. active-color="#13ce66"
  300. inactive-color="#bfbfbf"
  301. active-value="1"
  302. inactive-value="0"
  303. >
  304. </el-switch>
  305. <span style="margin-left: 300px" class='help-block'>开启余额返还:未付款订单、退款订单关闭订单后,用于抵扣的余额返还到会员账户</span>
  306. </el-form-item>
  307. </div>
  308. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  309. <div class="block">
  310. <div class="title"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>余额充值设置</b></div>
  311. <el-form-item label="充值余额赠送积分">
  312. <el-switch
  313. v-model="balance.charge_reward_swich"
  314. active-color="#13ce66"
  315. inactive-color="#bfbfbf"
  316. active-value="1"
  317. inactive-value="0"
  318. >
  319. </el-switch>
  320. <div style="margin-top: 20px" v-if="balance.charge_reward_swich==1">
  321. <el-input style="margin-left: 300px;width: 350px;" v-model="balance.charge_reward_rate">
  322. <template slot="append">%</template>
  323. <template slot="prepend">余额转换比例</template>
  324. </el-input>
  325. <span style="margin-left: 300px" class='help-block'>转化实例:实际赠送10积分,余额转化比例10%,则需要充值10 / 10%,比例为空或为0则默认为1:1</span>
  326. </div>
  327. </el-form-item>
  328. <el-form-item label="充值余额审核">
  329. <el-switch
  330. v-model="balance.charge_check_swich"
  331. active-color="#13ce66"
  332. inactive-color="#bfbfbf"
  333. active-value="1"
  334. inactive-value="0"
  335. >
  336. </el-switch>
  337. <span style="margin-left: 300px" class='help-block'>开启后,后台手动充值余额需要审核后才充值成功,与前端充值以及后台批量充值无关</span>
  338. </el-form-item>
  339. <el-form-item label="收入提现赠送余额">
  340. <el-switch
  341. v-model="balance.income_withdraw_award"
  342. active-color="#13ce66"
  343. inactive-color="#bfbfbf"
  344. active-value="1"
  345. inactive-value="0"
  346. >
  347. </el-switch>
  348. <div v-if="balance.income_withdraw_award==1">
  349. <div style="margin-top: 20px">
  350. <label class="note-span">赠送余额比例 (统一设置)</label>
  351. <el-input style="width: 350px;" v-model="balance.income_withdraw_award_rate">
  352. <template slot="append">%</template>
  353. </el-input>
  354. </div>
  355. <div style="margin-top: 20px">
  356. <label class="note-span">赠送余额比例 (微信独立)</label>
  357. <el-input style="width: 350px;" v-model="balance.income_withdraw_wechat_rate">
  358. <template slot="append">%</template>
  359. </el-input>
  360. </div>
  361. <div v-if="high_light_open==1" style="margin-top: 20px">
  362. <label class="note-span">赠送余额比例 (高灯独立)</label>
  363. <el-input style="width: 350px;" v-model="balance.income_withdraw_light_rate">
  364. <template slot="append">%</template>
  365. </el-input>
  366. </div>
  367. </div>
  368. </el-form-item>
  369. <el-form-item v-if="balance.income_withdraw_award==1" label="收入提现赠送说明">
  370. <el-input
  371. style="width: 600px;"
  372. type="textarea"
  373. placeholder="请输入内容"
  374. v-model="balance.income_withdraw_award_explain">
  375. </el-input>
  376. <span style="margin-left: 300px" class='help-block'>收入提现页面提现成功自定义提示语,变量:[奖励余额]</span>
  377. </el-form-item>
  378. </div>
  379. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  380. <el-form-item>
  381. <el-button style="margin-left: 300px" type="primary" @click="onSubmit">提交</el-button>
  382. </el-form-item>
  383. </el-form>
  384. </div>
  385. </div>
  386. </div>
  387. </div>
  388. <script>
  389. var app = new Vue({
  390. el: "#app",
  391. delimiters: ['[[', ']]'],
  392. name: 'test',
  393. data() {
  394. return {
  395. balance: {},
  396. love_name: '',
  397. cron_time: [],
  398. re_recharge_activity: 0,
  399. memberLevels: [],
  400. group_type: [],
  401. is_open: '',
  402. recharge_activity_time: [],
  403. high_light_open: 0,
  404. pickerOptions: {
  405. shortcuts: [{
  406. text: '最近一周',
  407. onClick(picker) {
  408. const end = new Date();
  409. const start = new Date();
  410. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  411. picker.$emit('pick', [start, end]);
  412. }
  413. }, {
  414. text: '最近一个月',
  415. onClick(picker) {
  416. const end = new Date();
  417. const start = new Date();
  418. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  419. picker.$emit('pick', [start, end]);
  420. }
  421. }, {
  422. text: '最近三个月',
  423. onClick(picker) {
  424. const end = new Date();
  425. const start = new Date();
  426. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  427. picker.$emit('pick', [start, end]);
  428. }
  429. }]
  430. },
  431. }
  432. },
  433. created() {
  434. this.cronSelect()
  435. this.getData()
  436. },
  437. mounted() {
  438. },
  439. methods: {
  440. cronSelect() {
  441. for (let i = 1; i < 24; i++) {
  442. this.cron_time.push(
  443. {
  444. value: i + '',
  445. label: '每天' + i + ':00' + '点'
  446. }
  447. )
  448. }
  449. },
  450. getData() {
  451. this.$http.post("{!! yzWebFullUrl('finance.balance-set.see') !!}", {}).then(response => {
  452. if (response.data.result == 1) {
  453. this.balance = response.data.data.balance
  454. this.re_recharge_activity = response.data.data.balance.recharge_activity
  455. this.love_name = response.data.data.love_name
  456. this.memberLevels = response.data.data.memberLevels
  457. this.group_type = response.data.data.group_type
  458. this.is_open = response.data.data.is_open
  459. this.recharge_activity_time[0] = this.balance.recharge_activity_start ? this.balance.recharge_activity_start : ''
  460. this.recharge_activity_time[1] = this.balance.recharge_activity_end ? this.balance.recharge_activity_end : ''
  461. this.high_light_open = response.data.data.high_light_open
  462. console.log(this.recharge_activity_time)
  463. } else {
  464. this.$message.error(response.data.msg);
  465. }
  466. this.table_loading = false;
  467. }), function (res) {
  468. console.log(res);
  469. this.table_loading = false;
  470. };
  471. },
  472. onSubmit() {
  473. let loading = this.$loading({
  474. target: document.querySelector(".content"),
  475. background: 'rgba(0, 0, 0, 0)'
  476. });
  477. this.balance.recharge_activity_time = {
  478. start: this.recharge_activity_time[0],
  479. end: this.recharge_activity_time[1]
  480. }
  481. console.log(this.balance.recharge_activity_time)
  482. this.$http.post("{!! yzWebFullUrl('finance.balance-set.store') !!}", {'balance': this.balance}).then(response => {
  483. if (response.data.result == 1) {
  484. this.$message.success(response.data.msg);
  485. loading.close()
  486. } else {
  487. this.$message.error(response.data.msg);
  488. loading.close()
  489. }
  490. this.table_loading = false;
  491. }), function (res) {
  492. console.log(res);
  493. this.table_loading = false;
  494. };
  495. },
  496. addRechargeItem() {
  497. this.balance.sale.push({
  498. 'enough': 0,
  499. 'give': 0
  500. })
  501. },
  502. removeRechargeItem(index) {
  503. this.balance.sale.splice(index, 1)
  504. }
  505. },
  506. })
  507. </script>
  508. @endsection