sellerGoodsList.vue 8.2 KB

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