sellerGoodsList.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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 v-if="item.promotions" class="floor-item-act">
  8. <view class="floor-tags">{{item.promotions.name}}</view>
  9. </view>
  10. <view class="title-text">{{item.name}}</view>
  11. </view>
  12. <view class="productlist" v-for="(pros,idx) in item.productsList" :key="idx">
  13. <view class="goods-pros-t">
  14. <view class="pros-img">
  15. <image :src="pros.mainImage" alt="" />
  16. <text class="tips" v-if="pros.giftType == 2 || pros.giftType == 1">赠品</text>
  17. </view>
  18. <view class="pros-product">
  19. <view class="producttitle">{{pros.name}}</view>
  20. <view class="productspec" v-if="pros.productCategory!=2">规格:{{pros.unit}}</view>
  21. <view class="productspec" v-if="pros.productCode!=''&&pros.productCode!=null">
  22. <view >商品编码:{{pros.productCode}}</view>
  23. </view>
  24. <view class="productprice">
  25. <view class="price"><text>¥{{pros.retailPrice | NumFormat}}</text></view>
  26. <view class="count"><text class="small">x</text>{{pros.productCount}}</view>
  27. </view>
  28. <view class="floor-item-act" v-if="pros.promotions!=null">
  29. <view v-if="PromotionsFormat(pros.promotions)" class="floor-tags">
  30. {{pros.promotions.name}}
  31. <text v-if ="pros.promotions!=null">
  32. :¥{{ pros.promotions == null ? '0.00' : pros.promotions.touchPrice | NumFormat}}
  33. </text>
  34. </view>
  35. <view v-else-if="pros.promotions.type !=3" class="floor-tags">{{pros.promotions.name}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="goods-pros-m">
  41. <view class="m-text">留言:</view>
  42. <view class="m-input">
  43. <input type="text"
  44. v-model="remark[index]"
  45. @change="changeHandle(index)"
  46. placeholder-class="placeholder"
  47. maxlength="50"
  48. placeholder="选填,最多不超过50个汉字"/>
  49. </view>
  50. </view>
  51. <view class="goods-pros-b">
  52. <view class="sum-none" v-if="item.reducedPrice>0">
  53. <text class="money-sign">¥</text>
  54. <text class="money">{{ item.totalPrice | NumFormat }}</text>
  55. <text class="money-reduced">减<text>¥{{ item.reducedPrice | NumFormat}}</text></text>
  56. </view>
  57. <view class="sum">合计:<text class="money">¥{{ ( item.totalPrice -item.reducedPrice ) | 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-text{
  137. width: 400rpx;
  138. overflow: hidden;
  139. text-overflow:ellipsis;
  140. white-space: nowrap;
  141. float: left;
  142. font-size: $font-size-28;
  143. color: $text-color;
  144. text-align: left;
  145. line-height: 56rpx;
  146. font-weight: bold;
  147. }
  148. .floor-item-act{
  149. height: 56rpx;
  150. text-align: center;
  151. box-sizing: border-box;
  152. float: left;
  153. padding: 12rpx 0;
  154. margin-right: 12rpx;
  155. .floor-tags{
  156. height: 28rpx;
  157. border-radius: 6rpx;
  158. background-color: #FFFFFF;
  159. line-height: 28rpx;
  160. color: $color-system;
  161. text-align: center;
  162. display: inline-block;
  163. padding:0 16rpx;
  164. font-size: $font-size-20;
  165. border: 1px solid #E15616;
  166. float: left;
  167. }
  168. }
  169. }
  170. .productlist{
  171. width: 100%;
  172. height: auto;
  173. }
  174. .goods-pros-t{
  175. display: flex;
  176. align-items: center;
  177. width: 100%;
  178. height: auto;
  179. padding:12rpx 0;
  180. .pros-img{
  181. width: 210rpx;
  182. height: 100%;
  183. border-radius: 10rpx;
  184. margin:0 26rpx 0 0;
  185. position: relative;
  186. .tips{
  187. display: inline-block;
  188. width: 80rpx;
  189. height: 40rpx;
  190. background-image: linear-gradient(214deg, #ff4500 0%, #ff5800 53%, #ff4367 100%);
  191. line-height: 40rpx;
  192. text-align: center;
  193. font-size: $font-size-24;
  194. color: #FFFFFF;
  195. border-radius:10rpx 0 10rpx 0 ;
  196. position: absolute;
  197. top:0;
  198. left: 0;
  199. }
  200. image{
  201. width: 210rpx;
  202. height: 210rpx;
  203. border-radius: 10rpx;
  204. border:1px solid #f3f3f3;
  205. }
  206. }
  207. }
  208. .pros-product{
  209. width: 468rpx;
  210. height: 100%;
  211. line-height: 40rpx;
  212. font-size: $font-size-26;
  213. position: relative;
  214. .producttitle{
  215. width: 100%;
  216. display: inline-block;
  217. height: auto;
  218. text-overflow:ellipsis;
  219. display: -webkit-box;
  220. word-break: break-all;
  221. -webkit-box-orient: vertical;
  222. -webkit-line-clamp: 2;
  223. overflow: hidden;
  224. margin-bottom: 8rpx;
  225. }
  226. .productspec{
  227. height: 40rpx;
  228. color: #999999;
  229. line-height: 40rpx;
  230. text-overflow:ellipsis;
  231. display: -webkit-box;
  232. word-break: break-all;
  233. -webkit-box-orient: vertical;
  234. -webkit-line-clamp: 2;
  235. overflow: hidden;
  236. }
  237. .productprice{
  238. height: 54rpx;
  239. line-height: 54rpx;
  240. width: 100%;
  241. float: left;
  242. .price{
  243. line-height: 54rpx;
  244. font-size: $font-size-28;
  245. width: 48%;
  246. color: #FF2A2A;
  247. float: left;
  248. }
  249. .count{
  250. height: 100%;
  251. float: right;
  252. position: relative;
  253. .small{
  254. color: #666666;
  255. }
  256. }
  257. }
  258. .floor-item-act{
  259. width: 100%;
  260. height: 56rpx;
  261. text-align: center;
  262. box-sizing: border-box;
  263. float: left;
  264. padding:0 0 10rpx 0;
  265. .floor-tags{
  266. height: 28rpx;
  267. border-radius: 6rpx;
  268. background-color: #FFFFFF;
  269. line-height: 28rpx;
  270. color: $color-system;
  271. text-align: center;
  272. display: inline-block;
  273. padding:0 16rpx;
  274. font-size: $font-size-20;
  275. border: 1px solid #E15616;
  276. float: left;
  277. }
  278. }
  279. }
  280. .goods-pros-m{
  281. height: 76rpx;
  282. line-height: 76rpx;
  283. font-size: $font-size-26;
  284. color: $text-color;
  285. margin-top: 12rpx;
  286. .m-text{
  287. width: 62rpx;
  288. float: left;
  289. padding-right: 20rpx;
  290. font-weight:bold;
  291. }
  292. .m-input{
  293. display: -webkit-box;
  294. display: -webkit-flex;
  295. display: flex;
  296. -webkit-box-align: center;
  297. -webkit-align-items: center;
  298. align-items: center;
  299. position: relative;
  300. width: 576rpx;
  301. height: 36rpx;
  302. padding: 20rpx;
  303. background: #fff;
  304. border-radius: 10rpx;
  305. border: 2rpx solid #b2b2b2;
  306. input{
  307. width: 100%;
  308. height: 100%;
  309. // background: #F7F7F7;
  310. font-size: $font-size-26;
  311. line-height: 36rpx;
  312. color: #333333;
  313. min-height: 36rpx;
  314. }
  315. }
  316. }
  317. .goods-pros-b{
  318. width:100%;
  319. height: auto;
  320. padding: 10rpx 0;
  321. .sum-none{
  322. width: 100%;
  323. height: 48rpx;
  324. line-height: 48rpx;
  325. color: $text-color;
  326. float: left;
  327. text-align: right;
  328. .money{
  329. font-size: $font-size-26;
  330. color: #999999;
  331. text-decoration: line-through;
  332. }
  333. .money-sign{
  334. font-size: $font-size-26;
  335. color: #999999;
  336. text-decoration: line-through;
  337. }
  338. .money-reduced{
  339. margin-left: 10rpx;
  340. font-size: $font-size-26;
  341. color: $color-system;
  342. .iconfont{
  343. font-size: $font-size-34;
  344. }
  345. }
  346. }
  347. .sum{
  348. width: 100%;
  349. height: 48rpx;
  350. font-size: $font-size-28;
  351. line-height: 48rpx;
  352. color: $text-color;
  353. display: flex;
  354. justify-content: flex-end;
  355. .money{
  356. color: #FF2A2A;
  357. font-size: $font-size-28;
  358. }
  359. }
  360. }
  361. }
  362. }
  363. </style>