guige.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. })
  46. this.shopId = this.$queue.getData("shopId")
  47. this.shopName = this.$queue.getData("shopUserName")
  48. this.getlist()
  49. },
  50. onShow() {
  51. this.getlist()
  52. },
  53. methods: {
  54. goEditor() {
  55. uni.navigateTo({
  56. url: '/my/store/editor'
  57. })
  58. },
  59. getlist() {
  60. let data = {
  61. shopId: this.shopId
  62. }
  63. this.$Request.getA("/selfGoodsRule/list", data).then(res => {
  64. uni.hideLoading()
  65. if (res.code == 0) {
  66. this.list = res.data
  67. for (var i = 0; i < this.list.length; i++) {
  68. for (var a = 0; a < this.list[i].ruleValue.length; a++) {
  69. // this.list[i].ruleValue[a].detail = this.list[i].ruleValue[a].detail.split(',')
  70. this.list[i].ruleValue[a].detail = this.list[i].ruleValue[a].detail.replaceAll(',','/')
  71. }
  72. }
  73. }
  74. });
  75. },
  76. //重新编辑
  77. bindeditor(e) {
  78. console.log(e)
  79. uni.setStorageSync('guige', e)
  80. uni.navigateTo({
  81. url: '/my/store/editor?id=' + e.id
  82. })
  83. },
  84. //删除
  85. bindupdete(e) {
  86. uni.showModal({
  87. title: '提示',
  88. content: '确定要删除当前规格吗?',
  89. cancelText: "取消", // 取消按钮的文字
  90. confirmText: "确定", // 确认按钮文字
  91. showCancel: true, // 是否显示取消按钮,默认为 true
  92. confirmColor: '#f55850',
  93. cancelColor: '#39B54A',
  94. success: (res) => {
  95. if (res.confirm) {
  96. let data = {
  97. id: e.id
  98. }
  99. this.$Request.getA("/selfGoodsRule/delete", data).then(res => {
  100. if (res.code == 0) {
  101. uni.showToast({
  102. title: "删除成功",
  103. icon: 'none'
  104. })
  105. this.getlist();
  106. }else{
  107. uni.showToast({
  108. title: res.msg,
  109. icon: 'none'
  110. })
  111. }
  112. });
  113. } else {
  114. }
  115. }
  116. })
  117. console.log(e)
  118. },
  119. },
  120. onReachBottom: function() {
  121. // this.page = this.page + 1;
  122. // this.getlist();
  123. // if (this.totalCount == this.getlist.length) {
  124. // uni.showToast({
  125. // title: '已经到底了~',
  126. // icon: 'none'
  127. // })
  128. // }
  129. },
  130. onPullDownRefresh: function() {
  131. // this.page = 1;
  132. // this.getlist();
  133. },
  134. }
  135. </script>
  136. <style>
  137. page {
  138. background: #F2F2F2;
  139. }
  140. .bg {
  141. background: #FFFFFF;
  142. }
  143. .btnbox {
  144. margin: 20rpx 30rpx;
  145. border-radius: 20rpx;
  146. }
  147. .btn {
  148. border-radius: 25px;
  149. padding: 6rpx 30rpx;
  150. border: 1px solid #686868;
  151. color: #686868;
  152. margin-right: 30rpx;
  153. }
  154. .btn1 {
  155. border-radius: 25px;
  156. padding: 6rpx 30rpx;
  157. background: #FCD202;
  158. /* color: #686868; */
  159. margin-right: 30rpx;
  160. }
  161. .addguige {
  162. width: 90%;
  163. margin: 0 auto;
  164. background: #FCD202;
  165. box-shadow: 0px 10upx 20upx 0px #FFD9B3;
  166. border-radius: 16upx;
  167. text-align: center;
  168. height: 88upx;
  169. line-height: 88upx;
  170. position: fixed;
  171. bottom: 25upx;
  172. left: 0;
  173. right: 0;
  174. z-index: 99;
  175. }
  176. </style>