goodsList.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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-text">{{item.name}}</view>
  8. </view>
  9. <view class="productlist" v-for="(pros,idx) in item.productList" :key="idx">
  10. <view class="goods-pros-t">
  11. <view class="pros-img">
  12. <image :src="pros.mainImage" alt="" />
  13. <text class="tips" v-if="pros.productType == 2">赠品</text>
  14. </view>
  15. <view class="pros-product">
  16. <view class="producttitle">{{pros.productName}}</view>
  17. <view class="productspec">规格:{{pros.unit}}</view>
  18. <view class="productprice">
  19. <view class="price"><text>¥{{ (pros.productType == 2 ? 0 : pros.retailPrice) | NumFormat}}</text></view>
  20. <view class="count"><text class="small">x</text>{{pros.productCount}}</view>
  21. </view>
  22. <view class="floor-item-act" v-if="pros.promotion!=null">
  23. <view v-if="PromotionsFormat(pros.promotion)" class="floor-tags">
  24. {{pros.promotion.name}}
  25. <text v-if ="pros.promotion!=null">
  26. :¥{{ pros.promotion == null ? '0.00' : pros.promotion.touchPrice | NumFormat}}
  27. </text>
  28. </view>
  29. <view v-else-if="pros.promotion.type !=3" class="floor-tags">{{pros.promotion.name}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="goods-pros-m">
  35. <view class="m-text">留言:</view>
  36. <view class="m-input">
  37. <input type="text"
  38. v-model="remark[index]"
  39. @change="changeHandle(index)"
  40. placeholder-class="placeholder"
  41. maxlength="50"
  42. placeholder="选填,最多不超过50个汉字"/>
  43. </view>
  44. </view>
  45. <view class="goods-pros-b">
  46. <view class="sum">合计:<text class="money">¥{{ ( item.shopTotalPrice ) | NumFormat }}</text></view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default{
  54. name:"goods",
  55. props:{
  56. goodsData:{
  57. type:Array
  58. }
  59. },
  60. data() {
  61. return{
  62. remark:[]
  63. }
  64. },
  65. created(){
  66. },
  67. filters:{
  68. NumFormat(value) {//处理金额
  69. return Number(value).toFixed(2);
  70. },
  71. },
  72. watch: {
  73. goodsData: {
  74. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  75. this.goodsData = el
  76. },
  77. deep: true
  78. }
  79. },
  80. computed: {
  81. },
  82. methods:{
  83. PromotionsFormat(promo){//促销活动类型数据处理
  84. if(promo!=null){
  85. if(promo.type == 1 && promo.mode == 1){
  86. return true
  87. }else{
  88. return false
  89. }
  90. }
  91. return false
  92. },
  93. changeHandle (index) {//输入框的值被改变后
  94. this.goodsData[index].note = this.remark[index]
  95. this.$emit('handleGoodList',this.goodsData)
  96. }
  97. },
  98. }
  99. </script>
  100. <style lang="scss">
  101. .goods-template{
  102. width: 100%;
  103. height: auto;
  104. background: #FFFFFF;
  105. float: left;
  106. margin-top: 24rpx;
  107. .goods-list{
  108. width: 100%;
  109. height: auto;
  110. background:#F7F7F7;
  111. .goods-item{
  112. width: 702rpx;
  113. padding: 0 24rpx;
  114. background: #FFFFFF;
  115. margin-bottom: 24rpx;
  116. &:last-child{
  117. margin-bottom: 0;
  118. }
  119. }
  120. .shoptitle{
  121. display: flex;
  122. align-items: center;
  123. height: 80rpx;
  124. line-height: 80rpx;
  125. .title-text{
  126. width: 400rpx;
  127. overflow: hidden;
  128. text-overflow:ellipsis;
  129. white-space: nowrap;
  130. float: left;
  131. font-size: $font-size-28;
  132. color: $text-color;
  133. text-align: left;
  134. line-height: 56rpx;
  135. font-weight: bold;
  136. }
  137. }
  138. .productlist{
  139. width: 100%;
  140. height: auto;
  141. }
  142. .goods-pros-t{
  143. display: flex;
  144. align-items: center;
  145. width: 100%;
  146. height: auto;
  147. padding:12rpx 0;
  148. .pros-img{
  149. width: 210rpx;
  150. height: 100%;
  151. border-radius: 10rpx;
  152. margin:0 26rpx 0 0;
  153. position: relative;
  154. .tips{
  155. display: inline-block;
  156. width: 80rpx;
  157. height: 40rpx;
  158. background-image: linear-gradient(214deg, #ff4500 0%, #ff5800 53%, #ff4367 100%);
  159. line-height: 40rpx;
  160. text-align: center;
  161. font-size: $font-size-24;
  162. color: #FFFFFF;
  163. border-radius:10rpx 0 10rpx 0 ;
  164. position: absolute;
  165. top:0;
  166. left: 0;
  167. }
  168. image{
  169. width: 210rpx;
  170. height: 210rpx;
  171. border-radius: 10rpx;
  172. border:1px solid #f3f3f3;
  173. }
  174. }
  175. }
  176. .pros-product{
  177. width: 468rpx;
  178. height: 100%;
  179. line-height: 40rpx;
  180. font-size: $font-size-26;
  181. position: relative;
  182. .producttitle{
  183. width: 100%;
  184. display: inline-block;
  185. height: auto;
  186. text-overflow:ellipsis;
  187. display: -webkit-box;
  188. word-break: break-all;
  189. -webkit-box-orient: vertical;
  190. -webkit-line-clamp: 2;
  191. overflow: hidden;
  192. margin-bottom: 8rpx;
  193. }
  194. .productspec{
  195. height: 40rpx;
  196. color: #999999;
  197. line-height: 40rpx;
  198. text-overflow:ellipsis;
  199. display: -webkit-box;
  200. word-break: break-all;
  201. -webkit-box-orient: vertical;
  202. -webkit-line-clamp: 2;
  203. overflow: hidden;
  204. }
  205. .productprice{
  206. height: 54rpx;
  207. line-height: 54rpx;
  208. width: 100%;
  209. float: left;
  210. .price{
  211. line-height: 54rpx;
  212. font-size: $font-size-28;
  213. width: 48%;
  214. color: #FF2A2A;
  215. float: left;
  216. }
  217. .count{
  218. height: 100%;
  219. float: right;
  220. position: relative;
  221. .small{
  222. color: #666666;
  223. }
  224. }
  225. }
  226. .floor-item-act{
  227. width: 100%;
  228. height: 56rpx;
  229. text-align: center;
  230. box-sizing: border-box;
  231. float: left;
  232. padding:0 0 10rpx 0;
  233. .floor-tags{
  234. height: 28rpx;
  235. border-radius: 6rpx;
  236. background-color: #FFFFFF;
  237. line-height: 28rpx;
  238. color: #ff2a2a;
  239. text-align: center;
  240. display: inline-block;
  241. padding:0 16rpx;
  242. font-size: $font-size-20;
  243. border: 1px solid #ff2a2a;
  244. float: left;
  245. }
  246. }
  247. }
  248. .goods-pros-m{
  249. height: 76rpx;
  250. line-height: 76rpx;
  251. font-size: $font-size-26;
  252. color: $text-color;
  253. margin-top: 12rpx;
  254. .m-text{
  255. width: 62rpx;
  256. float: left;
  257. padding-right: 20rpx;
  258. font-weight:bold;
  259. }
  260. .m-input{
  261. display: -webkit-box;
  262. display: -webkit-flex;
  263. display: flex;
  264. -webkit-box-align: center;
  265. -webkit-align-items: center;
  266. align-items: center;
  267. position: relative;
  268. width: 576rpx;
  269. height: 36rpx;
  270. padding: 20rpx;
  271. background: #F9F9F9;
  272. border-radius: 10rpx;
  273. input{
  274. width: 100%;
  275. height: 100%;
  276. font-size: $font-size-26;
  277. line-height: 36rpx;
  278. color: #333333;
  279. min-height: 36rpx;
  280. }
  281. }
  282. }
  283. .goods-pros-b{
  284. width:100%;
  285. height: auto;
  286. padding: 10rpx 0;
  287. .sum-none{
  288. width: 100%;
  289. height: 48rpx;
  290. line-height: 48rpx;
  291. color: $text-color;
  292. float: left;
  293. text-align: right;
  294. .money{
  295. font-size: $font-size-26;
  296. color: #999999;
  297. text-decoration: line-through;
  298. }
  299. .money-sign{
  300. font-size: $font-size-26;
  301. color: #999999;
  302. text-decoration: line-through;
  303. }
  304. .money-reduced{
  305. margin-left: 10rpx;
  306. font-size: $font-size-26;
  307. color: $color-system;
  308. .iconfont{
  309. font-size: $font-size-34;
  310. }
  311. }
  312. }
  313. .sum{
  314. width: 100%;
  315. height: 48rpx;
  316. font-size: $font-size-28;
  317. line-height: 48rpx;
  318. color: $text-color;
  319. display: flex;
  320. justify-content: flex-end;
  321. .money{
  322. color: #FF2A2A;
  323. font-size: $font-size-28;
  324. }
  325. }
  326. }
  327. }
  328. }
  329. </style>