goodsList.vue 8.3 KB

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