index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="requestList">
  3. <!-- header -->
  4. <cu-custom custom bgColor="bg-gradual-blue"><view slot="content">购物车</view></cu-custom>
  5. <view class="setting">
  6. <view class="setting-content flex align-center justify-center padding-sm bg-white">
  7. <view class="left text-cut text-grey">配送至河南省郑州市高新区大学科技园配送至河南省郑州市高新区大学科技园</view>
  8. <view @click="status = !status" class="right margin-left">{{ status ? '完成' : '管理' }}</view>
  9. </view>
  10. </view>
  11. <!-- section -->
  12. <cu-scrollView @refresherpulling="refresherpulling" @scroll="scroll" :height="height">
  13. <view class="section">
  14. <checkbox-group :value="group" @change="chooseShop">
  15. <view v-for="(item, index) in ListValue" :key="index" class="item flex align-center bg-white radius padding">
  16. <checkbox :value="item" style="transform: scale(0.6);" />
  17. <view class="right flex margin-left">
  18. <view
  19. :style="{ backgroundImage: 'url(' + 'https://gd-hbimg.huaban.com/d478a9c4bd0167adae79806c6ccaa2d7f59ded5dd101-WmmTdI_fw658/format/webp' + ')' }"
  20. class="image radius margin-right-sm"
  21. ></view>
  22. <view class="right-right">
  23. <view class="text-xl">{{ item }}</view>
  24. <view style="float: right;"><cu-stepper :value.sync="item" /></view>
  25. </view>
  26. </view>
  27. </view>
  28. </checkbox-group>
  29. <!-- 状态管理 -->
  30. <view class="cu-load" :class="{ loading: currentPage <= totalPage, over: currentPage > totalPage }"></view>
  31. </view>
  32. </cu-scrollView>
  33. <!-- footer -->
  34. <view class="tool">
  35. <!-- 结算 -->
  36. <view v-if="!status" class="bg-white tool-contentA flex align-center justify-center padding-lr padding-tb-sm">
  37. <view class="left flex ">
  38. <checkbox-group @change="e => (total_lockA = !total_lockA)" class="margin-right flex align-center">
  39. <checkbox style="transform: scale(0.6);" />
  40. <text class="text-lg margin-left-sm">全选</text>
  41. </checkbox-group>
  42. <view class="text-red margin-left">
  43. 合计:
  44. <cu-price :value="price" size="52" />
  45. </view>
  46. </view>
  47. <view class="right"><button @click="payFunc" class="cu-btn bg-red round shadow-blur">结算</button></view>
  48. </view>
  49. <!-- 管理 -->
  50. <view v-else class="bg-white tool-contentA flex align-center justify-center padding-lr padding-tb-sm">
  51. <view class="left flex ">
  52. <checkbox-group @change="e => (total_lockB = !total_lockB)" class="margin-right flex align-center">
  53. <checkbox style="transform: scale(0.6);" />
  54. <text class="text-lg margin-left-sm">全选</text>
  55. </checkbox-group>
  56. </view>
  57. <view class="right">
  58. <button class="cu-btn bg-red round shadow-blur margin-right">删除</button>
  59. <button class="cu-btn bg-green round shadow-blur">移入收藏</button>
  60. </view>
  61. </view>
  62. </view>
  63. <cu-bar active="2" />
  64. </view>
  65. </template>
  66. <script>
  67. import { CustomBarHeight } from '@/common/device/index.js';
  68. import { mapState, mapActions } from 'vuex';
  69. export default {
  70. data() {
  71. return {
  72. status: false, // false 管理 true 结算
  73. total_lockA: false, //购买 全选
  74. total_lcokB: false, //管理 全选
  75. price: 0, //合计
  76. group: []
  77. };
  78. },
  79. computed: {
  80. ...mapState('requestList', ['ListValue', 'currentPage', 'totalPage']),
  81. height() {
  82. return `calc(100vh - 280rpx - ${CustomBarHeight}px)`;
  83. }
  84. },
  85. onLoad() {},
  86. async onShow() {
  87. await this.reset();
  88. await this.requestFunc({ method: 'get', url: `/customer/order/cart/`, data: { limit: 10 } });
  89. },
  90. methods: {
  91. ...mapActions('requestList', ['reset','requestFunc']),
  92. chooseShop(e) {
  93. console.log(e);
  94. },
  95. // 下拉刷新
  96. async refresherpulling() {
  97. await this.reset();
  98. await this.requestFunc({ method: 'get', url: `/customer/order/cart/ `, data: { limit: 10 } });
  99. },
  100. // 上拉加载
  101. async scroll() {
  102. await this.requestFunc({ method: 'get', url: `/customer/order/cart/ `, data: { limit: 10 } });
  103. },
  104. payFunc() {
  105. uni.navigateTo({
  106. url: '/indexPages/pay/index'
  107. });
  108. }
  109. },
  110. watch: {
  111. status: {
  112. handler(newVal, oldVal) {
  113. // console.log(this.$store.state.requestList.value)
  114. // if(newVal){
  115. // this.group= this.total_lockA ? this.
  116. // }
  117. },
  118. deep: true
  119. }
  120. },
  121. onShareAppMessage() {
  122. return {};
  123. },
  124. onShareTimeline() {
  125. return {};
  126. },
  127. // 下拉刷新
  128. async onPullDownRefresh() {
  129. // await this.$store.requestList.dispatch('requestFunc',true);
  130. uni.stopPullDownRefresh({});
  131. }
  132. };
  133. </script>
  134. <style lang="scss" scoped>
  135. .requestList {
  136. .section {
  137. .item {
  138. position: relative;
  139. .image {
  140. width: 160upx;
  141. min-width: 160upx;
  142. height: 160upx;
  143. background-size: cover;
  144. background-position: center;
  145. }
  146. .right {
  147. flex: auto;
  148. .right-right {
  149. flex: auto;
  150. }
  151. }
  152. &::after {
  153. content: '';
  154. border-bottom: 1upx solid #eee;
  155. position: absolute;
  156. left: 0;
  157. bottom: 0;
  158. transform: scale(1, 0.5);
  159. width: 100%;
  160. }
  161. }
  162. }
  163. .setting {
  164. height: 80upx;
  165. .setting-content {
  166. position: fixed;
  167. left: 0;
  168. z-index: 9998;
  169. width: 100%;
  170. .left {
  171. flex: auto;
  172. }
  173. .right {
  174. min-width: 60upx;
  175. }
  176. }
  177. }
  178. .tool {
  179. height: 100rpx;
  180. .tool-contentA {
  181. position: fixed;
  182. bottom: calc(100rpx + env(safe-area-inset-bottom));
  183. left: 0;
  184. z-index: 9998;
  185. width: 100%;
  186. .left {
  187. flex: auto;
  188. }
  189. &::before {
  190. content: '';
  191. border-top: 1upx solid #aaa;
  192. position: absolute;
  193. left: 0;
  194. top: 0;
  195. transform: scale(1, 0.5);
  196. width: 100%;
  197. }
  198. }
  199. }
  200. }
  201. </style>