app-goods-price.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view class="app-goods-price">
  3. <view class="top dir-left-nowrap">
  4. <view class="box-grow-1 cross-center negotiable"
  5. :class="theme + '-color'"
  6. v-if="goods.is_negotiable && goods.is_negotiable === 1"
  7. >价格面议
  8. </view>
  9. <view class="box-grow-1" v-else>
  10. <view v-if="goods.level_show === 1">
  11. <view class="dir-left-nowrap cross-bottom">
  12. <view class="price box-grow-0" style="color: #f39800;font-family: DIN;">
  13. <app-price :max="`${goodsPrice.max}`" :min="`${goodsPrice.min}`"
  14. :default-price="`${goodsPrice.price}`"></app-price>
  15. </view>
  16. <view class="app-member-mark" v-if="is_show_member">
  17. <app-member-mark></app-member-mark>
  18. </view>
  19. <app-sup-vip :is_vip_card_user="is_vip_card_user" margin="0 0 0 13rpx" v-if="discount > 0" :discount="discount"></app-sup-vip>
  20. </view>
  21. <view class="dir-left-nowrap cross-bottom">
  22. <view :class="theme + '-color'" class="box-grow-0 member-price" v-if="isUnderlinePrice == 1">
  23. <app-price :price="`${goodsPrice.original_price}`" type="text-price-all"></app-price>
  24. </view>
  25. <view class="sales" v-if="goods.is_sales === 1">销量{{goods.sales}}{{goods.unit}}</view>
  26. </view>
  27. </view>
  28. <view v-else>
  29. <view class="dir-left-nowrap cross-bottom">
  30. <view :class="theme + '-color'" class="price" style="font-family: DIN;">
  31. <app-price :max="`${goodsPrice.max}`" :min="`${goodsPrice.min}`"
  32. :default-price="`${goodsPrice.defaultPrice}`"></app-price>
  33. </view>
  34. <app-sup-vip :is_vip_card_user="is_vip_card_user" margin="0 0 0 13rpx" v-if="discount > 0" :discount="discount"></app-sup-vip>
  35. </view>
  36. <view class="dir-left-nowrap cross-bottom">
  37. <view class="origin-price sales" v-if="isUnderlinePrice == 1">
  38. <app-price :price="`${goodsPrice.original_price}`" type="text-price-all"></app-price>
  39. </view>
  40. <view class="sales" v-if="goods.is_sales === 1">销量{{goods.sales}}{{goods.unit}}</view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="box-grow-0 share" @click="shareClick">
  45. <image src="../../../static/image/icon/icon-share.png"></image>
  46. <view>分享</view>
  47. </view>
  48. <view>
  49. <app-goods-quick-share v-model="quickShareShow" @quickShare="quickShare"
  50. :goods="goods"></app-goods-quick-share>
  51. </view>
  52. <view>
  53. <app-share-qr-code v-model="shareShow" :url="newShareUrl"></app-share-qr-code>
  54. </view>
  55. </view>
  56. <view v-if="goods.level_show === 2 && goods.is_negotiable === 0">
  57. <app-join-member :member-max-price="`${goods.price_member_max}`" :member-min-price="`${goods.price_member_min}`"
  58. :price="`${goods.price}`"></app-join-member>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import {mapState} from 'vuex';
  64. import appPrice from '../goods/app-price.vue';
  65. import appMemberMark from '../../page-component/app-member-mark/app-member-mark.vue';
  66. import appShareQrCode from '../../page-component/app-share-qr-code-poster/app-share-qr-code-poster.vue';
  67. import appJoinMember from "../../page-component/app-join-member/app-join-member.vue";
  68. import appGoodsQuickShare from '../goods/app-goods-quick-share.vue';
  69. import appSupVip from "../../page-component/app-sup-vip/app-sup-vip.vue";
  70. export default {
  71. components: {
  72. 'app-price': appPrice,
  73. 'app-member-mark': appMemberMark,
  74. 'app-share-qr-code': appShareQrCode,
  75. 'app-join-member': appJoinMember,
  76. 'app-sup-vip': appSupVip,
  77. appGoodsQuickShare
  78. },
  79. props: {
  80. goods: Object,
  81. is_vip_goods: {
  82. type: Number,
  83. default() {
  84. return 0;
  85. }
  86. },
  87. discount: {
  88. type: String,
  89. default() {
  90. return null;
  91. }
  92. },
  93. selectAttr: {
  94. type: Object,
  95. default() {
  96. return {};
  97. }
  98. },
  99. shareUrl: {
  100. type: String,
  101. default() {
  102. return '';
  103. }
  104. },
  105. is_vip_card_user: {
  106. type: Number,
  107. default() {
  108. return 0
  109. }
  110. },
  111. is_show_member: {
  112. type: Boolean,
  113. default() {
  114. return true;
  115. }
  116. }
  117. },
  118. data() {
  119. return {
  120. quickShareShow: false,
  121. shareShow: false,
  122. };
  123. },
  124. computed: {
  125. ...mapState({
  126. theme: state => state.mallConfig.theme,
  127. isUnderlinePrice: state => state.mallConfig.mall.setting.is_underline_price,
  128. }),
  129. goodsPrice() {
  130. if (!this.goods) return {};
  131. let {price_member_max, price_member_min, price, price_max, price_min, original_price} = this.goods;
  132. let data = {};
  133. if (this.goods.level_show === 1) {
  134. data = {
  135. max: price_member_max,
  136. min: price_member_min,
  137. defaultPrice: price,
  138. original_price: price,
  139. };
  140. } else {
  141. data = {
  142. max: price_max,
  143. min: price_min,
  144. defaultPrice: price,
  145. original_price: original_price,
  146. }
  147. }
  148. return data;
  149. },
  150. newShareUrl() {
  151. if (this.shareUrl) {
  152. return this.shareUrl;
  153. } else {
  154. if (this.goods) {
  155. return this.$api.poster.goods + '&goods_id=' + this.goods.id;
  156. } else {
  157. return ``;
  158. }
  159. }
  160. }
  161. },
  162. methods: {
  163. quickShare(e) {
  164. this.$emit('quickShare', e);
  165. },
  166. shareClick() {
  167. // 判断登入
  168. if (!this.$user.isLogin()) {
  169. this.$user.getInfo().then(() => {
  170. });
  171. } else {
  172. if (this.goods.extra_quick_share) {
  173. this.quickShareShow = true;
  174. } else {
  175. this.shareShow = true;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. </script>
  182. <style scoped lang="scss">
  183. .vip-price {
  184. width: #{148upx};
  185. height: #{27upx};
  186. margin-left: #{13rpx};
  187. .item {
  188. height: #{27upx};
  189. width: 50%;
  190. }
  191. .left {
  192. border-top-left-radius: #{13upx};
  193. border-bottom-left-radius: #{13upx};
  194. background-color: #4e4040;
  195. position: relative;
  196. }
  197. .right {
  198. border-top-right-radius: #{13upx};
  199. border-bottom-right-radius: #{13upx};
  200. background: linear-gradient(45deg, #edc9a8, #fdebde);
  201. font-size: #{18upx};
  202. line-height: #{27upx};
  203. text-align: center;
  204. color: #4e4040;
  205. }
  206. .vip-icon {
  207. width: #{51upx};
  208. height: #{14upx};
  209. position:absolute;
  210. top: 50%;
  211. left: 50%;
  212. transform: translate(-50%, -50%);
  213. }
  214. }
  215. .app-goods-price {
  216. padding: 0 #{24rpx};
  217. background-color: #ffffff;
  218. .top {
  219. padding-bottom: #{24rpx};
  220. .price {
  221. font-size: #{56rpx};
  222. line-height: 1;
  223. }
  224. .member-img {
  225. width: #{94rpx};
  226. height: #{40rpx};
  227. margin-left: #{16rpx};
  228. }
  229. .origin-price {
  230. text-decoration: line-through;
  231. margin-right: #{24rpx};
  232. color: $uni-general-color-two;
  233. font-size: $uni-font-size-general-one;
  234. }
  235. .sales {
  236. color: $uni-general-color-two;
  237. font-size: $uni-font-size-weak-one;
  238. margin-top: #{22rpx};
  239. }
  240. .app-member-mark {
  241. margin-left: #{12rpx};
  242. }
  243. .member-price {
  244. font-size: $uni-font-size-import-two;
  245. margin-right: #{20rpx};
  246. line-height: 1;
  247. }
  248. .negotiable {
  249. font-size: #{48rpx};
  250. }
  251. }
  252. .share {
  253. margin-top: #{16rpx};
  254. font-size: $uni-font-size-weak-two;
  255. color: $uni-general-color-one;
  256. image {
  257. width: #{40rpx};
  258. height: #{40rpx};
  259. margin-bottom: #{10rpx};
  260. }
  261. }
  262. }
  263. </style>