guige.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view style="padding-bottom: 70px;">
  3. <view>
  4. <view class="" >
  5. <view class="bg btnbox" v-for="(item,index) in list" :key="index" v-if="list.length>0">
  6. <view class="padding-sm" style="color:#666666;">创建时间: {{item.createTime}}</view>
  7. <view style="width:100%;border-top: 1upx solid #E6E6E6;"></view>
  8. <view class="padding-sm">
  9. <view class="text-lg text-bold" style="color:#333333;">{{item.ruleName}}</view>
  10. <view v-for="(name,index) in item.ruleValue">
  11. <view class="flex align-center padding-top">
  12. <view style="color:#999999;">{{name.value}}:</view>
  13. <view v-for="(ite,index) in name.detail" :key="index">{{ite}}
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="flex justify-end padding-tb">
  19. <view class="btn " @click="bindupdete(item)">删除</view>
  20. <view class="btn1" @click="bindeditor(item)">重新编辑</view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="addguige text-bold" @click="goEditor()">添加</view>
  25. </view>
  26. <empty v-if="!list.length" style="z-index:0"></empty>
  27. </view>
  28. </template>
  29. <script>
  30. import empty from '@/components/empty.vue'
  31. export default {
  32. components: {
  33. empty
  34. },
  35. data() {
  36. return {
  37. list: [],
  38. shopId:'',
  39. shopName:'',
  40. }
  41. },
  42. onLoad() {
  43. uni.showLoading({
  44. title: '加载中...',
  45. mask: true, // 是否显示透明蒙层,防止触摸穿透
  46. })
  47. this.shopId = this.$queue.getData("shopId")
  48. this.shopName = this.$queue.getData("shopUserName")
  49. this.getlist()
  50. },
  51. onShow() {
  52. this.getlist()
  53. },
  54. methods: {
  55. goEditor() {
  56. uni.navigateTo({
  57. url: '/my/store/editor'
  58. })
  59. },
  60. getlist() {
  61. let data = {
  62. shopId: this.shopId
  63. }
  64. this.$Request.getA("/selfGoodsRule/list", data).then(res => {
  65. uni.hideLoading()
  66. if (res.code == 0) {
  67. this.list = res.data
  68. for (var i = 0; i < this.list.length; i++) {
  69. for (var a = 0; a < this.list[i].ruleValue.length; a++) {
  70. // this.list[i].ruleValue[a].detail = this.list[i].ruleValue[a].detail.split(',')
  71. this.list[i].ruleValue[a].detail = this.list[i].ruleValue[a].detail.replaceAll(',','/')
  72. }
  73. }
  74. }
  75. });
  76. },
  77. //重新编辑
  78. bindeditor(e) {
  79. console.log(e)
  80. uni.setStorageSync('guige', e)
  81. uni.navigateTo({
  82. url: '/my/store/editor?id=' + e.id
  83. })
  84. },
  85. //删除
  86. bindupdete(e) {
  87. uni.showModal({
  88. title: '提示',
  89. content: '确定要删除当前规格吗?',
  90. cancelText: "取消", // 取消按钮的文字
  91. confirmText: "确定", // 确认按钮文字
  92. showCancel: true, // 是否显示取消按钮,默认为 true
  93. confirmColor: '#f55850',
  94. cancelColor: '#39B54A',
  95. success: (res) => {
  96. if (res.confirm) {
  97. let data = {
  98. id: e.id
  99. }
  100. this.$Request.getA("/selfGoodsRule/delete", data).then(res => {
  101. if (res.code == 0) {
  102. uni.showToast({
  103. title: "删除成功",
  104. icon: 'none'
  105. })
  106. this.getlist();
  107. }else{
  108. uni.showModal({
  109. title: '提示',
  110. content: res.msg,
  111. success: function (res) {
  112. if (res.confirm) {
  113. } else if (res.cancel) {
  114. }
  115. }
  116. });
  117. }
  118. });
  119. } else {
  120. }
  121. }
  122. })
  123. console.log(e)
  124. },
  125. },
  126. onReachBottom: function() {
  127. // this.page = this.page + 1;
  128. // this.getlist();
  129. // if (this.totalCount == this.getlist.length) {
  130. // uni.showToast({
  131. // title: '已经到底了~',
  132. // icon: 'none'
  133. // })
  134. // }
  135. },
  136. onPullDownRefresh: function() {
  137. // this.page = 1;
  138. // this.getlist();
  139. },
  140. }
  141. </script>
  142. <style>
  143. page {
  144. background: #F2F2F2;
  145. }
  146. .bg {
  147. background: #FFFFFF;
  148. }
  149. .btnbox {
  150. margin: 20rpx 30rpx;
  151. border-radius: 20rpx;
  152. }
  153. .btn {
  154. border-radius: 25px;
  155. padding: 6rpx 30rpx;
  156. border: 1px solid #686868;
  157. color: #686868;
  158. margin-right: 30rpx;
  159. }
  160. .btn1 {
  161. border-radius: 25px;
  162. padding: 6rpx 30rpx;
  163. background: #FCD202;
  164. /* color: #686868; */
  165. margin-right: 30rpx;
  166. }
  167. .addguige {
  168. width: 90%;
  169. margin: 0 auto;
  170. background: #FCD202;
  171. box-shadow: 0px 10upx 20upx 0px #FFD9B3;
  172. border-radius: 16upx;
  173. text-align: center;
  174. height: 88upx;
  175. line-height: 88upx;
  176. position: fixed;
  177. bottom: 25upx;
  178. left: 0;
  179. right: 0;
  180. z-index: 99;
  181. }
  182. </style>