bd-info.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="bd-info">
  3. <text class="bd-name u-line-2">{{name}}</text>
  4. <text class="bd-subtitle u-line-3" v-if="subtitle">{{subtitle}}</text>
  5. <view class="dir-left-nowrap bd-price-share">
  6. <view class="box-grow-1" :class="isNegotiable === 1 ? 'cross-center' : ''">
  7. <template v-if="isNegotiable !== 1">
  8. <view>
  9. <template v-if="levelShow === 1">
  10. <view class="dir-left-wrap cross-bottom">
  11. <view class="bd-price box-grow-0" :style="{'color': theme.color}">
  12. <app-price :max="`${priceMemberMax}`" :min="`${priceMemberMin}`" :default-price="`${price}`" :theme="theme"></app-price>
  13. </view>
  14. <view v-if="isShowMember" class="bd-member-mark">
  15. <app-member-mark :theme="theme"></app-member-mark>
  16. </view>
  17. <app-sup-vip v-if="discount" :is_vip_card_user="isVipCardUser" margin="0 0 0 13rpx" :discount="discount"></app-sup-vip>
  18. </view>
  19. <view class="dir-left-nowrap cross-bottom">
  20. <view v-if="isUnderlinePrice == 1" :style="{'color': theme.color}" class="'box-grow-0', 'bd-member-price'">
  21. <app-price :price="`${price}`" type="text-price-all"></app-price>
  22. </view>
  23. <view v-if="isSales === 1" class="bd-sales">销量{{sales}}{{unit}}</view>
  24. </view>
  25. <view class="dir-left-nowrap cross-bottom" style="display: flex;margin-top: 10px;align-items: center;">
  26. <view style="display: flex;flex: 1;align-items: center;">
  27. <image v-if="origin_icon!=null" class="bd-icon box-grow-0" :src="`${origin_icon}`" style="width: 20px;height: 14px;"></image>
  28. <view v-if="origin_name!=null" style="margin-left: 2px;margin-right: 30px;font-size: 14px;color: #666;width: 56px; overflow: hidden; white-space: normal;">{{origin_name}}</view>
  29. </view>
  30. <view style="display: flex;flex: 1;align-items: center;">
  31. <image v-if="brand_logo!=null" class="bd-icon box-grow-0" :src="`${brand_logo}`" style="width: 20px;height: 14px;"></image>
  32. <view v-if="brand_name!=null" style="margin-left: 2px;margin-right: 30px;font-size: 14px;color: #666;width: 70px; overflow: hidden; white-space: normal;">{{brand_name}}</view>
  33. </view>
  34. <view v-if="trade_name!=null" style="flex: 1;font-size: 14px;color: #666;">{{trade_name}}</view>
  35. </view>
  36. </template>
  37. <template v-else >
  38. <view class="dir-left-wrap cross-bottom">
  39. <view :style="{'color': theme.color}" class="bd-price">
  40. <app-price :max="`${priceMax}`" :min="`${priceMin}`" :default-price="`${price}`"></app-price>
  41. </view>
  42. <view v-if="isUnderlinePrice == 1" class="bd-origin-price" >
  43. <app-price :price="`${originalPrice}`" type="text-price-all"></app-price>
  44. </view>
  45. <app-sup-vip v-if="discount" :is_vip_card_user="isVipCardUser" margin="0 0 0 13rpx" :discount="discount"></app-sup-vip>
  46. </view>
  47. <view class="dir-left-nowrap cross-bottom">
  48. <view v-if="isSales === 1" class="bd-sales" >销量{{sales}}{{unit}}</view>
  49. </view>
  50. <view class="dir-left-nowrap cross-bottom" style="display: flex;margin-top: 10px; align-items: center;">
  51. <view style="display: flex;flex: 1;align-items: center;">
  52. <image v-if="origin_icon!=null" class="bd-icon box-grow-0" :src="`${origin_icon}`" style="width: 20px;height: 14px;"></image>
  53. <view v-if="origin_name!=null" style="margin-left: 2px;margin-right: 30px;font-size: 14px;color: #666; width: 56px; overflow: hidden; white-space: normal;">{{origin_name}}</view>
  54. </view>
  55. <view style="display: flex;flex: 1;align-items: center;">
  56. <image v-if="brand_logo!=null" class="bd-icon box-grow-0" :src="`${brand_logo}`" style="width: 20px;height: 14px;"></image>
  57. <view v-if="brand_name!=null" style="margin-left: 2px;margin-right: 30px;font-size: 14px;color: #666;width: 70px; overflow: hidden; white-space: normal;">{{brand_name}}</view>
  58. </view>
  59. <view v-if="trade_name!=null" style="flex: 1;font-size: 14px;color: #666;">{{trade_name}}</view>
  60. </view>
  61. </template>
  62. </view>
  63. </template>
  64. <template v-else>
  65. <text :style="{'color': theme.color}" class="bd-negotiable">价格面议</text>
  66. </template>
  67. </view>
  68. <template v-if="isShowShare">
  69. <view class="box-grow-0 bd-share">
  70. <view @click="shareClick"
  71. :style="{'background-color': theme.background}"
  72. class="bd-share-box dir-left-nowrap main-center cross-center">
  73. <image class="bd-icon box-grow-0" src="/static/image/icon/icon-share-white.png"></image>
  74. <text class="bd-text box-grow-0">分享</text>
  75. </view>
  76. </view>
  77. </template>
  78. <template v-if="!isShowShare && $slots.share">
  79. <view class="bd-share">
  80. <slot name="share"></slot>
  81. </view>
  82. </template>
  83. <template v-if="isShowShare">
  84. <bd-quick-share
  85. v-model="quickShareShow"
  86. @quickShare="quickShare"
  87. :goods-id="goodsId"
  88. :is-video-number="goods.is_video_number"
  89. :extra-quick-share="extraQuickShare"
  90. :app-share-pic="appSharePic"
  91. :app-share-title="appShareTitle"
  92. ></bd-quick-share>
  93. <app-share-qr-code
  94. @share="testShare"
  95. v-model="shareShow"
  96. :url="newShareUrl"
  97. :goods="goods"
  98. :poster-config="posterConfig"
  99. :poster-generate="posterGenerate"
  100. :has-poster-nav="hasPosterNav"
  101. :app-share-pic="appSharePic"
  102. :app-share-title="appShareTitle"
  103. ></app-share-qr-code>
  104. </template>
  105. </view>
  106. <slot></slot>
  107. <bd-info-extra :theme="theme" :min-number="minNumber" :limit-buy="limitBuy" :goods="goods" :unit="unit"></bd-info-extra>
  108. <app-vip-card v-if="isVip" background="#fff" top="20rpx"></app-vip-card>
  109. <view class="bd-margin" v-if="flashSale">
  110. <bd-flash-sale :flash-sale="flashSale" :theme="theme"></bd-flash-sale>
  111. </view>
  112. <view class="bd-margin" v-if="levelShow === 2 && isNegotiable === 0">
  113. <bd-join-member
  114. :member-max-price="`${priceMemberMax}`"
  115. :member-min-price="`${priceMemberMin}`"
  116. :price="`${price}`"
  117. ></bd-join-member>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. import {mapState} from "vuex";
  123. import AppVipCard from '@/components/page-component/app-vip-card/app-vip-card';
  124. import bdFlashSale from '@/components/page-component/goods/bd-flash-sale.vue';
  125. import appPrice from '@/components/page-component/goods/app-price.vue';
  126. import bdJoinMember from '@/components/page-component/goods/bd-join-member.vue';
  127. import appMemberMark from '@/components/page-component/app-member-mark/app-member-mark.vue';
  128. import bdQuickShare from '@/components/page-component/goods/bd-quick-share.vue';
  129. import appShareQrCode from '@/components/page-component/app-share-qr-code-poster/app-share-qr-code-poster.vue';
  130. import bdInfoExtra from '@/components/page-component/goods/bd-info-extra.vue';
  131. export default {
  132. name: "u-info",
  133. props: {
  134. name: String,
  135. subtitle: String,
  136. isNegotiable: Number,
  137. theme: Object,
  138. flashSale: Object,
  139. levelShow: Number,
  140. price: {
  141. type: [Number, String]
  142. },
  143. originalPrice: {
  144. type: [Number, String]
  145. },
  146. priceMax: Number,
  147. priceMin: Number,
  148. priceMemberMax: Number,
  149. priceMemberMin: Number,
  150. isShowMember: {
  151. type: Boolean,
  152. default() {
  153. return true;
  154. }
  155. },
  156. discount: {
  157. type: [Number, String]
  158. },
  159. isVipCardUser: {
  160. type: Number,
  161. default() {
  162. return 0;
  163. }
  164. },
  165. sales: {
  166. type: [Number, String]
  167. },
  168. unit: String,
  169. isSales: Number,
  170. goodsId: Number,
  171. goods: Object,
  172. isVip: Boolean,
  173. isShowShare: {
  174. type: Boolean,
  175. default() {
  176. return true;
  177. }
  178. },
  179. posterConfig: String,
  180. posterGenerate: String,
  181. hasPosterNav: {
  182. type: Boolean,
  183. default() {
  184. return false
  185. },
  186. },
  187. shareUrl: String,
  188. appShareTitle: String,
  189. appSharePic: String,
  190. extraQuickShare: Object,
  191. minNumber: Number,
  192. limitBuy: Object,
  193. hasUnderlinePrice: {
  194. type: [Boolean, String],
  195. default:true
  196. },
  197. origin_icon: String,
  198. origin_name: String,
  199. goods_type: Number,
  200. trade_name: String,
  201. brand_logo: String,
  202. brand_name: String,
  203. },
  204. data() {
  205. return {
  206. shareShow: false,
  207. quickShareShow: false
  208. }
  209. },
  210. components: {
  211. AppVipCard,
  212. bdFlashSale,
  213. appPrice,
  214. appMemberMark,
  215. bdJoinMember,
  216. bdQuickShare,
  217. appShareQrCode,
  218. bdInfoExtra
  219. },
  220. computed: {
  221. isUnderlinePrice() {
  222. return Number(this.is_underline_price) && this.hasUnderlinePrice
  223. },
  224. ...mapState({
  225. is_underline_price: state => state.mallConfig.mall.setting.is_underline_price
  226. }),
  227. newShareUrl() {
  228. if (this.shareUrl) {
  229. return this.shareUrl;
  230. } else {
  231. if (this.goodsId) {
  232. return this.$api.poster.goods + '&goods_id=' + this.goodsId;
  233. } else {
  234. return ``;
  235. }
  236. }
  237. }
  238. },
  239. methods: {
  240. testShare(s){
  241. this.$emit('share', s);
  242. },
  243. quickShare(e) {
  244. this.$emit('quickShare', e);
  245. },
  246. shareClick() {
  247. // 判断登入
  248. if (!this.$user.isLogin()) {
  249. this.$user.getInfo().then(() => {
  250. });
  251. } else {
  252. if (this.extraQuickShare) {
  253. this.quickShareShow = true;
  254. } else {
  255. this.shareShow = true;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss" scoped>
  263. .bd-info {
  264. width: 702upx;
  265. background-color: #ffffff;
  266. border-radius: 15upx;
  267. padding: 20upx;
  268. margin: 24upx 24upx 24upx 24upx;
  269. }
  270. .bd-name {
  271. font-size: 32upx;
  272. color: #353535;
  273. line-height: 42upx;
  274. margin-top: 5upx;
  275. }
  276. .bd-subtitle {
  277. margin-top: 23upx;
  278. font-size: 24upx;
  279. line-height: 34upx;
  280. color: #999999;
  281. }
  282. .bd-price-share {
  283. margin-top: 20upx;
  284. }
  285. .bd-negotiable {
  286. font-size: 48upx;
  287. line-height: 53upx;
  288. }
  289. .bd-margin {
  290. margin-top: 20upx;
  291. }
  292. .bd-member-mark {
  293. margin-left: 12upx;
  294. }
  295. .bd-price {
  296. font-size: 56upx;
  297. line-height: 1;
  298. font-family: DIN;
  299. }
  300. .bd-sales {
  301. color: #999999;
  302. font-size: 24upx;
  303. margin-top: 22upx;
  304. }
  305. .bd-member-price {
  306. font-size: 32upx;
  307. margin-right: 20upx;
  308. line-height: 1;
  309. }
  310. .bd-origin-price {
  311. text-decoration: line-through;
  312. margin-left: 20upx;
  313. color: #999999;
  314. font-size: 28upx;
  315. }
  316. .bd-share {
  317. margin-top: 15upx;
  318. margin-right: -20upx;
  319. }
  320. .bd-share .bd-share-box {
  321. height: 48upx;
  322. border-radius: 40upx 0 0 40upx;
  323. padding: 0 14upx;
  324. width: 103upx;
  325. }
  326. .bd-share .bd-icon {
  327. width: 22upx;
  328. height: 22upx;
  329. }
  330. .bd-share .bd-text {
  331. color: #ffffff;
  332. font-size: 22upx;
  333. line-height: 30upx;
  334. margin-left: 10upx;
  335. }
  336. </style>