config.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <base-page>
  3. <view class="common-wrap common-form fixd common-scrollbar">
  4. <view class="common-title">收款设置</view>
  5. <view class="common-form-item">
  6. <label class="form-label">优惠减现</label>
  7. <view class="form-inline">
  8. <radio-group @change="config.reduction = $event.detail.value" class="form-radio-group">
  9. <label class="radio form-radio-item">
  10. <radio value="1" :checked="config.reduction == 1" />
  11. 启用
  12. </label>
  13. <label class="radio form-radio-item">
  14. <radio value="0" :checked="config.reduction == 0" />
  15. 关闭
  16. </label>
  17. </radio-group>
  18. </view>
  19. </view>
  20. <view class="common-form-item">
  21. <label class="form-label">积分抵扣</label>
  22. <view class="form-inline">
  23. <radio-group @change="config.point = $event.detail.value" class="form-radio-group">
  24. <label class="radio form-radio-item">
  25. <radio value="1" :checked="config.point == 1" />
  26. 启用
  27. </label>
  28. <label class="radio form-radio-item">
  29. <radio value="0" :checked="config.point == 0" />
  30. 关闭
  31. </label>
  32. </radio-group>
  33. </view>
  34. <text class="form-word-aux-line">积分抵扣需要平台开启,同时配置积分抵扣金额比率</text>
  35. </view>
  36. <view class="common-form-item">
  37. <label class="form-label">使用余额</label>
  38. <view class="form-inline">
  39. <radio-group @change="config.balance = $event.detail.value" class="form-radio-group">
  40. <label class="radio form-radio-item">
  41. <radio value="1" :checked="config.balance == 1" />
  42. 启用
  43. </label>
  44. <label class="radio form-radio-item">
  45. <radio value="0" :checked="config.balance == 0" />
  46. 关闭
  47. </label>
  48. </radio-group>
  49. </view>
  50. </view>
  51. <view v-show="config.balance == 1">
  52. <view class="common-form-item">
  53. <label class="form-label">余额使用安全验证</label>
  54. <view class="form-inline">
  55. <radio-group @change="config.balance_safe = $event.detail.value" class="form-radio-group">
  56. <label class="radio form-radio-item">
  57. <radio value="1" :checked="config.balance_safe == 1" />
  58. 启用
  59. </label>
  60. <label class="radio form-radio-item">
  61. <radio value="0" :checked="config.balance_safe == 0" />
  62. 关闭
  63. </label>
  64. </radio-group>
  65. </view>
  66. <text class="form-word-aux-line">关闭之后直接使用余额进行抵扣,无需会员验证</text>
  67. </view>
  68. <view class="common-form-item" v-show="config.balance_safe == 1">
  69. <label class="form-label">手机号验证</label>
  70. <view class="form-inline">
  71. <radio-group @change="config.sms_verify = $event.detail.value" class="form-radio-group">
  72. <label class="radio form-radio-item">
  73. <radio value="1" :checked="config.sms_verify == 1" />
  74. 启用
  75. </label>
  76. <label class="radio form-radio-item">
  77. <radio value="0" :checked="config.sms_verify == 0" />
  78. 关闭
  79. </label>
  80. </radio-group>
  81. </view>
  82. <text class="form-word-aux-line">使用余额安全验证时是否可以使用短信验证码验证</text>
  83. </view>
  84. </view>
  85. <view class="common-form-item">
  86. <label class="form-label">收款方式</label>
  87. <view class="form-inline">
  88. <checkbox-group class="form-checkbox-group" @change="config.pay_type = $event.detail.value">
  89. <label class="form-checkbox-item">
  90. <checkbox value="third" :checked="config.pay_type.indexOf('third') != -1" />
  91. 付款码支付
  92. </label>
  93. <label class="form-checkbox-item">
  94. <checkbox value="cash" :checked="config.pay_type.indexOf('cash') != -1" />
  95. 现金支付
  96. </label>
  97. <label class="form-checkbox-item">
  98. <checkbox value="own_wechatpay" :checked="config.pay_type.indexOf('own_wechatpay') != -1" />
  99. 个人微信
  100. </label>
  101. <label class="form-checkbox-item">
  102. <checkbox value="own_alipay" :checked="config.pay_type.indexOf('own_alipay') != -1" />
  103. 个人支付宝
  104. </label>
  105. <label class="form-checkbox-item">
  106. <checkbox value="own_pos" :checked="config.pay_type.indexOf('own_pos') != -1" />
  107. 个人POS刷卡
  108. </label>
  109. </checkbox-group>
  110. </view>
  111. <text class="form-word-aux-line">付款码支付:扫描会员微信或支付宝付款码进行收款</text>
  112. </view>
  113. <view class="common-btn-wrap"><button type="default" class="screen-btn" @click="saveFn">保存</button></view>
  114. </view>
  115. </base-page>
  116. </template>
  117. <script>
  118. export default {
  119. data() {
  120. return {
  121. config: {
  122. reduction: 1,
  123. point: 1,
  124. balance: 1,
  125. balance_safe: 0,
  126. sms_verify: 0,
  127. pay_type: ['third', 'cash', 'own_wechatpay', 'own_alipay', 'own_pos']
  128. },
  129. isRepeat: false
  130. };
  131. },
  132. onLoad() {
  133. this.getData();
  134. },
  135. onShow() {},
  136. methods: {
  137. getData() {
  138. this.$api.sendRequest({
  139. url: '/cashier/storeapi/cashier/getcashiercollectmoneyconfig',
  140. success: res => {
  141. if (res.code >= 0) {
  142. this.config = res.data;
  143. }
  144. }
  145. });
  146. },
  147. saveFn() {
  148. if (!this.config.pay_type.length) {
  149. this.$util.showToast({ title: '至少需启用一种收款方式' });
  150. return;
  151. }
  152. if (this.isRepeat) return;
  153. this.isRepeat = true;
  154. let data = this.$util.deepClone(this.config);
  155. data.pay_type = JSON.stringify(data.pay_type);
  156. this.$api.sendRequest({
  157. url: '/cashier/storeapi/cashier/setcashiercollectmoneyconfig',
  158. data,
  159. success: res => {
  160. this.isRepeat = false;
  161. if (res.code >= 0) {
  162. this.$util.showToast({
  163. title: '设置成功'
  164. });
  165. } else {
  166. this.$util.showToast({
  167. title: res.message
  168. });
  169. }
  170. }
  171. });
  172. }
  173. }
  174. };
  175. </script>
  176. <style lang="scss">
  177. .common-wrap {
  178. padding: 30rpx;
  179. height: 100vh;
  180. overflow-y: auto;
  181. }
  182. .form-input {
  183. font-size: 0.16rem;
  184. }
  185. .form-input-inline.btn {
  186. height: 0.37rem;
  187. line-height: 0.35rem;
  188. box-sizing: border-box;
  189. border: 0.01rem solid #e6e6e6;
  190. text-align: center;
  191. cursor: pointer;
  192. }
  193. .common-title {
  194. font-size: 0.18rem;
  195. margin-bottom: 0.2rem;
  196. }
  197. .radio-input {
  198. width: 0.6rem;
  199. height: 0.35rem;
  200. line-height: 0.35rem;
  201. padding: 0 0.1rem;
  202. margin: 0 0.1rem;
  203. border: 0.01rem solid #eee;
  204. &.disabled {
  205. background: #f5f5f5;
  206. }
  207. }
  208. .time-operation {
  209. color: $primary-color;
  210. cursor: pointer;
  211. }
  212. .common-form .common-form-item .form-label {
  213. width: 1.5rem;
  214. }
  215. .common-form .common-form-item .form-word-aux-line {
  216. margin-left: 1.5rem;
  217. }
  218. </style>