goodsList.vue 8.4 KB

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