goodsList.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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. float: left;
  109. margin-top: 24rpx;
  110. .goods-list{
  111. width: 100%;
  112. height: auto;
  113. background:#F7F7F7;
  114. .goods-item{
  115. width: 702rpx;
  116. padding: 0 24rpx;
  117. background: #FFFFFF;
  118. margin-bottom: 24rpx;
  119. &:last-child{
  120. margin-bottom: 0;
  121. }
  122. }
  123. .shoptitle{
  124. display: flex;
  125. align-items: center;
  126. height: 80rpx;
  127. line-height: 80rpx;
  128. .title-logo{
  129. width: 48rpx;
  130. height: 48rpx;
  131. float: left;
  132. border-radius: 8rpx;
  133. border: 1px solid #e1e1e1;
  134. margin-right: 10rpx;
  135. image{
  136. border-radius: 8rpx;
  137. width: 48rpx;
  138. height: 48rpx;
  139. }
  140. }
  141. .title-text{
  142. width: 400rpx;
  143. overflow: hidden;
  144. text-overflow:ellipsis;
  145. white-space: nowrap;
  146. float: left;
  147. font-size: $font-size-28;
  148. color: $text-color;
  149. text-align: left;
  150. line-height: 56rpx;
  151. font-weight: bold;
  152. }
  153. }
  154. .productlist{
  155. width: 100%;
  156. height: auto;
  157. }
  158. .goods-pros-t{
  159. display: flex;
  160. align-items: center;
  161. width: 100%;
  162. height: auto;
  163. padding:12rpx 0;
  164. .pros-img{
  165. width: 210rpx;
  166. height: 100%;
  167. border-radius: 10rpx;
  168. margin:0 26rpx 0 0;
  169. position: relative;
  170. .tips{
  171. display: inline-block;
  172. width: 80rpx;
  173. height: 40rpx;
  174. background-image: linear-gradient(214deg, #ff4500 0%, #ff5800 53%, #ff4367 100%);
  175. line-height: 40rpx;
  176. text-align: center;
  177. font-size: $font-size-24;
  178. color: #FFFFFF;
  179. border-radius:10rpx 0 10rpx 0 ;
  180. position: absolute;
  181. top:0;
  182. left: 0;
  183. }
  184. image{
  185. width: 210rpx;
  186. height: 210rpx;
  187. border-radius: 10rpx;
  188. border:1px solid #f3f3f3;
  189. }
  190. }
  191. }
  192. .pros-product{
  193. width: 468rpx;
  194. height: 100%;
  195. line-height: 40rpx;
  196. font-size: $font-size-26;
  197. position: relative;
  198. .producttitle{
  199. width: 100%;
  200. display: inline-block;
  201. height: auto;
  202. text-overflow:ellipsis;
  203. display: -webkit-box;
  204. word-break: break-all;
  205. -webkit-box-orient: vertical;
  206. -webkit-line-clamp: 2;
  207. overflow: hidden;
  208. margin-bottom: 8rpx;
  209. }
  210. .productspec{
  211. width: 100%;
  212. float: left;
  213. height: 40rpx;
  214. color: #999999;
  215. line-height: 40rpx;
  216. font-size: 20rpx;
  217. text-overflow:ellipsis;
  218. display: -webkit-box;
  219. word-break: break-all;
  220. -webkit-box-orient: vertical;
  221. -webkit-line-clamp: 2;
  222. overflow: hidden;
  223. }
  224. .productprice{
  225. width: 100%;
  226. height: 54rpx;
  227. line-height: 54rpx;
  228. width: 100%;
  229. .price{
  230. line-height: 54rpx;
  231. font-size: $font-size-28;
  232. width: 48%;
  233. color: #FF2A2A;
  234. float: left;
  235. &.disabled{
  236. color: #999999;
  237. text-decoration: line-through;
  238. }
  239. }
  240. .count{
  241. height: 100%;
  242. float: right;
  243. position: relative;
  244. .small{
  245. color: #666666;
  246. }
  247. }
  248. }
  249. .floor-item-act{
  250. width: 100%;
  251. height: 30rpx;
  252. margin-top: 8rpx;
  253. float: left;
  254. .tag{
  255. display: inline-block;
  256. height: 32rpx;
  257. font-size: 22rpx;
  258. line-height: 30rpx;
  259. text-align: center;
  260. color: #f83c6c;
  261. float: left;
  262. margin-right: 10rpx;
  263. &.tag-02{
  264. width: 80rpx;
  265. background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
  266. background-size: contain;
  267. }
  268. &.tag-01{
  269. width: 56rpx;
  270. color: #fff;
  271. background-color: #f83c6c;
  272. border-radius: 4rpx;
  273. }
  274. }
  275. }
  276. }
  277. .goods-pros-m{
  278. height: 76rpx;
  279. line-height: 76rpx;
  280. font-size: $font-size-26;
  281. color: $text-color;
  282. margin-top: 12rpx;
  283. .m-text{
  284. width: 62rpx;
  285. float: left;
  286. padding-right: 20rpx;
  287. font-weight:bold;
  288. }
  289. .m-input{
  290. display: -webkit-box;
  291. display: -webkit-flex;
  292. display: flex;
  293. -webkit-box-align: center;
  294. -webkit-align-items: center;
  295. align-items: center;
  296. position: relative;
  297. width: 576rpx;
  298. height: 36rpx;
  299. padding: 20rpx;
  300. background: #F9F9F9;
  301. border-radius: 10rpx;
  302. input{
  303. width: 100%;
  304. height: 100%;
  305. font-size: $font-size-26;
  306. line-height: 36rpx;
  307. color: #333333;
  308. min-height: 36rpx;
  309. }
  310. }
  311. }
  312. .goods-pros-b{
  313. width:100%;
  314. height: auto;
  315. padding: 10rpx 0;
  316. .sum-none{
  317. width: 100%;
  318. height: 48rpx;
  319. line-height: 48rpx;
  320. color: $text-color;
  321. float: left;
  322. text-align: right;
  323. .money{
  324. font-size: $font-size-26;
  325. color: #999999;
  326. text-decoration: line-through;
  327. }
  328. .money-sign{
  329. font-size: $font-size-26;
  330. color: #999999;
  331. text-decoration: line-through;
  332. }
  333. .money-reduced{
  334. margin-left: 10rpx;
  335. font-size: $font-size-26;
  336. color: $color-system;
  337. .iconfont{
  338. font-size: $font-size-34;
  339. }
  340. }
  341. }
  342. .sum{
  343. width: 100%;
  344. height: 48rpx;
  345. font-size: $font-size-28;
  346. line-height: 48rpx;
  347. color: $text-color;
  348. display: flex;
  349. justify-content: flex-end;
  350. .money{
  351. color: #FF2A2A;
  352. font-size: $font-size-28;
  353. }
  354. }
  355. }
  356. }
  357. }
  358. </style>