user-enit.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view class="container">
  3. <form @submit="onSubmit">
  4. <view class="page-block">
  5. <view class="content">
  6. <view class="cell flex flex-y-center arr-r">
  7. <view class="title-block required">
  8. <text>会员等级</text>
  9. </view>
  10. <view class="desc">
  11. <picker mode="selector" :range="level_list" @change="onPrinterAddrChange" range-key="name">
  12. <view :class="[printerType?'':'desc-placeholder','input-box']">
  13. {{level_list[level_idx].name || '请选择'}}
  14. </view>
  15. </picker>
  16. </view>
  17. </view>
  18. <view class="cell flex flex-y-center">
  19. <view class="title-block required">
  20. <text>联系方式</text>
  21. </view>
  22. <view class="desc">
  23. <input type="num" :value="mobile" name="mobile" class="input-box" placeholder="联系方式"
  24. placeholder-class="desc-placeholder">
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="footer-bar-nav">
  30. <view @click="recharge" class="content flex flex-center" style="background: none;">
  31. <view class="btn1" hover-class="none">
  32. 充值
  33. </view>
  34. </view>
  35. <view class="content flex flex-center" style="background: none;">
  36. <button class="btn2" hover-class="none" form-type="submit">
  37. 修改
  38. </button>
  39. </view>
  40. </view>
  41. </form>
  42. <uni-popup-top ref="popup" type="center" :maskClass="maskClass">
  43. <view class="rechargeContent page-block">
  44. <form @submit="onSubmitForm">
  45. <view class="content" style="padding: 30rpx;">
  46. <view class="cell flex flex-y-center arr-r">
  47. <view class="title-block required">
  48. <text>充值:</text>
  49. </view>
  50. <view class="desc" @click="onPrinterStatusChange">
  51. {{printerStatus}}
  52. </view>
  53. </view>
  54. <view class="cell flex flex-y-center">
  55. <view class="title-block required">
  56. <text>数量:</text>
  57. </view>
  58. <view class="desc">
  59. <input type="num" name="number" class="input-box" placeholder="数量"
  60. placeholder-class="desc-placeholder">
  61. </view>
  62. </view>
  63. <button class="btn3" form-type="submit">
  64. 充值
  65. </button>
  66. </view>
  67. </form>
  68. </view>
  69. </uni-popup-top>
  70. </view>
  71. </template>
  72. <script>
  73. import uniPopupTop from '@/components/zx-uni-popup/uni-popup-top.vue'
  74. export default {
  75. components: {
  76. uniPopupTop
  77. },
  78. data() {
  79. return {
  80. printerStatus: '余额充值',
  81. state: 1,
  82. is_integral: 0,
  83. device_type: 1,
  84. tableType: "",
  85. store_id: "",
  86. info: {},
  87. obj: {},
  88. game_index: -1,
  89. level_name: null,
  90. level_list: [],
  91. mobile: '',
  92. id: '',
  93. level_idx: -1,
  94. maskClass: {
  95. 'position': 'fixed',
  96. 'bottom': 0,
  97. 'top': 0,
  98. 'left': 0,
  99. 'right': 0,
  100. 'backgroundColor': 'rgba(0, 0, 0, 0.4)'
  101. },
  102. }
  103. },
  104. onLoad(e) {
  105. this.mobile = e.mobile;
  106. this.level_name = Number(e.level_name);
  107. this.id = e.id;
  108. this.admin_id = uni.getStorageSync("admin_id");
  109. this.level_index();
  110. },
  111. methods: {
  112. onSubmitForm(e) {
  113. this.request({
  114. url: 'Smdcshop/chongzhi',
  115. data: {
  116. id: this.id,
  117. is_cancel: this.state,
  118. number: e.detail.value.number,
  119. },
  120. }).then(res => {
  121. if (res.code == 200) {
  122. uni.showToast({
  123. title: res.message,
  124. icon: 'none'
  125. })
  126. setTimeout(() => {
  127. uni.navigateBack()
  128. }, 2000)
  129. }
  130. }).catch((res) => {
  131. uni.showToast({
  132. title: res.message,
  133. icon: 'none'
  134. })
  135. });
  136. },
  137. onPrinterStatusChange() {
  138. let statusArr = ['余额充值', '积分充值']
  139. uni.showActionSheet({
  140. itemList: statusArr,
  141. success: (r) => {
  142. this.state = Number(r.tapIndex) + 1
  143. this.printerStatus = statusArr[r.tapIndex]
  144. }
  145. })
  146. },
  147. recharge(e) {
  148. this.$refs.popup.open();
  149. },
  150. onPrinterAddrChange(e) {
  151. console.log(e, this.level_list, "e")
  152. let num = Number(e.detail.value);
  153. this.game_index = this.level_list[num].level;
  154. this.level_idx = num;
  155. console.log(e, this.level_list, "e")
  156. },
  157. level_index() {
  158. this.request({
  159. url: "Smdcshop/level_index",
  160. data: {
  161. admin_id: uni.getStorageSync("admin_id"),
  162. },
  163. }).then(res => {
  164. console.log(res, "res")
  165. if (res.code === '200') {
  166. res.data.unshift({
  167. name: '普通会员',
  168. level: 0,
  169. });
  170. let level_list = res.data;
  171. console.log(level_list, "level_list")
  172. var game_index = level_list.findIndex(item => item.level === this.level_name);
  173. this.level_list = level_list;
  174. this.game_index = game_index;
  175. this.level_idx = game_index;
  176. console.log(this.game_index, "this.game_index")
  177. }
  178. });
  179. },
  180. onSubmit(e) {
  181. let params = e.detail.value,
  182. url = 'Smdcshop/user_edit';
  183. params.admin_id = this.admin_id;
  184. params.user_level = this.game_index;
  185. params.id = this.id;
  186. this.request({
  187. url,
  188. data: params
  189. }).then(res => {
  190. if (res.code == 200) {
  191. uni.showToast({
  192. title: res.message,
  193. icon: 'none'
  194. })
  195. setTimeout(() => {
  196. uni.navigateBack()
  197. }, 2000)
  198. }
  199. }).catch((res) => {
  200. uni.showToast({
  201. title: res.message,
  202. icon: 'none'
  203. })
  204. });
  205. },
  206. }
  207. }
  208. </script>
  209. <style>
  210. @import url("../static/css/common.css");
  211. page {
  212. background-color: #F4F5F7;
  213. }
  214. .rechargeContent {
  215. background: #FFF;
  216. width: 600rpx;
  217. border-radius:10rpx;
  218. }
  219. /* */
  220. .footer-bar-nav {
  221. position: fixed;
  222. left: 0;
  223. bottom: 20rpx;
  224. width: 100%;
  225. }
  226. .footer-bar-nav .content {
  227. background-color: #fff;
  228. z-index: 100;
  229. /*兼容 IOS<11.2*/
  230. padding-bottom: constant(safe-area-inset-bottom);
  231. /*兼容 IOS>11.2*/
  232. padding-bottom: env(safe-area-inset-bottom);
  233. -webkit-box-sizing: content-box;
  234. box-sizing: content-box;
  235. -webkit-box-shadow: 0 -5rpx 10rpx #eee;
  236. box-shadow: 0 -5rpx 10rpx #eee;
  237. }
  238. .footer-bar-nav .content .btn1 {
  239. width: 700rpx;
  240. height: 100rpx;
  241. background: -webkit-linear-gradient(135deg, #3387ff 2%, #569bff 99%);
  242. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  243. border-radius: 8rpx;
  244. -webkit-box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  245. box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  246. text-align: center;
  247. line-height: 100rpx;
  248. font-size: 36rpx;
  249. font-weight: 500;
  250. color: #fff;
  251. }
  252. .footer-bar-nav .content .btn2 {
  253. width: 700rpx;
  254. height: 100rpx;
  255. background: -webkit-linear-gradient(135deg, #3387ff 2%, #569bff 99%);
  256. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  257. border-radius: 8rpx;
  258. -webkit-box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  259. box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  260. text-align: center;
  261. line-height: 100rpx;
  262. font-size: 36rpx;
  263. font-weight: 500;
  264. color: #fff;
  265. }
  266. .btn3 {
  267. width: 400rpx;
  268. height: 100rpx;
  269. background: -webkit-linear-gradient(135deg, #3387ff 2%, #569bff 99%);
  270. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  271. border-radius: 8rpx;
  272. -webkit-box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  273. box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  274. text-align: center;
  275. line-height: 100rpx;
  276. font-size: 36rpx;
  277. font-weight: 500;
  278. color: #fff;
  279. margin: 0 auto;
  280. margin-top: 30rpx;
  281. }
  282. </style>