guige.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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.showModal({
  108. title: '提示',
  109. content: res.msg,
  110. success: function (res) {
  111. if (res.confirm) {
  112. } else if (res.cancel) {
  113. }
  114. }
  115. });
  116. }
  117. });
  118. } else {
  119. }
  120. }
  121. })
  122. console.log(e)
  123. },
  124. },
  125. onReachBottom: function() {
  126. // this.page = this.page + 1;
  127. // this.getlist();
  128. // if (this.totalCount == this.getlist.length) {
  129. // uni.showToast({
  130. // title: '已经到底了~',
  131. // icon: 'none'
  132. // })
  133. // }
  134. },
  135. onPullDownRefresh: function() {
  136. // this.page = 1;
  137. // this.getlist();
  138. },
  139. }
  140. </script>
  141. <style>
  142. page {
  143. background: #F2F2F2;
  144. }
  145. .bg {
  146. background: #FFFFFF;
  147. }
  148. .btnbox {
  149. margin: 20rpx 30rpx;
  150. border-radius: 20rpx;
  151. }
  152. .btn {
  153. border-radius: 25px;
  154. padding: 6rpx 30rpx;
  155. border: 1px solid #686868;
  156. color: #686868;
  157. margin-right: 30rpx;
  158. }
  159. .btn1 {
  160. border-radius: 25px;
  161. padding: 6rpx 30rpx;
  162. background: #FCD202;
  163. /* color: #686868; */
  164. margin-right: 30rpx;
  165. }
  166. .addguige {
  167. width: 90%;
  168. margin: 0 auto;
  169. background: #FCD202;
  170. box-shadow: 0px 10upx 20upx 0px #FFD9B3;
  171. border-radius: 16upx;
  172. text-align: center;
  173. height: 88upx;
  174. line-height: 88upx;
  175. position: fixed;
  176. bottom: 25upx;
  177. left: 0;
  178. right: 0;
  179. z-index: 99;
  180. }
  181. </style>