sellerGoodsList.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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-text">{{ item.shopName }}</view>
  8. </view>
  9. <view class="productlist" v-for="(pros, idx) in item.cartList" :key="idx">
  10. <view class="goods-pros-t">
  11. <view class="pros-img">
  12. <image :src="pros.image" alt="" />
  13. <text class="tips" v-if="pros.giftType == 2 || pros.giftType == 1">赠品</text>
  14. </view>
  15. <view class="pros-product">
  16. <view class="producttitle">{{ pros.name }}</view>
  17. <view class="productspec" v-if="pros.productCategory != 2">规格:{{ pros.unit }}</view>
  18. <view class="productspec" v-if="pros.productCode != '' && pros.productCode != null">
  19. <view>商品编码:{{ pros.productCode }}</view>
  20. </view>
  21. <view class="productprice">
  22. <view class="price"
  23. ><text>¥{{ pros.price | NumFormat }}</text></view
  24. >
  25. <view class="count"><text class="small">x</text>{{ pros.number }}</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
  34. type="text"
  35. v-model="remark[index]"
  36. @change="changeHandle(index)"
  37. placeholder-class="placeholder"
  38. maxlength="50"
  39. placeholder="选填,最多不超过50个汉字"
  40. />
  41. </view>
  42. </view>
  43. <view class="goods-pros-b">
  44. <view class="sum-none" v-if="item.reducedPrice > 0">
  45. <text class="money-sign">¥</text>
  46. <text class="money">{{ item.originalPrice | NumFormat }}</text>
  47. <text class="money-reduced"
  48. >减<text>¥{{ item.reducedPrice | NumFormat }}</text></text
  49. >
  50. </view>
  51. <view class="sum"
  52. >合计:<text class="money"
  53. >¥{{ (item.originalPrice - item.reducedPrice) | NumFormat }}</text
  54. ></view
  55. >
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. name: 'goods',
  64. props: {
  65. goodsData: {
  66. type: Array
  67. }
  68. },
  69. data() {
  70. return {
  71. remark: []
  72. }
  73. },
  74. created() {},
  75. filters: {
  76. NumFormat(value) {
  77. //处理金额
  78. return Number(value).toFixed(2)
  79. }
  80. },
  81. watch: {
  82. goodsData: {
  83. handler: function(el) {
  84. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  85. this.goodsData = el
  86. },
  87. deep: true
  88. }
  89. },
  90. computed: {},
  91. methods: {
  92. PromotionsFormat(promo) {
  93. //促销活动类型数据处理
  94. if (promo != null) {
  95. if (promo.type == 1 && promo.mode == 1) {
  96. return true
  97. } else {
  98. return false
  99. }
  100. }
  101. return false
  102. },
  103. changeHandle(index) {
  104. //输入框的值被改变后
  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. }
  149. .productlist {
  150. width: 100%;
  151. height: auto;
  152. }
  153. .goods-pros-t {
  154. display: flex;
  155. align-items: center;
  156. width: 100%;
  157. height: auto;
  158. padding: 12rpx 0;
  159. .pros-img {
  160. width: 210rpx;
  161. height: 100%;
  162. border-radius: 10rpx;
  163. margin: 0 26rpx 0 0;
  164. position: relative;
  165. .tips {
  166. display: inline-block;
  167. width: 80rpx;
  168. height: 40rpx;
  169. background-image: linear-gradient(214deg, #ff4500 0%, #ff5800 53%, #ff4367 100%);
  170. line-height: 40rpx;
  171. text-align: center;
  172. font-size: $font-size-24;
  173. color: #ffffff;
  174. border-radius: 10rpx 0 10rpx 0;
  175. position: absolute;
  176. top: 0;
  177. left: 0;
  178. }
  179. image {
  180. width: 210rpx;
  181. height: 210rpx;
  182. border-radius: 10rpx;
  183. border: 1px solid #f3f3f3;
  184. }
  185. }
  186. }
  187. .pros-product {
  188. width: 468rpx;
  189. height: 100%;
  190. line-height: 40rpx;
  191. font-size: $font-size-26;
  192. position: relative;
  193. .producttitle {
  194. width: 100%;
  195. display: inline-block;
  196. height: auto;
  197. text-overflow: ellipsis;
  198. display: -webkit-box;
  199. word-break: break-all;
  200. -webkit-box-orient: vertical;
  201. -webkit-line-clamp: 2;
  202. overflow: hidden;
  203. margin-bottom: 8rpx;
  204. }
  205. .productspec {
  206. height: 40rpx;
  207. color: #999999;
  208. line-height: 40rpx;
  209. text-overflow: ellipsis;
  210. display: -webkit-box;
  211. word-break: break-all;
  212. -webkit-box-orient: vertical;
  213. -webkit-line-clamp: 2;
  214. overflow: hidden;
  215. }
  216. .productprice {
  217. height: 54rpx;
  218. line-height: 54rpx;
  219. width: 100%;
  220. float: left;
  221. .price {
  222. line-height: 54rpx;
  223. font-size: $font-size-28;
  224. width: 48%;
  225. color: #ff2a2a;
  226. float: left;
  227. }
  228. .count {
  229. height: 100%;
  230. float: right;
  231. position: relative;
  232. .small {
  233. color: #666666;
  234. }
  235. }
  236. }
  237. }
  238. .goods-pros-m {
  239. height: 76rpx;
  240. line-height: 76rpx;
  241. font-size: $font-size-26;
  242. color: $text-color;
  243. margin-top: 12rpx;
  244. .m-text {
  245. width: 62rpx;
  246. float: left;
  247. padding-right: 20rpx;
  248. font-weight: bold;
  249. }
  250. .m-input {
  251. display: -webkit-box;
  252. display: -webkit-flex;
  253. display: flex;
  254. -webkit-box-align: center;
  255. -webkit-align-items: center;
  256. align-items: center;
  257. position: relative;
  258. width: 576rpx;
  259. height: 36rpx;
  260. padding: 20rpx;
  261. background: #fff;
  262. border-radius: 10rpx;
  263. border: 2rpx solid #b2b2b2;
  264. input {
  265. width: 100%;
  266. height: 100%;
  267. // background: #F7F7F7;
  268. font-size: $font-size-26;
  269. line-height: 36rpx;
  270. color: #333333;
  271. min-height: 36rpx;
  272. }
  273. }
  274. }
  275. .goods-pros-b {
  276. width: 100%;
  277. height: auto;
  278. padding: 10rpx 0;
  279. .sum-none {
  280. width: 100%;
  281. height: 48rpx;
  282. line-height: 48rpx;
  283. color: $text-color;
  284. float: left;
  285. text-align: right;
  286. .money {
  287. font-size: $font-size-26;
  288. color: #999999;
  289. text-decoration: line-through;
  290. }
  291. .money-sign {
  292. font-size: $font-size-26;
  293. color: #999999;
  294. text-decoration: line-through;
  295. }
  296. .money-reduced {
  297. margin-left: 10rpx;
  298. font-size: $font-size-26;
  299. color: $color-system;
  300. .iconfont {
  301. font-size: $font-size-34;
  302. }
  303. }
  304. }
  305. .sum {
  306. width: 100%;
  307. height: 48rpx;
  308. font-size: $font-size-28;
  309. line-height: 48rpx;
  310. color: $text-color;
  311. display: flex;
  312. justify-content: flex-end;
  313. .money {
  314. color: #ff2a2a;
  315. font-size: $font-size-28;
  316. }
  317. }
  318. }
  319. }
  320. }
  321. </style>