goodsList.vue 8.5 KB

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