setup.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="container">
  3. <view class="list">
  4. <view class="item" v-for="(item,index) in list" :key="index">
  5. <view class="top flex flex-y-center box-pack-between">
  6. <view class="name">{{item.name}}</view>
  7. <view class="flex-y-center">
  8. <view class="del" @click="del(item.id)">删除</view>
  9. </view>
  10. </view>
  11. <navigator :url="`./setup-add?id=${item.id}`"
  12. class="content flex flex-y-center" hover-class="nav-hover">
  13. <view class="cell flex flex-y-center">
  14. <view class="title">支付金额(元):</view>
  15. <view class="desc">{{item.pay_price}}</view>
  16. </view>
  17. <view class="cell flex flex-y-center arr-r">
  18. <view class="title">赠送金额(元):</view>
  19. <view class="desc">{{item.send_price}}</view>
  20. </view>
  21. </navigator>
  22. </view>
  23. <view class="no-more">没有更多内容了~</view>
  24. </view>
  25. <view class="footer-bar">
  26. <view class="content flex flex-center">
  27. <navigator url="./setup-add" class="btn">+新增充值方案</navigator>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. store_id: "",
  37. list: [
  38. {
  39. name:"白金",
  40. },{
  41. name:"黄金",
  42. },
  43. ],
  44. page: 1,
  45. is_bottom: false,
  46. }
  47. },
  48. onLoad(options) {
  49. this.store_id = options.store_id
  50. },
  51. onShow() {
  52. this.getData();
  53. },
  54. onReachBottom() {
  55. },
  56. methods: {
  57. del(id) {
  58. uni.showModal({
  59. title: '提示',
  60. content: '是否要删除?',
  61. showCancel: true,
  62. cancelText: '取消',
  63. confirmText: '确定',
  64. success: res => {
  65. if (res.confirm) {
  66. this.request({
  67. url: 'Smdcshop/recharge_delect',
  68. data: {
  69. id:id,
  70. },
  71. }).then(res => {
  72. console.log(res, "res")
  73. if (res.code === 200 || res.code === "200") {
  74. uni.showToast({
  75. title: "删除成功",
  76. icon: "none",
  77. })
  78. setTimeout(() => {
  79. this.getData(1)
  80. }, 2000)
  81. }
  82. }).catch((res) => {
  83. uni.showToast({
  84. title: res.message,
  85. icon: "none",
  86. })
  87. });
  88. }
  89. },
  90. fail: () => {},
  91. complete: () => {}
  92. });
  93. },
  94. onTypeChange(e) {
  95. console.log(e)
  96. let a = e.detail.value ? 1 : 2;
  97. this.checked(a, e.currentTarget.dataset.index);
  98. },
  99. checked(a, index) {
  100. this.request({
  101. url: 'Smdcshop/print_state',
  102. data: {
  103. is_show: a,
  104. id: this.list[index].id,
  105. },
  106. }).then(res => {
  107. if (res.code == "200") {
  108. uni.showToast({
  109. title: "修改成功",
  110. icon: "none",
  111. })
  112. }
  113. }).catch((res) => {
  114. uni.showToast({
  115. title: res.message,
  116. icon: "none",
  117. })
  118. this.$nextTick(() => {
  119. this.list[index].state = 2
  120. })
  121. });
  122. },
  123. getData() {
  124. this.request({
  125. url: 'Smdcshop/recharge_index',
  126. data: {
  127. admin_id: uni.getStorageSync("admin_id"),
  128. }
  129. }).then(res => {
  130. if (res.code == 200 ) {
  131. this.list = res.data
  132. }
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style>
  139. @import url("../static/css/common.css");
  140. .del {
  141. height: 44rpx;
  142. line-height: 44rpx;
  143. padding: 0 20rpx;
  144. font-size: 24rpx;
  145. background-color: #FF5722;
  146. margin-right:40rpx;
  147. color: #fff;
  148. border-radius: 4rpx;
  149. }
  150. page {
  151. background-color: #F4F5F7;
  152. }
  153. .list {
  154. padding: 30rpx 25rpx;
  155. }
  156. .list .item {
  157. border-radius: 8rpx;
  158. overflow: hidden;
  159. padding-left: 30rpx;
  160. border-left: 8rpx solid #247EFF;
  161. background-color: #fff;
  162. margin-bottom: 30rpx;
  163. }
  164. .list .item .top {
  165. height: 80rpx;
  166. border-bottom: 1rpx solid #f5f5f5;
  167. }
  168. .list .item .top .name {
  169. font-size: 30rpx;
  170. line-height: 80rpx;
  171. font-weight: bold;
  172. }
  173. .list .item .top .type-btn {
  174. zoom: 0.7;
  175. margin-right: 25rpx;
  176. }
  177. .list .item .content {
  178. padding: 20rpx 0 24rpx;
  179. }
  180. .list .item .content .cell {
  181. flex: none;
  182. width: 50%;
  183. box-sizing: border-box;
  184. padding-right: 30rpx;
  185. font-size: 26rpx;
  186. line-height: 37rpx;
  187. color: #666;
  188. }
  189. .list .item .content .cell .title {
  190. color: #99A0AD;
  191. }
  192. </style>