goodsList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template name="goods">
  2. <view class="goods-template">
  3. <!-- 商品列表 -->
  4. <view class="goods-list">
  5. <view v-for="(item, index) in goodsData" :key="index" class="goods-item">
  6. <view class="shoptitle">
  7. <view class="title-logo"><image :src="item.logo" mode=""></image></view>
  8. <view class="title-text">{{item.name}}</view>
  9. </view>
  10. <view class="productlist" v-for="(pros,idx) in item.cartList" :key="idx">
  11. <view class="goods-pros-t">
  12. <view class="pros-img"><image :src="pros.image" alt="" /></view>
  13. <view class="pros-product">
  14. <view class="producttitle">{{pros.name}}</view>
  15. <view class="productspec" v-if="pros.productCategory!=2">规格:{{pros.unit}}</view>
  16. <view class="productspec" v-if="pros.productCode!=''&&pros.productCode!=null">
  17. <view >商品编码:{{pros.productCode}}</view>
  18. </view>
  19. <view class="productprice">
  20. <view class="price">
  21. <text>¥{{pros.price.toFixed(2)}}</text>
  22. </view>
  23. <view class="count">
  24. <text class="small">x</text>{{pros.number}}
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="goods-pros-m">
  31. <view class="m-text">留言:</view>
  32. <view class="m-input">
  33. <input type="text"
  34. v-model="remark[index]"
  35. @change="changeHandle(index)"
  36. placeholder-class="placeholder"
  37. maxlength="50"
  38. placeholder="选填,最多不超过50个汉字"/>
  39. </view>
  40. </view>
  41. <view class="goods-pros-b">
  42. <view class="sum">合计:<text class="money">¥{{item.totalPrice.toFixed(2)}}</text></view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default{
  50. name:"goods",
  51. props:{
  52. goodsData:{
  53. type:Array
  54. }
  55. },
  56. data() {
  57. return{
  58. remark:[]
  59. }
  60. },
  61. created(){
  62. },
  63. watch: {
  64. goodsData: {
  65. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  66. this.goodsData = el
  67. },
  68. deep: true
  69. }
  70. },
  71. computed: {
  72. },
  73. methods:{
  74. changeHandle (index) {//输入框的值被改变后
  75. this.goodsData[index].note = this.remark[index]
  76. this.$emit('handleGoodList',this.goodsData)
  77. }
  78. },
  79. }
  80. </script>
  81. <style lang="scss">
  82. .goods-template{
  83. width: 100%;
  84. height: auto;
  85. background: #FFFFFF;
  86. float: left;
  87. margin-top: 24rpx;
  88. .goods-list{
  89. width: 100%;
  90. height: auto;
  91. background:#F7F7F7;
  92. .goods-item{
  93. width: 702rpx;
  94. padding: 0 24rpx;
  95. background: #FFFFFF;
  96. margin-bottom: 24rpx;
  97. &:last-child{
  98. margin-bottom: 0;
  99. }
  100. }
  101. .shoptitle{
  102. display: flex;
  103. align-items: center;
  104. height: 80rpx;
  105. line-height: 80rpx;
  106. .title-logo{
  107. width: 48rpx;
  108. height: 48rpx;
  109. float: left;
  110. image{
  111. width: 48rpx;
  112. height: 48rpx;
  113. }
  114. }
  115. .title-text{
  116. float: left;
  117. margin-left: 16rpx;
  118. font-size: $font-size-28;
  119. color: $text-color;
  120. text-align: left;
  121. line-height: 56rpx;
  122. font-weight: bold;
  123. }
  124. }
  125. .productlist{
  126. width: 100%;
  127. height: auto;
  128. }
  129. .goods-pros-t{
  130. display: flex;
  131. align-items: center;
  132. width: 100%;
  133. height: 217rpx;
  134. padding:12rpx 0;
  135. .pros-img{
  136. width: 210rpx;
  137. height: 100%;
  138. border-radius: 10rpx;
  139. margin:0 26rpx 0 0;
  140. border:1px solid #f3f3f3;
  141. image{
  142. width: 100%;
  143. height: 100%;
  144. border-radius: 10rpx;
  145. }
  146. }
  147. }
  148. .pros-product{
  149. width: 468rpx;
  150. height: 100%;
  151. line-height: 36rpx;
  152. font-size: $font-size-26;
  153. position: relative;
  154. .producttitle{
  155. width: 100%;
  156. display: inline-block;
  157. height: auto;
  158. text-overflow:ellipsis;
  159. display: -webkit-box;
  160. word-break: break-all;
  161. -webkit-box-orient: vertical;
  162. -webkit-line-clamp: 2;
  163. overflow: hidden;
  164. margin-bottom: 8rpx;
  165. }
  166. .productspec{
  167. height: 36rpx;
  168. color: #999999;
  169. text-overflow:ellipsis;
  170. display: -webkit-box;
  171. word-break: break-all;
  172. -webkit-box-orient: vertical;
  173. -webkit-line-clamp: 2;
  174. overflow: hidden;
  175. }
  176. .productprice{
  177. height: 48rpx;
  178. position: absolute;
  179. width: 100%;
  180. bottom: 0;
  181. .price{
  182. line-height: 48rpx;
  183. font-size: $font-size-28;
  184. width: 48%;
  185. color: #FF2A2A;
  186. float: left;
  187. }
  188. .count{
  189. height: 100%;
  190. float: right;
  191. position: relative;
  192. .small{
  193. color: #666666;
  194. }
  195. }
  196. }
  197. }
  198. .goods-pros-m{
  199. height: 76rpx;
  200. line-height: 76rpx;
  201. font-size: $font-size-26;
  202. color: $text-color;
  203. margin-top: 12rpx;
  204. .m-text{
  205. width: 62rpx;
  206. float: left;
  207. padding-right: 20rpx;
  208. font-weight:bold;
  209. }
  210. .m-input{
  211. display: -webkit-box;
  212. display: -webkit-flex;
  213. display: flex;
  214. -webkit-box-align: center;
  215. -webkit-align-items: center;
  216. align-items: center;
  217. position: relative;
  218. width: 580rpx;
  219. height: 36rpx;
  220. padding: 20rpx;
  221. background: #F7F7F7;
  222. border-radius: 10rpx;
  223. input{
  224. width: 100%;
  225. height: 100%;
  226. background: #F7F7F7;
  227. font-size: $font-size-26;
  228. line-height: 36rpx;
  229. color: #333333;
  230. min-height: 36rpx;
  231. }
  232. }
  233. }
  234. .goods-pros-b{
  235. width:100%;
  236. height: auto;
  237. .sum{
  238. font-size: $font-size-28;
  239. line-height: 60rpx;
  240. color: $text-color;
  241. display: flex;
  242. justify-content: flex-end;
  243. .money{
  244. color: #FF2A2A;
  245. font-size: $font-size-28;
  246. }
  247. }
  248. }
  249. }
  250. }
  251. </style>