goodsList.vue 8.2 KB

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