detail-price-share.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view class="detail-price-share" :style="{paddingBottom: level_show !== 2 ? '20rpx' : 0}">
  3. <view class="top dir-left-nowrap main-between">
  4. <view class="price">
  5. <view class="member-price" v-if="level_show == 1">
  6. <view class="member dir-left-nowrap cross-bottom">
  7. <text class="m-p" v-if="member_price_status === 0" :style="{'color': theme.color}">
  8. <text class="symbol">¥</text>
  9. {{group_min_member_price}}
  10. </text>
  11. <text class="m-p" v-if="member_price_status === 1" :style="{'color': theme.color}">
  12. <text class="symbol">¥</text>
  13. {{group_min_member_price}}-
  14. <text class="symbol"></text>
  15. {{group_max_member_price}}
  16. </text>
  17. <text class="logo" :style="{'background-color': theme.background_o,'color': theme.color}"
  18. style="margin-bottom: 8upx;">会员价
  19. </text>
  20. <app-sup-vip :is_vip_card_user="is_vip_card_user" margin="0 0 8rpx 10rpx" v-if="discount"
  21. :discount="discount"></app-sup-vip>
  22. </view>
  23. <view class="yushou">
  24. <text class="p" :style="{'color': theme.color}" v-if="status === 0">
  25. <text class="symbol">¥</text>
  26. {{price_min}}
  27. </text>
  28. <text class="p" :style="{'color': theme.color}" v-if="status === 1">
  29. <text class="symbol">¥</text>
  30. {{price_min}}-
  31. <text class="symbol"></text>
  32. {{price_max}}
  33. </text>
  34. <text class="p-t" :style="{'color': theme.color}">预售价</text>
  35. <text class="ori" v-if="isUnderlinePrice == 1">
  36. ¥{{original_price}}
  37. </text>
  38. </view>
  39. </view>
  40. <view v-if="level_show == 2 || level_show == 0" class="dir-left-nowrap cross-bottom">
  41. <text class="presale" :style="{'color': theme.color}" v-if="status === 0">
  42. <text class="symbol">¥</text>
  43. {{price_min}}
  44. </text>
  45. <text class="presale" :style="{'color': theme.color}" v-if="status === 1">
  46. <text class="symbol">¥</text>
  47. {{price_min}}-
  48. <text class="symbol"></text>
  49. {{price_max}}
  50. </text>
  51. <text style="margin-bottom: 8upx;" :style="{'color': theme.color}" class="title">预售价</text>
  52. <app-sup-vip :is_vip_card_user="is_vip_card_user" margin="0 0 8rpx 10rpx" v-if="discount"
  53. :discount="discount"></app-sup-vip>
  54. </view>
  55. <view class="original-price" v-if="(level_show == 2 || level_show === 0) && isUnderlinePrice == 1">
  56. ¥{{original_price}}
  57. </view>
  58. </view>
  59. <view class="share dir-top-nowrap main-between">
  60. <view @click="share_show" :style="{'background-color': theme.background}" class="bd-share-box dir-left-nowrap main-center cross-center">
  61. <image class="bd-icon box-grow-0" src="/static/image/icon/icon-share-white.png"></image>
  62. <text class="bd-text box-grow-0">分享</text>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="bottom">
  67. <view>
  68. <text class="des" :style="{'color': theme.color}" v-if="de_status === 0 && swell_status === 0">
  69. 定金¥{{de_price}}抵¥{{swell_price}}
  70. </text>
  71. <text class="des" :style="{'color': theme.color}" v-if="de_status === 1 && swell_status === 0">
  72. 定金¥{{de_price_min}}-{{de_price_max}}抵¥{{swell_price}}
  73. </text>
  74. <text class="des" :style="{'color': theme.color}" v-if="de_status === 1 && swell_status === 1">
  75. 定金¥{{de_price_min}}-{{de_price_max}}抵¥{{swell_price_min}}-{{swell_price_max}}
  76. </text>
  77. <text class="des" :style="{'color': theme.color}" v-if="de_status === 0 && swell_status === 1">
  78. 定金¥{{de_price}}抵¥{{swell_price_min}}-{{swell_price_max}}
  79. </text>
  80. </view>
  81. <view class="time">
  82. 尾款支付时间:{{set_time}}
  83. </view>
  84. </view>
  85. <view>
  86. <app-share-qr-code v-model="shareShow"
  87. :url="url"
  88. :has-poster-nav="hasPosterNav"
  89. :poster-config="posterConfig"
  90. :poster-generate="posterGenerate"
  91. :goods="goods"
  92. @share="shareAppMessage"
  93. ></app-share-qr-code>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. import appShareQrCode from '../../../components/page-component/app-share-qr-code-poster/app-share-qr-code-poster.vue';
  99. import {mapGetters, mapState} from 'vuex';
  100. export default {
  101. name: "detail-price-share",
  102. data() {
  103. return {
  104. price: 0,
  105. status: 0,
  106. de_price: 0,
  107. de_status: 0,
  108. swell_price: 0,
  109. swell_status: 0,
  110. de_price_min: 0,
  111. de_price_max: 0,
  112. swell_price_min: 0,
  113. swell_price_max: 0,
  114. shareShow: false,
  115. member_price_min: 0,
  116. member_price_max: 0,
  117. member_price_status: 0,
  118. start_end: '',
  119. }
  120. },
  121. props: {
  122. price_min: Number,
  123. price_max: Number,
  124. attr: Array,
  125. original_price: String,
  126. url: String,
  127. level_show: Number,
  128. group_min_member_price: Number,
  129. group_max_member_price: Number,
  130. end_prepayment_at: String,
  131. pay_limit: Number,
  132. cats: Array,
  133. goodsId: Number,
  134. discount: {
  135. type: String
  136. },
  137. is_vip_card_user: {
  138. type: Number,
  139. default() {
  140. return 0;
  141. }
  142. },
  143. theme: Object,
  144. posterConfig: String,
  145. posterGenerate: String,
  146. hasPosterNav: {
  147. type: Boolean,
  148. default() {
  149. return false
  150. },
  151. },
  152. goods:Object
  153. },
  154. mounted() {
  155. if (this.price_min === this.price_max) {
  156. this.status = 0;
  157. } else {
  158. this.status = 1;
  159. }
  160. let deposit = [];
  161. let swell_deposit = [];
  162. for (let i = 0; i < this.attr.length; i++) {
  163. deposit.push(this.attr[i].deposit);
  164. swell_deposit.push(this.attr[i].swell_deposit);
  165. }
  166. let max = Math.max.apply(null, deposit);
  167. let min = Math.min.apply(null, deposit);
  168. let swell_max = Math.max.apply(null, swell_deposit);
  169. let swell_min = Math.min.apply(null, swell_deposit);
  170. if (max === min) {
  171. this.de_price = min;
  172. this.de_status = 0;
  173. } else {
  174. this.de_status = 1;
  175. this.de_price_min = min;
  176. this.de_price_max = max;
  177. }
  178. if (swell_min === swell_max) {
  179. this.swell_price = swell_min;
  180. this.swell_status = 0;
  181. } else {
  182. this.swell_status = 1;
  183. this.swell_price_min = swell_min;
  184. this.swell_price_max = swell_max;
  185. }
  186. if (this.group_min_member_price === this.group_max_member_price) {
  187. this.member_price_status = 0;
  188. } else {
  189. this.member_price_status = 1;
  190. }
  191. },
  192. computed: {
  193. set_time() {
  194. if (this.pay_limit === -1) {
  195. return `${this.getDate(this.end_prepayment_at)} ~ 无期限`
  196. } else {
  197. this.addDate(this.end_prepayment_at, this.pay_limit);
  198. return `${this.getDate(this.end_prepayment_at)} ~ ${this.addDate(this.end_prepayment_at, this.pay_limit)}`
  199. }
  200. },
  201. ...mapGetters('mallConfig', {
  202. vip: 'getVip'
  203. }),
  204. ...mapState({
  205. mall: state => state.mallConfig.mall,
  206. isUnderlinePrice: state => state.mallConfig.mall.setting.is_underline_price,
  207. })
  208. },
  209. methods: {
  210. shareAppMessage(s){
  211. this.$emit('share', s);
  212. },
  213. addDate(date, days) {
  214. if (days == undefined || days == '') {
  215. days = 1;
  216. }
  217. var date = new Date(date.replace(/-/g, '/'));
  218. date.setDate(date.getDate() + days);
  219. let month = date.getMonth() + 1;
  220. let day = date.getDate();
  221. let mm = "'" + month + "'";
  222. let dd = "'" + day + "'";
  223. if (mm.length == 3) {
  224. month = "0" + month;
  225. }
  226. if (dd.length == 3) {
  227. day = "0" + day;
  228. }
  229. let hour = date.getHours();//得到小时
  230. let minu = date.getMinutes();//得到分钟
  231. let sec = date.getSeconds();//得到秒
  232. if (sec === 0) {
  233. sec = 59;
  234. if (minu === 0) {
  235. minu = 59;
  236. if (hour === 0) {
  237. hour = 23;
  238. day = '0' + Number(day) - 1;
  239. } else {
  240. hour = hour - 1;
  241. }
  242. } else {
  243. minu = minu - 1;
  244. }
  245. } else {
  246. sec = sec - 1;
  247. }
  248. sec = `${sec}`;
  249. minu = `${minu}`;
  250. hour = `${hour}`;
  251. if (hour.length === 1) {
  252. hour = `0${hour}`
  253. }
  254. if (minu.length === 1) {
  255. minu = `0${minu}`
  256. }
  257. if (sec.length === 1) {
  258. sec = `0${sec}`
  259. }
  260. let time = date.getFullYear() + "." + month + "." + day + ' ' + hour + ':' + minu + ':' + sec;
  261. return time;
  262. },
  263. getDate(end_prepayment_at) {
  264. let newDate = new Date(end_prepayment_at.replace(/-/g, '/'));
  265. newDate.setDate(newDate.getDate());
  266. let month = newDate.getMonth() + 1;
  267. let day = newDate.getDate();
  268. let mm = "'" + month + "'";
  269. let dd = "'" + day + "'";
  270. let hour = newDate.getHours();//得到小时
  271. let minu = newDate.getMinutes();//得到分钟
  272. let sec = newDate.getSeconds();//得到秒
  273. sec = `${sec}`;
  274. minu = `${minu}`;
  275. hour = `${hour}`;
  276. if (mm.length == 3) {
  277. month = "0" + month;
  278. }
  279. if (dd.length == 3) {
  280. day = "0" + day;
  281. }
  282. if (hour.length === 1) {
  283. hour = `0${hour}`
  284. }
  285. if (minu.length === 1) {
  286. minu = `0${minu}`
  287. }
  288. if (sec.length === 1) {
  289. sec = `0${sec}`
  290. }
  291. let time = newDate.getFullYear() + "." + month + "." + day + ' ' + hour + ':' + minu + ':' + sec;
  292. return time;
  293. },
  294. share_show() {
  295. if (this.$user.isLogin()) {
  296. this.shareShow = true;
  297. } else {
  298. this.$user.getInfo();
  299. }
  300. },
  301. },
  302. components: {
  303. 'app-share-qr-code': appShareQrCode
  304. }
  305. }
  306. </script>
  307. <style scoped lang="scss">
  308. .detail-price-share {
  309. padding: #{18rpx 20rpx 20rpx 20rpx};
  310. background-color: #ffffff;
  311. width: 702upx;
  312. margin: 0 24upx;
  313. .presale {
  314. font-size: #{56rpx};
  315. margin-right: #{16rpx};
  316. font-family: DIN;
  317. text-align: end;
  318. .symbol {
  319. font-size: #{32rpx};
  320. }
  321. }
  322. .title {
  323. font-size: #{28rpx};
  324. }
  325. .des {
  326. font-size: #{26rpx};
  327. line-height: #{26rpx};
  328. }
  329. .original-price {
  330. font-size: #{24rpx};
  331. color: #999999;
  332. margin-top: #{8rpx};
  333. text-decoration: line-through;
  334. }
  335. .share {
  336. margin-top: #{23rpx};
  337. height: #{80rpx};
  338. margin-right: #{-23rpx};
  339. padding: #{5rpx};
  340. .bd-share-box {
  341. height: #{48rpx};
  342. border-radius: #{40rpx} 0 0 #{40rpx};
  343. padding: 0 #{14rpx};
  344. width: #{103rpx};
  345. > image {
  346. width: #{22rpx};
  347. height: #{22rpx};
  348. }
  349. > text {
  350. font-size: #{22rpx};
  351. color: #ffffff;
  352. margin-left: #{10rpx};
  353. }
  354. }
  355. }
  356. }
  357. .member-price {
  358. .symbol {
  359. font-size: #{23rpx};
  360. }
  361. .member {
  362. color: #f39800;
  363. font-family: DIN;
  364. .m-p {
  365. font-family: DIN;
  366. font-size: #{40rpx};
  367. }
  368. .logo {
  369. display: inline-block;
  370. font-size: #{20rpx};
  371. border: #{1rpx} solid;
  372. padding: #{2rpx 4rpx};
  373. margin-left: #{12rpx};
  374. border-radius: #{8rpx};
  375. margin-bottom: #{5rpx};
  376. }
  377. }
  378. .yushou {
  379. .p {
  380. font-size: #{26rpx};
  381. font-family: DIN;
  382. }
  383. .p-t {
  384. font-size: #{26rpx};
  385. margin-left: #{8rpx};
  386. }
  387. }
  388. .ori {
  389. text-decoration: line-through;
  390. color: #999999;
  391. font-size: #{24rpx};
  392. margin-left: #{16rpx};
  393. }
  394. }
  395. .time {
  396. font-size: #{22rpx};
  397. color: #999999;
  398. }
  399. </style>