detail-price-share.vue 14 KB

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