goodsList.vue 5.1 KB

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