goodsList.vue 8.1 KB

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