goodsList.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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="floor-item-act" v-if="pros.promotion!=null">
  18. <view v-if="PromotionsFormat(pros.promotion)" class="floor-tags">
  19. {{pros.promotion.name}}
  20. <text v-if ="pros.promotion!=null">
  21. :¥{{ pros.promotion == null ? '0.00' : pros.promotion.touchPrice | NumFormat}}
  22. </text>
  23. </view>
  24. <view v-else-if="pros.promotion.type !=3" class="floor-tags">{{pros.promotion.name}}</view>
  25. </view>
  26. <view class="productspec">规格:{{ pros.unit }}</view>
  27. <view class="productprice">
  28. <view class="price"><text>¥{{ (pros.productType == 2 ? 0 : pros.retailPrice) | NumFormat }}</text></view>
  29. <view class="count"><text class="small">x</text>{{ pros.productCount }}</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. width: 100%;
  201. float: left;
  202. height: 40rpx;
  203. color: #999999;
  204. line-height: 40rpx;
  205. text-overflow:ellipsis;
  206. display: -webkit-box;
  207. word-break: break-all;
  208. -webkit-box-orient: vertical;
  209. -webkit-line-clamp: 2;
  210. overflow: hidden;
  211. }
  212. .productprice{
  213. width: 100%;
  214. height: 54rpx;
  215. line-height: 54rpx;
  216. width: 100%;
  217. float: left;
  218. margin-top: 30rpx;
  219. .price{
  220. line-height: 54rpx;
  221. font-size: $font-size-28;
  222. width: 48%;
  223. color: #FF2A2A;
  224. float: left;
  225. }
  226. .count{
  227. height: 100%;
  228. float: right;
  229. position: relative;
  230. .small{
  231. color: #666666;
  232. }
  233. }
  234. }
  235. .floor-item-act{
  236. width: 100%;
  237. height: auto;
  238. text-align: center;
  239. box-sizing: border-box;
  240. float: left;
  241. padding:0 0 10rpx 0;
  242. .floor-tags{
  243. height: 28rpx;
  244. border-radius: 6rpx;
  245. background-color: #FFFFFF;
  246. line-height: 28rpx;
  247. color: #ff2a2a;
  248. text-align: center;
  249. display: inline-block;
  250. padding:0 16rpx;
  251. font-size: $font-size-20;
  252. border: 1px solid #ff2a2a;
  253. float: left;
  254. }
  255. }
  256. }
  257. .goods-pros-m{
  258. height: 76rpx;
  259. line-height: 76rpx;
  260. font-size: $font-size-26;
  261. color: $text-color;
  262. margin-top: 12rpx;
  263. .m-text{
  264. width: 62rpx;
  265. float: left;
  266. padding-right: 20rpx;
  267. font-weight:bold;
  268. }
  269. .m-input{
  270. display: -webkit-box;
  271. display: -webkit-flex;
  272. display: flex;
  273. -webkit-box-align: center;
  274. -webkit-align-items: center;
  275. align-items: center;
  276. position: relative;
  277. width: 576rpx;
  278. height: 36rpx;
  279. padding: 20rpx;
  280. background: #F9F9F9;
  281. border-radius: 10rpx;
  282. input{
  283. width: 100%;
  284. height: 100%;
  285. font-size: $font-size-26;
  286. line-height: 36rpx;
  287. color: #333333;
  288. min-height: 36rpx;
  289. }
  290. }
  291. }
  292. .goods-pros-b{
  293. width:100%;
  294. height: auto;
  295. padding: 10rpx 0;
  296. .sum-none{
  297. width: 100%;
  298. height: 48rpx;
  299. line-height: 48rpx;
  300. color: $text-color;
  301. float: left;
  302. text-align: right;
  303. .money{
  304. font-size: $font-size-26;
  305. color: #999999;
  306. text-decoration: line-through;
  307. }
  308. .money-sign{
  309. font-size: $font-size-26;
  310. color: #999999;
  311. text-decoration: line-through;
  312. }
  313. .money-reduced{
  314. margin-left: 10rpx;
  315. font-size: $font-size-26;
  316. color: $color-system;
  317. .iconfont{
  318. font-size: $font-size-34;
  319. }
  320. }
  321. }
  322. .sum{
  323. width: 100%;
  324. height: 48rpx;
  325. font-size: $font-size-28;
  326. line-height: 48rpx;
  327. color: $text-color;
  328. display: flex;
  329. justify-content: flex-end;
  330. .money{
  331. color: #FF2A2A;
  332. font-size: $font-size-28;
  333. }
  334. }
  335. }
  336. }
  337. }
  338. </style>