商城点单小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

259 lines
4.8 KiB

3 weeks ago
  1. <template>
  2. <view class="page">
  3. <navbar/>
  4. <view class="user">
  5. <uv-checkbox-group
  6. shape="circle"
  7. v-model="checkboxValue">
  8. <uv-swipe-action>
  9. <view
  10. v-for="(item, index) in list"
  11. :key="index">
  12. <view style="margin-top: 20rpx;"></view>
  13. <uv-swipe-action-item
  14. :options="options">
  15. <view class="item">
  16. <view class="checkbox">
  17. <uv-checkbox
  18. :name="item.id"
  19. activeColor="#FA5A0A"
  20. size="40rpx"
  21. icon-size="35rpx"
  22. ></uv-checkbox>
  23. </view>
  24. <image
  25. class="image"
  26. src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg"
  27. mode=""></image>
  28. <view class="info">
  29. <view class="title">
  30. <view class="">
  31. {{ item.title }}
  32. </view>
  33. <view class="">
  34. <uv-number-box v-model="item.num"
  35. @change="valChange"></uv-number-box>
  36. </view>
  37. </view>
  38. <view class="unit">
  39. 规格{{ item.unit }}
  40. <uv-icon name="arrow-down"></uv-icon>
  41. </view>
  42. <view class="price">
  43. <text>{{ item.price }}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </uv-swipe-action-item>
  48. </view>
  49. </uv-swipe-action>
  50. </uv-checkbox-group>
  51. <view class="action">
  52. <view class="icon">
  53. <image src="/static/image/cart/1.png" mode=""></image>
  54. <view class="num">
  55. {{ checkboxValue.length }}
  56. </view>
  57. </view>
  58. <view class="price">
  59. <view class="count">
  60. 合计
  61. <view class="">
  62. <text>{{ totalPrice }}</text>
  63. </view>
  64. </view>
  65. <view class="text">
  66. {{ checkboxValue.length }}已享受更低优惠
  67. </view>
  68. </view>
  69. <view class="btn">
  70. 去结算
  71. </view>
  72. </view>
  73. </view>
  74. <tabber select="cart" />
  75. </view>
  76. </template>
  77. <script>
  78. import tabber from '@/components/base/tabbar.vue'
  79. export default {
  80. components: {
  81. tabber,
  82. },
  83. data() {
  84. return {
  85. value : 0,
  86. checkboxValue : [],
  87. options: [
  88. {
  89. text: '删除',
  90. style: {
  91. backgroundColor: '#FA5A0A'
  92. }
  93. },
  94. ],
  95. list : [
  96. {
  97. id : 1,
  98. title : '桌布租赁',
  99. num : 1,
  100. price : 299,
  101. unit : '120*40*75【桌子尺寸】',
  102. },
  103. {
  104. id : 2,
  105. title : '桌布租赁',
  106. num : 1,
  107. price : 299,
  108. unit : '120*40*75【桌子尺寸】',
  109. },
  110. ],
  111. }
  112. },
  113. computed: {
  114. totalPrice(){
  115. if (!this.checkboxValue.length) {
  116. return 0
  117. }
  118. let price = 0
  119. this.list.forEach(n => {
  120. if(this.checkboxValue.includes(n.id)){
  121. price += n.price * n.num
  122. }
  123. })
  124. return price
  125. },
  126. },
  127. methods: {
  128. valChange(){
  129. },
  130. }
  131. }
  132. </script>
  133. <style scoped lang="scss">
  134. .page {
  135. padding-bottom: 200rpx;
  136. /deep/ .uv-swipe-action{
  137. width: 100%;
  138. }
  139. }
  140. .user {
  141. .item{
  142. background-color: #fff;
  143. display: flex;
  144. padding: 30rpx;
  145. .checkbox{
  146. display: flex;
  147. justify-content: center;
  148. align-items: center;
  149. }
  150. .image{
  151. width: 200rpx;
  152. height: 200rpx;
  153. border-radius: 20rpx;
  154. }
  155. .info{
  156. flex: 1;
  157. .title{
  158. display: flex;
  159. padding: 10rpx 20rpx;
  160. justify-content: space-between;
  161. }
  162. .unit{
  163. font-size: 24rpx;
  164. padding: 10rpx 20rpx;
  165. color: #717171;
  166. display: flex;
  167. align-items: center;
  168. }
  169. .price{
  170. color: $uni-color;
  171. font-size: 28rpx;
  172. padding: 10rpx 20rpx;
  173. text{
  174. font-size: 36rpx;
  175. font-weight: 900;
  176. }
  177. }
  178. }
  179. }
  180. .action{
  181. width: 700rpx;
  182. position: fixed;
  183. bottom: 220rpx;
  184. left: 25rpx;
  185. background-color: #fff;
  186. height: 100rpx;
  187. border-radius: 50rpx;
  188. box-shadow: 0 0 6rpx 6rpx #00000010;
  189. display: flex;
  190. justify-content: center;
  191. align-items: center;
  192. overflow: hidden;
  193. z-index: 999;
  194. .icon{
  195. position: relative;
  196. width: 80rpx;
  197. height: 80rpx;
  198. margin: 0 20rpx;
  199. image{
  200. width: 80rpx;
  201. height: 80rpx;
  202. }
  203. .num{
  204. position: absolute;
  205. right: 10rpx;
  206. top: 0rpx;
  207. background-color: $uni-color;
  208. color: #fff;
  209. font-size: 18rpx;
  210. border-radius: 50%;
  211. height: 30rpx;
  212. width: 30rpx;
  213. display: flex;
  214. justify-content: center;
  215. align-items: center;
  216. }
  217. }
  218. .price{
  219. .count{
  220. display: flex;
  221. font-size: 26rpx;
  222. align-items: center;
  223. view{
  224. color: $uni-color;
  225. margin-left: 10rpx;
  226. text{
  227. font-size: 32rpx;
  228. font-weight: 900;
  229. }
  230. }
  231. }
  232. .text{
  233. font-size: 20rpx;
  234. color: #717171;
  235. }
  236. }
  237. .btn{
  238. margin-left: auto;
  239. background-color: $uni-color;
  240. height: 100%;
  241. padding: 0 50rpx;
  242. color: #fff;
  243. display: flex;
  244. justify-content: center;
  245. align-items: center;
  246. }
  247. }
  248. }
  249. </style>