goodsList.vue 7.7 KB

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