兼兼街公众号代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

503 lines
14 KiB

  1. <template>
  2. <view>
  3. <view class="active-card">
  4. <view>
  5. <view class="active-title">{{dataInfo.title}}</view>
  6. <view class="active-time">
  7. <text>{{dataInfo.longTitle}} </text>
  8. </view>
  9. <view class="active-add2">
  10. <text>库存{{dataInfo.num}} </text>
  11. </view>
  12. <view class="active-add">
  13. <text>销量{{dataInfo.payNum}} </text>
  14. </view>
  15. </view>
  16. <view>
  17. <view class="hide-context" >可用{{dataInfo.intgerPrice}}积分进行兑换该商品</view>
  18. <!-- <view style="padding: 25rpx 0;" v-if="erop == true">
  19. <view class="active-title">联系方式</view>
  20. <view class="active-time">
  21. <view class="menu-price">
  22. <text class="tips">{{dataInfo.phone}}</text>
  23. </view>
  24. </view>
  25. </view> -->
  26. </view>
  27. </view>
  28. <view class="contnet">
  29. <u-parse :content="dataInfo.details"></u-parse>
  30. </view>
  31. <view v-if="!showp" class="btn-box">
  32. <u-button v-if="fromPage && fromPage == 'tuijian'" text="我要推荐" @click="share" :customStyle="baomingStyle"
  33. :hairline="false" color="#00BBFF"></u-button>
  34. <view style="display: flex; background-color: #FFFFFF;">
  35. <view
  36. style="width: 266rpx; height: 72rpx; border: 1rpx solid #00BBFF; color: #00BBFF; line-height: 72rpx;text-align: center;margin: 20rpx 60rpx;"
  37. @click="getCreteClick">立即购买({{dataInfo.price}})</view>
  38. <view
  39. style="width: 266rpx; height: 72rpx; border: 1rpx solid #00BBFF; background-color: #00BBFF; color: #FFFFFF; line-height: 72rpx;text-align: center;margin: 20rpx 60rpx; margin-left: auto;"
  40. @click="getCreteClickJf">积分兑换({{dataInfo.intgerPrice}})</view>
  41. </view>
  42. </view>
  43. <view class="share-box" v-show="shareShow" @click="shareShow=false">
  44. <view class="jiantou">
  45. <image src="@/static/img/jiantou-icon.png" mode=""></image>
  46. </view>
  47. <view class="title">
  48. <image src="@/static/img/title-icon.png" mode=""></image>
  49. </view>
  50. </view>
  51. <!-- <view v-if="showp">
  52. <view
  53. style="position: fixed;left: 0; top: 0;width: 100vw;height: 100vh;background-color: rgba(0, 0, 0, 0.2);">
  54. <view
  55. style="margin: 200rpx auto;width: 600rpx;height: 818rpx;background-color: #FFFFFF;padding: 0 32rpx;position: relative;">
  56. <view style="font-size: 28rpx;
  57. font-family: Microsoft YaHei, Microsoft YaHei-Bold;
  58. font-weight: 700;
  59. text-align: left;
  60. color: #191919;
  61. line-height: 120rpx;
  62. border-bottom: 1rpx solid #e7e7e7;
  63. position: relative;">
  64. <text>{{dataInfo.title}}</text>
  65. <view style="position: absolute; right: 20rpx; top: 0">
  66. </view>
  67. </view>
  68. <view style="font-size: 24rpx;line-height: 60rpx;margin-top: 30rpx;">
  69. <view class="active-time">
  70. <text>发车时间{{dataInfo.outGoTime}}</text>
  71. </view>
  72. <view class="active-add">
  73. <text>始发终点: {{dataInfo.outGo}} - {{dataInfo.toGo}}</text>
  74. </view>
  75. <view class="active-add">
  76. <text>
  77. 剩余位置{{dataInfo.sum}}
  78. </text>
  79. </view>
  80. </view>
  81. <view style="position: absolute; bottom: 50rpx;display: flex;">
  82. <image style="width: 60rpx; height: 60rpx; border-radius: 50%;" src="../../static/qrcode.jpg">
  83. </iimage>
  84. <view style="padding: 18rpx;font-size: 28rpx;">兼兼街</view>
  85. </view>
  86. <view style="position: absolute; bottom: 50rpx; right: 32rpx;">
  87. <canvas canvas-id="qrcode" style="width: 140rpx; height: 140rpx;" />
  88. <view style="padding: 18rpx;font-size: 24rpx;text-align: center;">国联智聘</view>
  89. </view>
  90. </view>
  91. <view style="position: absolute; bottom: 0; left: 0;">
  92. <view style="display: flex; background-color: #CCCCCC;">
  93. <view
  94. style="width: 266rpx; height: 72rpx; border: 1rpx solid #00BBFF; color: #00BBFF; line-height: 72rpx;text-align: center;margin: 20rpx 60rpx;"
  95. @click="showp=false">取消</view>
  96. <view
  97. style="width: 266rpx; height: 72rpx; border: 1rpx solid #00BBFF; background-color: #00BBFF; color: #FFFFFF; line-height: 72rpx;text-align: center;margin: 20rpx 60rpx; margin-left: auto;"
  98. @click="">保存海报</view>
  99. </view>
  100. </view>
  101. </view>
  102. </view> -->
  103. </view>
  104. </template>
  105. <script>
  106. import uQRCode from '@/common/uqrcode.js'
  107. export default {
  108. data() {
  109. return {
  110. shareShow: false,
  111. fromPage: null,
  112. dataInfo: {},
  113. showp: false,
  114. userInfo: {},
  115. id: '',
  116. erop: false,
  117. src: '',//require('@/static/img/course-img.png'),
  118. baomingStyle: {
  119. fontSize: "30rpx",
  120. fontWeight: "700",
  121. height: "100rpx"
  122. }
  123. }
  124. },
  125. onLoad(e) {
  126. if (e.fromPage) this.fromPage = e.fromPage;
  127. this.id = e.id;
  128. this.getactivityFindById(e.id);
  129. },
  130. onReady() {
  131. this.$com.displayNav()
  132. },
  133. methods: {
  134. getmyInfo() {
  135. this.$api('myInfo')
  136. .then(res => {
  137. if (res.code == 200) {
  138. this.role = res.result.role;
  139. this.userInfo = res.result;
  140. this.$store.commit('set_userInfo', res.result)
  141. this.qrFun('https://xinxiong.java996.icu/pages/my/login-kehu?vid=' + this.userInfo.id +
  142. "&did=" + this.id)
  143. } else {
  144. this.userInfo = null
  145. }
  146. })
  147. },
  148. getCreteClick() {
  149. let that = this;
  150. this.$api('createShopOrder', {
  151. id: this.dataInfo.id
  152. })
  153. .then(res => {
  154. // if (res.code == 200) {
  155. // that.erop = true;
  156. // }
  157. if (res.code == 200) {
  158. that.$api('create', {
  159. id: res.result.id
  160. })
  161. .then(res => {
  162. console.log(res)
  163. that.$jweixin.config({
  164. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  165. appId: 'wx6fb4a17b28186d58', // 必填,公众号的唯一标识
  166. timestamp: res.result.timestamp, // 必填,生成签名的时间戳
  167. nonceStr: res.result.noncestr, // 必填,生成签名的随机串
  168. signature: res.result.sgture, // 必填,签名
  169. jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
  170. 'onMenuShareTimeline', 'onMenuShareAppMessage',
  171. 'chooseWXPay'
  172. ]
  173. });
  174. that.$jweixin.chooseWXPay({
  175. appId: 'wx6fb4a17b28186d58',
  176. timestamp: res.result
  177. .timeStamp, // 支付签名时间戳,注意微信 jssdk 中的所有使用 timestamp 字段均为小写。但最新版的支付后台生成签名使用的 timeStamp 字段名需大写其中的 S 字符
  178. nonceStr: res.result.nonceStr, // 支付签名随机串,不长于 32 位
  179. package: res.result
  180. .packageValue, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
  181. signType: res.result
  182. .signType, // 微信支付V3的传入 RSA ,微信支付V2的传入格式与V2统一下单的签名格式保持一致
  183. paySign: res.result.paySign, // 支付签名
  184. success: function(res) {
  185. that.erop = true;
  186. }
  187. });
  188. })
  189. }
  190. })
  191. },
  192. getCreteClickJf(){
  193. this.$api('createIntegerOrder', {
  194. id: this.dataInfo.id
  195. })
  196. .then(res => {
  197. this.$Toast('购买成功')
  198. setTimeout(() => {
  199. uni.navigateTo({
  200. url: '/pages/my/my-order-list'
  201. })
  202. }, 1000)
  203. })
  204. },
  205. qrFun(text) {
  206. this.qrShow = true
  207. uQRCode.make({
  208. canvasId: 'qrcode',
  209. componentInstance: this,
  210. text: text,
  211. size: 65,
  212. margin: 0,
  213. backgroundColor: '#FFFFFF',
  214. foregroundColor: '#000000',
  215. fileType: 'png',
  216. errorCorrectLevel: uQRCode.errorCorrectLevel.H,
  217. success: res => {
  218. console.log("ercode", text)
  219. }
  220. })
  221. },
  222. apply() {
  223. if (!this.$store.state.userToken) {
  224. this.$Toast('请先登录!')
  225. setTimeout(() => {
  226. uni.navigateTo({
  227. url: '/pages/my/login-kehu'
  228. })
  229. }, 1000)
  230. return
  231. }
  232. this.share(1)
  233. uni.navigateTo({
  234. url: `/pages/home/buy-course?id=${this.id}`
  235. })
  236. },
  237. wechatMoments() {
  238. this.$api('creteFenxian', {
  239. url: location.href.split('#')[0]
  240. })
  241. .then(res => {
  242. if (res.code == 200) {
  243. this.$jweixin.config({
  244. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  245. appId: 'wxdabccf5a0110cfab', // 必填,公众号的唯一标识
  246. timestamp: res.result.timestamp, // 必填,生成签名的时间戳
  247. nonceStr: res.result.noncestr, // 必填,生成签名的随机串
  248. signature: res.result.sgture, // 必填,签名
  249. jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
  250. 'onMenuShareTimeline', 'onMenuShareAppMessage', 'chooseWXPay'
  251. ]
  252. });
  253. this.$jweixin.ready(ress => {
  254. this.$jweixin.updateTimelineShareData({
  255. title: this.dataInfo.title,
  256. link: `https://xinxiong.java996.icu/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  257. })
  258. });
  259. }
  260. })
  261. },
  262. share(type) { //1为支付
  263. if (!type) {
  264. this.shareShow = true;
  265. }
  266. this.$api('creteFenxian', {
  267. url: location.href.split('#')[0]
  268. })
  269. .then(res => {
  270. if (res.code == 200) {
  271. this.$jweixin.config({
  272. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  273. appId: 'wxdabccf5a0110cfab', // 必填,公众号的唯一标识
  274. timestamp: res.result.timestamp, // 必填,生成签名的时间戳
  275. nonceStr: res.result.noncestr, // 必填,生成签名的随机串
  276. signature: res.result.sgture, // 必填,签名
  277. jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
  278. 'onMenuShareTimeline', 'onMenuShareAppMessage', 'chooseWXPay'
  279. ]
  280. });
  281. this.$jweixin.ready(ress => {
  282. this.$jweixin.onMenuShareTimeline({
  283. title: this.dataInfo.title,
  284. desc: this.dataInfo.title, // 分享描述
  285. link: `http://liyuyu.xzaiyp.top/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  286. success: function() {
  287. // 用户点击了分享后执行的回调函数
  288. }
  289. })
  290. this.$jweixin.onMenuShareAppMessage({
  291. title: this.dataInfo.title,
  292. desc: this.dataInfo.title, // 分享描述
  293. link: `http://liyuyu.xzaiyp.top/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  294. success: function() {
  295. // 用户点击了分享后执行的回调函数
  296. }
  297. })
  298. })
  299. this.$jweixin.error(err => {
  300. // uni.showModal({
  301. // content:'err:' + JSON.stringify(err)
  302. // })
  303. // config信息验证失败会执行 error 函数,如签名过期导致验证失败,具体错误信息可以打开 config 的debug模式查看,也可以在返回的 res 参数中查看,对于 SPA 可以在这里更新签名。
  304. });
  305. // uni.navigateTo({
  306. // url:`/pages/home/buy-course?id=${this.id}`
  307. // })
  308. }
  309. })
  310. },
  311. getactivityFindById(id) {
  312. uni.showLoading()
  313. this.$api('getShopDetailsById', {
  314. id
  315. })
  316. .then(res => {
  317. uni.hideLoading()
  318. if (res.code == 200) {
  319. this.dataInfo = res.result;
  320. }
  321. })
  322. },
  323. poster() {
  324. this.showp = true;
  325. this.getmyInfo()
  326. }
  327. }
  328. }
  329. </script>
  330. <style lang="scss" scoped>
  331. .hide-context {
  332. margin: 20rpx 0;
  333. padding: 30rpx 30rpx;
  334. outline: 0px;
  335. width: 100%;
  336. max-width: 100%;
  337. box-sizing: border-box;
  338. overflow-wrap: break-word;
  339. display: inline-block;
  340. vertical-align: top;
  341. background-image: linear-gradient(#dceefc 0%, #fefeff 100%);
  342. height: auto;
  343. overflow: hidden;
  344. border: 0px none;
  345. color: #B0B0B0;
  346. text-align: center;
  347. font-size: 26rpx;
  348. }
  349. .active-card {
  350. background: #ffffff;
  351. padding: 20rpx 29rpx 13rpx;
  352. border-bottom: 20rpx solid #F5F5F5;
  353. .active-title {
  354. font-size: 36rpx;
  355. color: #000;
  356. font-weight: 700;
  357. margin-top: 20rpx;
  358. line-height: 40rpx;
  359. }
  360. .active-time {
  361. color: #707070;
  362. font-size: 30rpx;
  363. margin: 30rpx 0;
  364. }
  365. .active-add {
  366. color: #707070;
  367. font-size: 30rpx;
  368. margin: 30rpx 0;
  369. }
  370. .active-add2 {
  371. color: #707070;
  372. font-size: 30rpx;
  373. }
  374. .menu-price {
  375. font-weight: 700;
  376. font-size: 40rpx;
  377. color: #D33D3E;
  378. .unit {
  379. font-size: 40rpx;
  380. }
  381. .tips {
  382. font-size: 30rpx;
  383. }
  384. }
  385. .copy {
  386. padding-left: 20rpx;
  387. font-size: 26rpx;
  388. color: #1b2bbc;
  389. cursor: pointer;
  390. }
  391. .active-menu {
  392. margin-top: 31rpx;
  393. .menu-btn {
  394. width: 213rpx;
  395. height: 79rpx;
  396. display: flex;
  397. align-items: center;
  398. justify-content: center;
  399. background-color: #ED1450;
  400. color: #FFFFFF;
  401. font-size: 26rpx;
  402. border-radius: 40rpx;
  403. }
  404. }
  405. }
  406. .contnet {
  407. padding: 20rpx 20rpx 150rpx 20rpx;
  408. font-weight: 500;
  409. font-size: 40rpx;
  410. }
  411. .btn-box {
  412. position: fixed;
  413. bottom: 0;
  414. left: 0;
  415. right: 0;
  416. }
  417. .share-box {
  418. width: 100%;
  419. height: 100vh;
  420. position: fixed;
  421. top: 0;
  422. left: 0;
  423. background-color: rgba(0, 0, 0, .8);
  424. .jiantou {
  425. position: absolute;
  426. top: 140rpx;
  427. right: 40rpx;
  428. image {
  429. width: 138rpx;
  430. height: 138rpx;
  431. }
  432. }
  433. .title {
  434. position: absolute;
  435. top: 50%;
  436. left: 50%;
  437. transform: translate(-50%, -50%);
  438. image {
  439. width: 526rpx;
  440. height: 212rpx;
  441. }
  442. }
  443. }
  444. </style>