goodsList.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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" v-if="pros.activeStatus == 1">
  19. <view class="tag">活动价</view>
  20. </view>
  21. <view class="productprice">
  22. <view class="price">
  23. <text>¥{{ pros.price | NumFormat}}</text>
  24. </view>
  25. <view class="count"><text class="small">x</text>{{ pros.productCount }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="goods-pros-m">
  31. <view class="m-text">留言:</view>
  32. <view class="m-input">
  33. <input type="text"
  34. v-model="remark[index]"
  35. @change="changeHandle(index)"
  36. placeholder-class="placeholder"
  37. maxlength="50"
  38. placeholder="选填,最多不超过50个汉字"/>
  39. </view>
  40. </view>
  41. <view class="goods-pros-b">
  42. <view class="sum-none" v-if="(item.fullReduction)>0">
  43. <text class="money-sign">¥</text>
  44. <text class="money">{{ ( item.shopTotalPrice +item.fullReduction ) | NumFormat }}</text>
  45. <text class="money-reduced">减<text>¥{{ item.fullReduction | NumFormat}}</text></text>
  46. </view>
  47. <view class="sum">合计:<text class="money">¥{{ item.shopTotalPrice | NumFormat }}</text></view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default{
  55. name:"goods",
  56. props:{
  57. goodsData:{
  58. type:Array
  59. }
  60. },
  61. data() {
  62. return{
  63. remark:[]
  64. }
  65. },
  66. created(){
  67. },
  68. filters:{
  69. NumFormat(value) {//处理金额
  70. return Number(value).toFixed(2);
  71. },
  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. float: left;
  107. margin-top: 24rpx;
  108. .goods-list{
  109. width: 100%;
  110. height: auto;
  111. background:#F7F7F7;
  112. .goods-item{
  113. width: 702rpx;
  114. padding: 0 24rpx;
  115. background: #FFFFFF;
  116. margin-bottom: 24rpx;
  117. &:last-child{
  118. margin-bottom: 0;
  119. }
  120. }
  121. .shoptitle{
  122. display: flex;
  123. align-items: center;
  124. height: 80rpx;
  125. line-height: 80rpx;
  126. .title-logo{
  127. width: 48rpx;
  128. height: 48rpx;
  129. float: left;
  130. border-radius: 8rpx;
  131. border: 1px solid #e1e1e1;
  132. margin-right: 10rpx;
  133. image{
  134. border-radius: 8rpx;
  135. width: 48rpx;
  136. height: 48rpx;
  137. }
  138. }
  139. .title-text{
  140. width: 400rpx;
  141. overflow: hidden;
  142. text-overflow:ellipsis;
  143. white-space: nowrap;
  144. float: left;
  145. font-size: $font-size-28;
  146. color: $text-color;
  147. text-align: left;
  148. line-height: 56rpx;
  149. font-weight: bold;
  150. }
  151. }
  152. .productlist{
  153. width: 100%;
  154. height: auto;
  155. }
  156. .goods-pros-t{
  157. display: flex;
  158. align-items: center;
  159. width: 100%;
  160. height: auto;
  161. padding:12rpx 0;
  162. .pros-img{
  163. width: 210rpx;
  164. height: 100%;
  165. border-radius: 10rpx;
  166. margin:0 26rpx 0 0;
  167. position: relative;
  168. .tips{
  169. display: inline-block;
  170. width: 80rpx;
  171. height: 40rpx;
  172. background-image: linear-gradient(214deg, #ff4500 0%, #ff5800 53%, #ff4367 100%);
  173. line-height: 40rpx;
  174. text-align: center;
  175. font-size: $font-size-24;
  176. color: #FFFFFF;
  177. border-radius:10rpx 0 10rpx 0 ;
  178. position: absolute;
  179. top:0;
  180. left: 0;
  181. }
  182. image{
  183. width: 210rpx;
  184. height: 210rpx;
  185. border-radius: 10rpx;
  186. border:1px solid #f3f3f3;
  187. }
  188. }
  189. }
  190. .pros-product{
  191. width: 468rpx;
  192. height: 100%;
  193. line-height: 40rpx;
  194. font-size: $font-size-26;
  195. position: relative;
  196. .producttitle{
  197. width: 100%;
  198. display: inline-block;
  199. height: auto;
  200. text-overflow:ellipsis;
  201. display: -webkit-box;
  202. word-break: break-all;
  203. -webkit-box-orient: vertical;
  204. -webkit-line-clamp: 2;
  205. overflow: hidden;
  206. margin-bottom: 8rpx;
  207. }
  208. .productspec{
  209. width: 100%;
  210. float: left;
  211. height: 40rpx;
  212. color: #999999;
  213. line-height: 40rpx;
  214. font-size: 20rpx;
  215. text-overflow:ellipsis;
  216. display: -webkit-box;
  217. word-break: break-all;
  218. -webkit-box-orient: vertical;
  219. -webkit-line-clamp: 2;
  220. overflow: hidden;
  221. }
  222. .productprice{
  223. width: 100%;
  224. height: 54rpx;
  225. line-height: 54rpx;
  226. width: 100%;
  227. .price{
  228. line-height: 54rpx;
  229. font-size: $font-size-28;
  230. width: 48%;
  231. color: #FF2A2A;
  232. float: left;
  233. &.disabled{
  234. color: #999999;
  235. text-decoration: line-through;
  236. }
  237. }
  238. .count{
  239. height: 100%;
  240. float: right;
  241. position: relative;
  242. .small{
  243. color: #666666;
  244. }
  245. }
  246. }
  247. .floor-item-act{
  248. width: 100%;
  249. height: 30rpx;
  250. margin-top: 8rpx;
  251. float: left;
  252. .tag{
  253. display: inline-block;
  254. width: 80rpx;
  255. height: 30rpx;
  256. background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
  257. background-size: contain;
  258. font-size: 22rpx;
  259. line-height: 30rpx;
  260. text-align: center;
  261. color: #f83c6c;
  262. float: left;
  263. }
  264. }
  265. }
  266. .goods-pros-m{
  267. height: 76rpx;
  268. line-height: 76rpx;
  269. font-size: $font-size-26;
  270. color: $text-color;
  271. margin-top: 12rpx;
  272. .m-text{
  273. width: 62rpx;
  274. float: left;
  275. padding-right: 20rpx;
  276. font-weight:bold;
  277. }
  278. .m-input{
  279. display: -webkit-box;
  280. display: -webkit-flex;
  281. display: flex;
  282. -webkit-box-align: center;
  283. -webkit-align-items: center;
  284. align-items: center;
  285. position: relative;
  286. width: 576rpx;
  287. height: 36rpx;
  288. padding: 20rpx;
  289. background: #F9F9F9;
  290. border-radius: 10rpx;
  291. input{
  292. width: 100%;
  293. height: 100%;
  294. font-size: $font-size-26;
  295. line-height: 36rpx;
  296. color: #333333;
  297. min-height: 36rpx;
  298. }
  299. }
  300. }
  301. .goods-pros-b{
  302. width:100%;
  303. height: auto;
  304. padding: 10rpx 0;
  305. .sum-none{
  306. width: 100%;
  307. height: 48rpx;
  308. line-height: 48rpx;
  309. color: $text-color;
  310. float: left;
  311. text-align: right;
  312. .money{
  313. font-size: $font-size-26;
  314. color: #999999;
  315. text-decoration: line-through;
  316. }
  317. .money-sign{
  318. font-size: $font-size-26;
  319. color: #999999;
  320. text-decoration: line-through;
  321. }
  322. .money-reduced{
  323. margin-left: 10rpx;
  324. font-size: $font-size-26;
  325. color: $color-system;
  326. .iconfont{
  327. font-size: $font-size-34;
  328. }
  329. }
  330. }
  331. .sum{
  332. width: 100%;
  333. height: 48rpx;
  334. font-size: $font-size-28;
  335. line-height: 48rpx;
  336. color: $text-color;
  337. display: flex;
  338. justify-content: flex-end;
  339. .money{
  340. color: #FF2A2A;
  341. font-size: $font-size-28;
  342. }
  343. }
  344. }
  345. }
  346. }
  347. </style>