productMh.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <template>
  2. <view class="container padding-b-30">
  3. <view class="swiper-box">
  4. <view class="img">
  5. <image :src="shopDetail.pic" mode="widthFix"></image>
  6. </view>
  7. </view>
  8. <view class="content-box">
  9. <view class="content-top">
  10. <view class="hd">{{ shopDetail.name }}</view>
  11. <!-- <view class="content-img">
  12. <image src="../../static/img/fx.png" mode=""></image>分享
  13. </view> -->
  14. </view>
  15. <view class="content-center">
  16. <view class="title">发行方:艺绘官方 </view>
  17. </view>
  18. <view class="content-bottom">
  19. <view class="price">
  20. {{ shopDetail.price }}
  21. <span>RMB</span>
  22. </view>
  23. <view class="gobuy" @click="buy()">立即购买</view>
  24. </view>
  25. </view>
  26. <view class="rz">
  27. <view class="rz-title">认证信息</view>
  28. <view class="rz-ms">
  29. <view class="tc-item flex">
  30. <view class="tcitem-name">创作者</view>
  31. <view class="ali-name clamp">艺绘官方</view>
  32. </view>
  33. <view class="tc-item flex margin-t-30">
  34. <view class="tcitem-name">发行方</view>
  35. <view class="ali-name clamp">艺绘官方</view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="rz">
  40. <view class="rz-title">购买需知</view>
  41. <view class="rz-ms">
  42. 1.著作权人同意,在交易完成后,您将获得该数字艺术品除人身权利外的其他著作权(包括复制权、发行权、出租权、展览权、表演权、放映权、广播权、信息网络传播权、摄制权、改编权、翻译权、汇编权等)。
  43. <br/>
  44. 2.数字藏品的版权由发行方或创作者所有,除另行去取得版权 所有者书面同意外, 用户不得将数字藏品用于任何商业用途。
  45. </view>
  46. </view>
  47. <view class="rz">
  48. <view class="rz-title">权益需知</view>
  49. <view class="rz-ms">
  50. 数字藏品为虚拟数字商品,而非实物,仅限实名认证为年满18周岁的中国大陆用户购买。本商品一经售出,不支持任何形式的退换货。本商品源文件不支持本地下载。请勿对数字藏品进行炒作、场外交易、欺诈,或以其他任何非法形式进行交易和使用。
  51. </view>
  52. </view>
  53. <uni-popup ref="popupkf" type="bottom">
  54. <view class="popup-box">
  55. <view class="pop-title flex borde-b">
  56. <view class="title ">
  57. 购买数量
  58. </view>
  59. <u--input :border='"surround"' class='margin-l-30' placeholder="请输入数量" type='number' clearable v-model="num" inputAlign='right'
  60. @input="changeNum"></u--input>
  61. </view>
  62. <view class="pop-radio">
  63. <radio-group name="">
  64. <!-- #ifdef APP-PLUS -->
  65. <label class="pop-radio-box" @click="type = 'ali'">
  66. <view class="pop-radio-cont">
  67. <image src="../../static/img/ali.png" style="width: 40rpx;height: 40rpx;"
  68. mode="scaleToFill"></image>
  69. <text>支付宝支付</text>
  70. </view>
  71. <radio :checked="type == 'ali'" style="transform: scale(0.8);" />
  72. </label>
  73. <!-- <label class="pop-radio-box" @click="type='weixin'">
  74. <view class="pop-radio-cont">
  75. <image src="../../static/img/weixin.png" style="width: 40rpx;height: 40rpx;"
  76. mode="scaleToFill">
  77. </image>
  78. <text>微信支付</text>
  79. </view>
  80. <radio :checked="type=='weixin'" style="transform: scale(0.8);" />
  81. </label> -->
  82. <!-- #endif -->
  83. <label class="pop-radio-box" @click="type = 'yue'">
  84. <view class="pop-radio-cont">
  85. <image src="../../static/img/yue.png" style="width: 40rpx;height: 40rpx;"
  86. mode="scaleToFill"></image>
  87. <text>余额支付:{{ now_money }}</text>
  88. </view>
  89. <radio :checked="type == 'yue'" style="transform: scale(0.8);" />
  90. </label>
  91. </radio-group>
  92. <view class="pop-bottom">
  93. <view class="pirce">
  94. <view class="price-left">合计:</view>
  95. <view class="price-right">
  96. <span>{{ shopDetail.price*num }}</span>
  97. </view>
  98. </view>
  99. <!-- "!payLoding ? pay() : ''" -->
  100. <view class="buy" @click="pay()" :class="{ clickbg: payLoding }">立即支付</view>
  101. </view>
  102. </view>
  103. </view>
  104. </uni-popup>
  105. </view>
  106. </template>
  107. <script>
  108. import {
  109. balance
  110. } from '@/api/wallet.js';
  111. import {
  112. mapState
  113. } from 'vuex';
  114. import uniCopy from '@/components/js_sdk/xb-copy/uni-copy.js';
  115. import {
  116. mysteryDetail,
  117. mysteryPay
  118. } from '@/api/product.js';
  119. export default {
  120. data() {
  121. return {
  122. num: 1, //默认购买数量
  123. now_money: 0, //余额
  124. payLoding: true, //判断是否支付中
  125. type: 'yue', //支付状态
  126. shopDetail: {
  127. }, //商品详情
  128. weixin: '',
  129. yue: '',
  130. shopId: '', //商品id
  131. list: [],
  132. };
  133. },
  134. onLoad(options) {
  135. this.shopId = options.id;
  136. // 加载详情
  137. this.goodsDetail();
  138. // 载入余额
  139. balance({}).then(({
  140. data
  141. }) => {
  142. // 获取余额
  143. this.now_money = data.now_money;
  144. });
  145. },
  146. computed: {
  147. ...mapState(['weichatObj', 'baseURL', 'urlFile']),
  148. ...mapState('user', ['userInfo', 'hasLogin'])
  149. },
  150. methods: {
  151. // 判断是否输入正确数量
  152. changeNum(s) {
  153. console.log(s);
  154. let num = Math.floor(s);
  155. if(s.indexOf('.')>-1){
  156. uni.showModal({
  157. title: '错误',
  158. content: '只可填入整数',
  159. showCancel: false,
  160. });
  161. }
  162. this.$nextTick(() => {
  163. this.num = +num
  164. })
  165. },
  166. //选择支付方式
  167. changePayType(type) {
  168. this.type = type;
  169. },
  170. //复制
  171. copy(value) {
  172. let obj = this;
  173. let content = value; //需要复制的内容
  174. console.log('复制的内容:', content);
  175. // content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  176. const result = uniCopy(content);
  177. if (result === false) {
  178. uni.showToast({
  179. title: '不支持'
  180. });
  181. } else {
  182. uni.showToast({
  183. title: '复制成功',
  184. icon: 'none'
  185. });
  186. }
  187. },
  188. // 支付
  189. buy() {
  190. this.$refs.popupkf.open();
  191. },
  192. //支付
  193. async pay() {
  194. let obj = this;
  195. if (obj.type == 'yue' && obj.now_money * 1 < obj.shopDetail.price * 1) {
  196. uni.showModal({
  197. title: '提示',
  198. content: '账户余额不足!',
  199. showCancel: false
  200. });
  201. return;
  202. }
  203. // uni.hideLoading()
  204. uni.showLoading({
  205. title: '支付中',
  206. mask: true
  207. });
  208. // 判断是否支付中
  209. if (!obj.payLoding) {
  210. return;
  211. }
  212. obj.payLoding = false;
  213. if (obj.type == 'weixin') {
  214. obj.$api.msg('微信暂未开通!');
  215. uni.hideLoading();
  216. obj.payLoding = true;
  217. return;
  218. }
  219. obj.marketPay();
  220. },
  221. // 市场支付
  222. marketPay() {
  223. const obj = this;
  224. mysteryPay({
  225. pay_type: obj.type,
  226. id: obj.shopId,
  227. num: obj.num
  228. })
  229. .then(res => {
  230. console.log(res, '购入');
  231. uni.hideLoading();
  232. if (obj.type == 'yue') {
  233. obj.paySuccessTo();
  234. }
  235. if (obj.type == 'ali') {
  236. const url = res.data.payConfig;
  237. console.log(url, 'url');
  238. uni.requestPayment({
  239. provider: 'alipay',
  240. orderInfo: url,
  241. success: res => {
  242. obj.paySuccessTo();
  243. },
  244. fail: e => {
  245. uni.showModal({
  246. title: '错误',
  247. content: '未成功支付',
  248. showCancel: false
  249. });
  250. console.log(e);
  251. },
  252. complete: () => {}
  253. });
  254. }
  255. })
  256. .catch(() => {
  257. obj.payLoding = true;
  258. });
  259. return;
  260. },
  261. // 获取商品详情
  262. goodsDetail() {
  263. let obj = this;
  264. mysteryDetail({
  265. id: obj.shopId
  266. }, ).then(res => {
  267. obj.shopDetail = res.data.info;
  268. console.log(res, 'xq');
  269. });
  270. },
  271. // 支付成功跳转
  272. paySuccessTo() {
  273. uni.hideLoading();
  274. uni.redirectTo({
  275. url: '/pages/money/paySuccess?orderKey=' + this.orderKey
  276. });
  277. }
  278. }
  279. };
  280. </script>
  281. <style lang="scss">
  282. .container,
  283. page {
  284. background: #111111;
  285. min-height: 100%;
  286. }
  287. /deep/ .rich-img {
  288. width: 100% !important;
  289. height: auto;
  290. }
  291. /* #ifdef MP */
  292. .rich-img {
  293. width: 100% !important;
  294. height: auto;
  295. }
  296. // 处理图片间白色间距问题
  297. .pHeight {
  298. line-height: 0;
  299. }
  300. /* #endif */
  301. .swiper-box {
  302. background: #0c0a36;
  303. }
  304. .img {
  305. margin: 0 auto;
  306. width: 750rpx;
  307. image {
  308. width: 100%;
  309. }
  310. }
  311. .content-box {
  312. border-bottom: 2rpx solid #919295;
  313. padding: 30rpx;
  314. display: flex;
  315. flex-direction: column;
  316. .content-top {
  317. display: flex;
  318. justify-content: space-between;
  319. align-items: center;
  320. .hd {
  321. font-size: 38rpx;
  322. font-family: PingFang SC;
  323. font-weight: bold;
  324. color: #ffffff;
  325. line-height: 42rpx;
  326. }
  327. .content-img {
  328. display: flex;
  329. align-items: center;
  330. justify-content: space-around;
  331. font-size: 24rpx;
  332. font-family: PingFang SC;
  333. font-weight: 500;
  334. color: #585be7;
  335. line-height: 39rpx;
  336. padding: 10rpx;
  337. height: 41rpx;
  338. border: 2rpx solid #585be7;
  339. border-radius: 5rpx;
  340. image {
  341. width: 26rpx;
  342. height: 26rpx;
  343. }
  344. }
  345. }
  346. .content-center {
  347. margin: 20rpx 0;
  348. display: flex;
  349. flex-direction: column;
  350. .title {
  351. font-size: 24rpx;
  352. font-weight: 500;
  353. color: #ffffff;
  354. line-height: 42rpx;
  355. }
  356. }
  357. .content-bottom {
  358. display: flex;
  359. align-items: center;
  360. justify-content: space-between;
  361. .price {
  362. display: flex;
  363. justify-content: flex-end;
  364. font-size: 48rpx;
  365. font-weight: bold;
  366. color: #585be7;
  367. span {
  368. font-size: 24rpx;
  369. font-weight: bold;
  370. color: #666666;
  371. font-family: SourceHanSerifSC;
  372. line-height: 66rpx;
  373. }
  374. }
  375. .gobuy {
  376. width: 334rpx;
  377. height: 90rpx;
  378. background: linear-gradient(270deg, #6e8df7, #9977f6);
  379. border-radius: 10rpx;
  380. font-size: 36rpx;
  381. font-weight: 500;
  382. color: #ffffff;
  383. line-height: 90rpx;
  384. text-align: center;
  385. }
  386. }
  387. }
  388. .rz {
  389. display: flex;
  390. flex-direction: column;
  391. align-items: center;
  392. .rz-title {
  393. margin: 35rpx 0;
  394. font-size: 36rpx;
  395. font-family: PingFang SC;
  396. font-weight: bold;
  397. color: #ffffff;
  398. line-height: 42rpx;
  399. }
  400. .rich {
  401. display: block;
  402. justify-content: center;
  403. margin: 30rpx;
  404. width: 750rpx;
  405. overflow: hidden;
  406. }
  407. .rz-ms {
  408. padding: 30rpx;
  409. width: 690rpx;
  410. font-size: 24rpx;
  411. line-height: 36rpx;
  412. color: #ffffff;
  413. word-wrap: break-word;
  414. word-break: normal;
  415. background-color: rgb(29, 28, 33);
  416. border-radius: 20rpx;
  417. }
  418. .rz-content {
  419. padding: 20rpx;
  420. display: flex;
  421. flex-direction: column;
  422. width: 690rpx;
  423. background: #222222;
  424. border-radius: 20rpx;
  425. .con-box {
  426. line-height: 60rpx;
  427. display: flex;
  428. justify-content: space-between;
  429. align-items: center;
  430. .left {
  431. font-size: 24rpx;
  432. color: #a5a5a5;
  433. }
  434. .right {
  435. display: flex;
  436. align-items: center;
  437. .address {
  438. color: #6363fe;
  439. font-size: 24rpx;
  440. width: 300rpx;
  441. text-align: right;
  442. overflow: hidden;
  443. text-overflow: ellipsis;
  444. white-space: nowrap;
  445. }
  446. .copy {
  447. margin-left: 15rpx;
  448. margin-bottom: 22rpx;
  449. width: 30rpx;
  450. height: 30rpx;
  451. image {
  452. width: 30rpx;
  453. height: 30rpx;
  454. }
  455. }
  456. }
  457. }
  458. }
  459. .tc-item {
  460. width: 100%;
  461. line-height: 1;
  462. .tcitem-name {
  463. flex-shrink: 0;
  464. font-size: 30rpx;
  465. font-family: PingFang SC;
  466. font-weight: 500;
  467. color: #fff;
  468. }
  469. .ali-name {
  470. font-size: 30rpx;
  471. font-family: PingFang SC;
  472. font-weight: 500;
  473. color: #FDD58A;
  474. }
  475. .tcitem-image {
  476. flex-shrink: 0;
  477. width: 26rpx;
  478. height: 28rpx;
  479. }
  480. }
  481. }
  482. .popup-box {
  483. width: 750rpx;
  484. background: #ffffff;
  485. border-radius: 10rpx 10rpx 0px 0px;
  486. padding-bottom: 130rpx;
  487. .pop-title {
  488. line-height: 1;
  489. padding: 30rpx;
  490. padding-bottom: 10rpx;
  491. font-size: 34rpx;
  492. font-weight: bold;
  493. color: #333333;
  494. }
  495. .pop-radio {
  496. display: flex;
  497. .pop-radio-box {
  498. height: 100rpx;
  499. display: flex;
  500. align-items: center;
  501. padding: 25rpx;
  502. justify-content: space-between;
  503. width: 750rpx;
  504. .pop-radio-cont {
  505. display: flex;
  506. img {
  507. width: 40rpx;
  508. height: 40rpx;
  509. }
  510. text {
  511. margin-left: 10rpx;
  512. font-size: 28rpx;
  513. font-weight: 400;
  514. color: #3f454b;
  515. }
  516. }
  517. }
  518. .pop-bottom {
  519. position: fixed;
  520. bottom: 0;
  521. right: 0;
  522. height: 93rpx;
  523. width: 750rpx;
  524. display: flex;
  525. justify-content: space-between;
  526. .pirce {
  527. display: flex;
  528. align-items: center;
  529. margin-left: 25rpx;
  530. .price-left {
  531. font-size: 28rpx;
  532. font-family: PingFang SC;
  533. font-weight: 400;
  534. color: #3f454b;
  535. line-height: 100px;
  536. }
  537. display: flex;
  538. .price-right {
  539. font-size: 24rpx;
  540. font-weight: 500;
  541. color: #fd3b39;
  542. line-height: 55px;
  543. span {
  544. font-size: 36rpx;
  545. font-weight: 500;
  546. color: #fd3b39;
  547. line-height: 55px;
  548. }
  549. }
  550. }
  551. .buy {
  552. width: 360rpx;
  553. height: 93rpx;
  554. background: linear-gradient(270deg, #6e8df7, #9977f6);
  555. font-size: 32rpx;
  556. font-weight: bold;
  557. line-height: 93rpx;
  558. text-align: center;
  559. color: #ffffff;
  560. }
  561. }
  562. }
  563. }
  564. .clickbg {
  565. background-color: $color-gray !important;
  566. }
  567. </style>