integral_mall_car.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view class="page">
  3. <!-- 购物车 -->
  4. <u-navbar title="购物车" :background="background" title-color="#ffffff" back-icon-color="#ffffff" is-fixed>
  5. <template slot="right">
  6. <text class="navbar-button" v-show="enbleEdit==false" @click="enbleEdit=true">编辑</text>
  7. <text class="navbar-button" v-show="enbleEdit==true" @click="enbleEdit=false">完成</text>
  8. </template>
  9. </u-navbar>
  10. <scroll-view scroll-y @scrolltolower="scrollBottom" class="scroll-view-container">
  11. <view class="page-box">
  12. <u-checkbox-group class="order" @change="checkboxGroupChange">
  13. <u-checkbox @change="checkboxChange" style="width: 100%;" v-model="item.checked" shape="circle" v-for="(item,index) in goodsList" :key="item.id" :name="item.id">
  14. <view class="item">
  15. <view class="left">
  16. <image :src="item.goodsUrl" mode="aspectFill"></image>
  17. </view>
  18. <view class="content">
  19. <view class="title u-line-2">{{ item.title }}</view>
  20. <view class="type">{{ item.type }}</view>
  21. <!-- <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view> -->
  22. <view class="price-row">
  23. <view class="brand">
  24. {{ item.brand }}
  25. </view>
  26. <view class="demo-count-box">
  27. <u-number-box v-model="selectedCount" :min="1" @change="selectedCountChange"></u-number-box>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </u-checkbox>
  33. </u-checkbox-group>
  34. <u-loadmore :status="loadStatus" bgColor="#f2f2f2"></u-loadmore>
  35. </view>
  36. </scroll-view>
  37. <view class="navigation">
  38. <view class="left">
  39. <view class="item">
  40. <u-checkbox shape="circle" @change="checkedAll" v-model="checkedAllValue">全选</u-checkbox>
  41. </view>
  42. </view>
  43. <view class="right" v-show="enbleEdit==false">
  44. <view class="total">合计:<text>2条</text></view>
  45. <view class="buy btn u-line-1" @click="handleGoConfirm">立即兑换</view>
  46. </view>
  47. <view class="right" v-show="enbleEdit==true">
  48. <view class="buy btn u-line-1" @click="handleDel">删除</view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. background: {
  58. backgroundColor: "#0291FD",
  59. color: "#ffffff"
  60. },
  61. buttonCustomStyle: {
  62. color: "#ffffff",
  63. background: "transparent",
  64. border: "none"
  65. },
  66. selectedCount: 0,
  67. checkedAllValue: false,
  68. enbleEdit: false,
  69. loadStatus: "false",
  70. goodsList: [],
  71. list: [{
  72. id: "1",
  73. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t16642/126/2693663818/450163/6879e8ce/5b06d93bN6305bd94.png',
  74. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  75. type: '胎动品牌;修补类型;普通积分',
  76. deliveryTime: '付款后30天内发货',
  77. price: '348.58',
  78. number: 2,
  79. checked: false,
  80. disabled: false,
  81. brand: "SAILUN"
  82. },
  83. {
  84. id: "2",
  85. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t1/47645/22/6120/140457/5d3d17deEec9f8e8d/3687ff03ca89b48c.jpg',
  86. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  87. type: '胎动品牌;修补类型;普通积分',
  88. deliveryTime: '付款后30天内发货',
  89. price: '135.00',
  90. number: 1,
  91. checked: false,
  92. disabled: false,
  93. brand: "SAILUN"
  94. },
  95. {
  96. id: "3",
  97. goodsUrl: 'https://img11.360buyimg.com/n7/jfs/t1/88990/24/4208/105799/5de4c6e9E24bc09d0/f810effb14c9c13a.jpg',
  98. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  99. type: '胎动品牌;修补类型;普通积分',
  100. deliveryTime: '付款后7天内发货',
  101. price: '128.05',
  102. number: 1,
  103. checked: false,
  104. disabled: false,
  105. brand: "SAILUN"
  106. },
  107. {
  108. id: "4",
  109. goodsUrl: 'https://img12.360buyimg.com/n7/jfs/t1/93698/23/4500/114562/5de713dfEfc997085/e8deaa979909851d.jpg',
  110. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  111. type: '胎动品牌;修补类型;普通积分',
  112. deliveryTime: '保质5年',
  113. price: '1998',
  114. number: 3,
  115. checked: false,
  116. disabled: false,
  117. brand: "SAILUN"
  118. },
  119. {
  120. id: "5",
  121. goodsUrl: 'https://img11.360buyimg.com/n7/jfs/t16642/126/2693663818/450163/6879e8ce/5b06d93bN6305bd94.png',
  122. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  123. type: '胎动品牌;修补类型;普通积分',
  124. deliveryTime: '保质5年',
  125. price: '2354',
  126. number: 1,
  127. checked: false,
  128. disabled: false,
  129. brand: "SAILUN"
  130. },
  131. {
  132. id: "6",
  133. goodsUrl: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  134. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  135. type: '胎动品牌;修补类型;普通积分',
  136. deliveryTime: '珍藏10年好酒',
  137. price: '1543',
  138. number: 3,
  139. checked: false,
  140. disabled: false,
  141. brand: "SAILUN"
  142. },
  143. {
  144. id: "7",
  145. goodsUrl: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  146. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  147. type: '胎动品牌;修补类型;普通积分',
  148. deliveryTime: '口感好',
  149. price: '120',
  150. number: 1,
  151. checked: false,
  152. disabled: false,
  153. brand: "SAILUN"
  154. },
  155. {
  156. id: "8",
  157. goodsUrl: 'https://img10.360buyimg.com/n7/jfs/t1/68753/35/2229/118427/5d089fb7Ee5b93887/2e3bbc7fec247fdc.jpg',
  158. title: '【胎动】T-M3蘑菇钉,24支/盒, 3mm ',
  159. type: '胎动品牌;修补类型;普通积分',
  160. deliveryTime: '使用方便',
  161. price: '451',
  162. number: 9,
  163. checked: false,
  164. disabled: false,
  165. brand: "SAILUN"
  166. }
  167. ]
  168. }
  169. },
  170. onLoad() {
  171. this.addRandomData();
  172. },
  173. methods: {
  174. scrollBottom: function() {
  175. this.loadStatus = 'loading';
  176. // 模拟数据加载
  177. setTimeout(() => {
  178. this.addRandomData();
  179. this.loadStatus = 'loadmore';
  180. }, 1000)
  181. },
  182. selectedCountChange: function(){},
  183. checkboxGroupChange: function(params) {
  184. },
  185. checkboxChange: function(params) {
  186. if(!params.value){
  187. this.checkedAllValue = false;
  188. }
  189. },
  190. checkedAll: function(params) {
  191. if(params.value){
  192. this.goodsList.map(val => {
  193. val.checked = true;
  194. })
  195. }else{
  196. this.goodsList.map(val => {
  197. val.checked = false;
  198. })
  199. }
  200. },
  201. handleGoConfirm: function(){
  202. uni.navigateTo({
  203. url: "/pages/home/integral-mall/integral_mall_confirmorder"
  204. })
  205. },
  206. handleDel: function(){},
  207. addRandomData() {
  208. for (let i = 0; i < 10; i++) {
  209. let index = this.$u.random(0, this.list.length - 1);
  210. // 先转成字符串再转成对象,避免数组对象引用导致数据混乱
  211. let item = JSON.parse(JSON.stringify(this.list[index]))
  212. item.id = this.$u.guid();
  213. if(this.checkedAllValue){
  214. item.checked = true;
  215. };
  216. this.goodsList.push(item);
  217. }
  218. },
  219. }
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. .scroll-view-container{
  224. width: 100%;
  225. height: calc(100vh - 176rpx);
  226. }
  227. .navbar-button {
  228. padding: 24rpx 26rpx;
  229. display: inline-block;
  230. }
  231. .order {
  232. width: 710rpx;
  233. background-color: #ffffff;
  234. margin: 20rpx auto;
  235. border-radius: 20rpx;
  236. box-sizing: content-box;
  237. padding: 20rpx;
  238. font-size: 28rpx;
  239. .top {
  240. display: flex;
  241. justify-content: space-between;
  242. .left {
  243. display: flex;
  244. align-items: center;
  245. .store {
  246. margin: 0 10rpx;
  247. font-size: 32rpx;
  248. font-weight: bold;
  249. }
  250. }
  251. .right {
  252. color: $u-type-warning-dark;
  253. }
  254. }
  255. .item {
  256. display: flex;
  257. margin: 20rpx 0 0;
  258. .left {
  259. margin-right: 20rpx;
  260. image {
  261. width: 200rpx;
  262. height: 200rpx;
  263. border-radius: 10rpx;
  264. }
  265. }
  266. .content {
  267. .title {
  268. font-size: 28rpx;
  269. line-height: 50rpx;
  270. color: #606266;
  271. }
  272. .type {
  273. margin: 10rpx 0;
  274. font-size: 24rpx;
  275. color: $u-tips-color;
  276. }
  277. .delivery-time {
  278. color: #e5d001;
  279. font-size: 24rpx;
  280. }
  281. .price-row {
  282. display: flex;
  283. justify-content: space-between;
  284. margin: 10rpx 0;
  285. font-size: 26rpx;
  286. .price {
  287. color: #FF0000;
  288. }
  289. .brand{
  290. color: #999999;
  291. background: #F3F3F3;
  292. padding: 0 8rpx;
  293. border-radius: 5rpx;
  294. }
  295. .exchange {
  296. background: #0094FE;
  297. color: #FFFFFF;
  298. padding: 4rpx 16rpx;
  299. line-height: 1.5;
  300. }
  301. }
  302. }
  303. .right {
  304. margin-left: 10rpx;
  305. padding-top: 20rpx;
  306. text-align: right;
  307. .decimal {
  308. font-size: 24rpx;
  309. margin-top: 4rpx;
  310. }
  311. .number {
  312. color: $u-tips-color;
  313. font-size: 24rpx;
  314. }
  315. }
  316. }
  317. .total {
  318. margin-top: 20rpx;
  319. text-align: right;
  320. font-size: 24rpx;
  321. .total-price {
  322. font-size: 32rpx;
  323. }
  324. }
  325. .bottom {
  326. display: flex;
  327. margin-top: 40rpx;
  328. padding: 0 10rpx;
  329. justify-content: space-between;
  330. align-items: center;
  331. .btn {
  332. line-height: 52rpx;
  333. width: 160rpx;
  334. border-radius: 26rpx;
  335. border: 2rpx solid $u-border-color;
  336. font-size: 26rpx;
  337. text-align: center;
  338. color: $u-type-info-dark;
  339. }
  340. .evaluate {
  341. color: $u-type-warning-dark;
  342. border-color: $u-type-warning-dark;
  343. }
  344. }
  345. }
  346. .navigation {
  347. display: flex;
  348. width: 100%;
  349. justify-content: space-between;
  350. margin-top: 100rpx;
  351. border: solid 2rpx #f2f2f2;
  352. background-color: #ffffff;
  353. padding: 16rpx 0;
  354. position: fixed;
  355. bottom: 0;
  356. z-index: 100;
  357. .left {
  358. display: flex;
  359. font-size: 20rpx;
  360. .item {
  361. margin: 0 30rpx;
  362. &.car {
  363. text-align: center;
  364. position: relative;
  365. .car-num {
  366. position: absolute;
  367. top: -10rpx;
  368. right: -10rpx;
  369. }
  370. }
  371. }
  372. }
  373. .right {
  374. display: flex;
  375. font-size: 28rpx;
  376. align-items: center;
  377. .btn {
  378. line-height: 66rpx;
  379. padding: 0 30rpx;
  380. border-radius: 36rpx;
  381. color: #ffffff;
  382. }
  383. .cart {
  384. background-color: #ed3f14;
  385. margin-right: 30rpx;
  386. }
  387. .buy {
  388. margin: 0 16rpx;
  389. background-color: #ff7900;
  390. }
  391. }
  392. }
  393. </style>