cart.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <view class="container">
  3. <view class="swiper">
  4. <view class="swiper-text">共{{13}}件商品</view>
  5. </view>
  6. <view class="sort-right-box">
  7. <scroll-view :show-scrollbar="0" show-scrollbar="true" scroll-y="true" class="goods-box">
  8. <view class="goods-row" v-for="item in goodsList" @click="">
  9. <view class="goods-top">
  10. <view class="iconfont iconqueding select magl5" @click=""></view>
  11. <view class="iconfont icondianpu magr5"></view>
  12. <view class="seller-label magr5">{{item.sellerName}}</view>
  13. <view class="iconfont iconfangxiang magr5"></view>
  14. </view>
  15. <view class="split-line"></view>
  16. <view class="goods-middle">
  17. <view class="iconfont iconqueding select-goods magl5" @click=""></view>
  18. <cover-image class="goods-img" @click="" :src="item.url"></cover-image>
  19. <view class="goods-info">
  20. <view class="goods-details">{{item.details}}</view>
  21. <view class="goods-type">类型:{{item.goodType}}</view>
  22. <!-- <uni-tag text="类型: 普通商品" size="small" type="default"></uni-tag> -->
  23. <view class="goods-info-btm">
  24. <view class="goods-spec">
  25. <text>{{item.spec}}</text>
  26. </view>
  27. <!-- <uni-number-box :min="1" :value="cartNum"></uni-number-box> -->
  28. <view class="pro-num-box">
  29. <text class="num-btn r" @click="numSub(index,cIndex)">-</text>
  30. <text class="num">{{item.num}}</text>
  31. <text class="num-btn l" @click="numAdd(index,cIndex)">+</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="split-line"></view>
  37. <view class="goods-bottom">
  38. <text class="magr20">合计</text>
  39. <view class="goods-spec magr10">
  40. <text>{{item.spec}}</text>
  41. </view>
  42. <view class="settle-btn"><text>结算(3)</text></view>
  43. </view>
  44. </view>
  45. </scroll-view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import uniTag from "@/components/uni-tag/uni-tag.vue"
  51. import uniNumberBox from "@/components/uni-number-box/uni-number-box.vue"
  52. export default {
  53. components: {
  54. 'uni-tag': uniTag,
  55. 'uni-number-box': uniNumberBox
  56. },
  57. data() {
  58. return {
  59. goodsList: [{
  60. name: '优质白菜',
  61. sellerName: '商家1',
  62. goodType: '普通商品',
  63. details: '优质白菜优质白菜优质白菜',
  64. spec: '¥80.00/kg',
  65. sales: 10,
  66. num: 2,
  67. },
  68. {
  69. name: '优质白菜',
  70. sellerName: '商家2',
  71. goodType: '普通商品',
  72. details: '优质白菜优质白菜优质白菜',
  73. spec: '¥80.00/kg',
  74. sales: 10,
  75. num: 2,
  76. },
  77. {
  78. name: '优质白菜',
  79. sellerName: '商家3',
  80. goodType: '普通商品',
  81. details: '优质白菜优质白菜优质白菜',
  82. spec: '¥80.00/kg',
  83. sales: 10,
  84. num: 2,
  85. },
  86. {
  87. name: '优质白菜',
  88. sellerName: '商家4',
  89. goodType: '普通商品',
  90. details: '优质白菜优质白菜优质白菜',
  91. spec: '¥80.00/kg',
  92. sales: 10,
  93. num: 2,
  94. },
  95. {
  96. name: '优质白菜',
  97. sellerName: '商家5',
  98. goodType: '普通商品',
  99. details: '优质白菜优质白菜优质白菜',
  100. spec: '¥80.00/kg',
  101. sales: 10,
  102. num: 5,
  103. },
  104. {
  105. name: '优质白菜',
  106. sellerName: '商家6',
  107. goodType: '普通商品',
  108. details: '优质白菜优质白菜优质白菜',
  109. spec: '¥80.00/kg',
  110. sales: 10,
  111. num: 3,
  112. }
  113. ],
  114. cartNum: 1,
  115. }
  116. },
  117. onLoad() {
  118. },
  119. methods: {
  120. // 数量减
  121. numSub(index, cIndex) {
  122. // if (this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum > 1) {
  123. // this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum = this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum - 1
  124. // this.updateCart()
  125. // } else {
  126. // uni.showToast({
  127. // title: '亲!至少一件哦!',
  128. // icon:"none"
  129. // })
  130. // }
  131. },
  132. // 数量加
  133. numAdd(index, cIndex) {
  134. // if (this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum <= 100) {
  135. // this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum = this.dataList[index].shoppingCartSkuItemList[cIndex].buyNum + 1
  136. // this.updateCart()
  137. // } else {
  138. // wx.showToast({
  139. // title: '库存不足!',
  140. // icon: 'none'
  141. // })
  142. // }
  143. },
  144. }
  145. }
  146. </script>
  147. <style lang="less" scoped>
  148. page {
  149. width: 100%;
  150. height: 100%;
  151. }
  152. .magl5 {
  153. margin-left: 5px;
  154. }
  155. .magr5 {
  156. margin-right: 5px;
  157. }
  158. .magr10 {
  159. margin-right: 10px;
  160. }
  161. .magr20 {
  162. margin-right: 20px;
  163. }
  164. .container {
  165. width: 100%;
  166. height: 100%;
  167. background-color: #F3F3F3;
  168. .swiper {
  169. height: 120px;
  170. background-color: #52A63A;
  171. border-radius: 0 0 40px 40px;
  172. .swiper-text {
  173. color: #FFFFFF;
  174. padding-left: 10px;
  175. padding-top: 15px;
  176. }
  177. }
  178. .sort-right-box {
  179. position: absolute;
  180. top: 50px;
  181. height: calc(100% - 50px);
  182. width: 100%;
  183. .goods-box {
  184. width: 100%;
  185. height: 100%;
  186. // box-sizing: border-box;
  187. .goods-row {
  188. width: calc(100% - 24px);
  189. height: 185px;
  190. box-sizing: border-box;
  191. margin: 4px 0 12px 12px;
  192. background: #FFFFFF;
  193. border-radius: 15px;
  194. .goods-top {
  195. display: flex;
  196. align-items: center;
  197. .select {
  198. color: #52A63A;
  199. font-size: 35px;
  200. }
  201. }
  202. .select-goods {
  203. color: #52A63A;
  204. font-size: 35px;
  205. float: left;
  206. text-align: center;
  207. }
  208. .split-line {
  209. height: 1px;
  210. background: #EEEEEE;
  211. margin-top: 5px;
  212. margin-bottom: 5px;
  213. }
  214. .goods-middle {
  215. display: flex;
  216. .goods-img {
  217. width: 84px;
  218. height: 84px;
  219. }
  220. .goods-info {
  221. flex: 1;
  222. margin-left: 10px;
  223. .goods-details {
  224. height: 28px;
  225. font-size: 12px;
  226. font-family: PingFang SC;
  227. color: #333333;
  228. line-height: 14px;
  229. overflow: hidden;
  230. text-overflow: ellipsis;
  231. display: -webkit-box;
  232. -webkit-line-clamp: 2;
  233. -webkit-box-orient: vertical;
  234. word-wrap: break-word;
  235. margin-top: 10px;
  236. }
  237. .goods-type {
  238. width: 100px;
  239. height: 20px;
  240. background: #F0F0F0;
  241. border-radius: 2px;
  242. color: #666666;
  243. font-size: 10px;
  244. display: flex;
  245. align-items: center;
  246. justify-content: center;
  247. }
  248. .goods-info-btm {
  249. display: flex;
  250. justify-content: space-between;
  251. align-items: center;
  252. .pro-num-box {
  253. margin-top: 10px;
  254. margin-right: 10px;
  255. width: 80px;
  256. height: 20px;
  257. border: 1px solid #ddd;
  258. border-radius: 4upx;
  259. display: flex;
  260. flex-direction: row;
  261. justify-content: space-between;
  262. .num-btn {
  263. font-size: 34upx;
  264. color: #666;
  265. display: inline-block;
  266. width: 40upx;
  267. text-align: center;
  268. line-height: 32upx;
  269. }
  270. .num-btn.r {
  271. border-right: 1px solid #ddd;
  272. }
  273. .num-btn.l {
  274. border-left: 1px solid #ddd;
  275. }
  276. .num {
  277. font-size: 26upx;
  278. color: #333;
  279. }
  280. }
  281. }
  282. .goods-spec {
  283. height: 16px;
  284. font-family: PingFang SC;
  285. line-height: 16px;
  286. font-size: 14px;
  287. color: #52A63A;
  288. margin-top: 10px;
  289. }
  290. }
  291. }
  292. .goods-bottom {
  293. position: absolute;
  294. right: 20px;
  295. display: flex;
  296. align-items: baseline;
  297. font-size: 14px;
  298. }
  299. .settle-btn {
  300. color: #FFFFFF;
  301. background: #52A63A;
  302. border-radius: 40px;
  303. height: 30px;
  304. width: 80px;
  305. display: flex;
  306. align-items: center;
  307. justify-content: center;
  308. }
  309. }
  310. }
  311. }
  312. }
  313. // /deep/ .uni-numbox {
  314. // width: 80px;
  315. // height: 20px;
  316. // }
  317. </style>