兼兼街公众号代码
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.

489 lines
13 KiB

2 years ago
  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="wechatMoments">积分兑换({{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('carClick', {
  151. newId: this.dataInfo.id
  152. })
  153. .then(res => {
  154. if (res.code == 200) {
  155. that.erop = true;
  156. }
  157. if (res.code == 500) {
  158. that.$api('create', {
  159. id: that.dataInfo.id
  160. })
  161. .then(res => {
  162. that.$jweixin.config({
  163. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  164. appId: 'wxdabccf5a0110cfab', // 必填,公众号的唯一标识
  165. timestamp: res.result.timestamp, // 必填,生成签名的时间戳
  166. nonceStr: res.result.noncestr, // 必填,生成签名的随机串
  167. signature: res.result.sgture, // 必填,签名
  168. jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
  169. 'onMenuShareTimeline', 'onMenuShareAppMessage',
  170. 'chooseWXPay'
  171. ]
  172. });
  173. that.$jweixin.chooseWXPay({
  174. appId: 'wxdabccf5a0110cfab',
  175. timestamp: res.result
  176. .timeStamp, // 支付签名时间戳,注意微信 jssdk 中的所有使用 timestamp 字段均为小写。但最新版的支付后台生成签名使用的 timeStamp 字段名需大写其中的 S 字符
  177. nonceStr: res.result.nonceStr, // 支付签名随机串,不长于 32 位
  178. package: res.result
  179. .packageValue, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
  180. signType: res.result
  181. .signType, // 微信支付V3的传入 RSA ,微信支付V2的传入格式与V2统一下单的签名格式保持一致
  182. paySign: res.result.paySign, // 支付签名
  183. success: function(res) {
  184. that.erop = true;
  185. }
  186. });
  187. })
  188. }
  189. })
  190. },
  191. qrFun(text) {
  192. this.qrShow = true
  193. uQRCode.make({
  194. canvasId: 'qrcode',
  195. componentInstance: this,
  196. text: text,
  197. size: 65,
  198. margin: 0,
  199. backgroundColor: '#FFFFFF',
  200. foregroundColor: '#000000',
  201. fileType: 'png',
  202. errorCorrectLevel: uQRCode.errorCorrectLevel.H,
  203. success: res => {
  204. console.log("ercode", text)
  205. }
  206. })
  207. },
  208. apply() {
  209. if (!this.$store.state.userToken) {
  210. this.$Toast('请先登录!')
  211. setTimeout(() => {
  212. uni.navigateTo({
  213. url: '/pages/my/login-kehu'
  214. })
  215. }, 1000)
  216. return
  217. }
  218. this.share(1)
  219. uni.navigateTo({
  220. url: `/pages/home/buy-course?id=${this.id}`
  221. })
  222. },
  223. wechatMoments() {
  224. this.$api('creteFenxian', {
  225. url: location.href.split('#')[0]
  226. })
  227. .then(res => {
  228. if (res.code == 200) {
  229. this.$jweixin.config({
  230. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  231. appId: 'wxdabccf5a0110cfab', // 必填,公众号的唯一标识
  232. timestamp: res.result.timestamp, // 必填,生成签名的时间戳
  233. nonceStr: res.result.noncestr, // 必填,生成签名的随机串
  234. signature: res.result.sgture, // 必填,签名
  235. jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
  236. 'onMenuShareTimeline', 'onMenuShareAppMessage', 'chooseWXPay'
  237. ]
  238. });
  239. this.$jweixin.ready(ress => {
  240. this.$jweixin.updateTimelineShareData({
  241. title: this.dataInfo.title,
  242. link: `https://xinxiong.java996.icu/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  243. })
  244. });
  245. }
  246. })
  247. },
  248. share(type) { //1为支付
  249. if (!type) {
  250. this.shareShow = true;
  251. }
  252. this.$api('creteFenxian', {
  253. url: location.href.split('#')[0]
  254. })
  255. .then(res => {
  256. if (res.code == 200) {
  257. this.$jweixin.config({
  258. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  259. appId: 'wxdabccf5a0110cfab', // 必填,公众号的唯一标识
  260. timestamp: res.result.timestamp, // 必填,生成签名的时间戳
  261. nonceStr: res.result.noncestr, // 必填,生成签名的随机串
  262. signature: res.result.sgture, // 必填,签名
  263. jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData',
  264. 'onMenuShareTimeline', 'onMenuShareAppMessage', 'chooseWXPay'
  265. ]
  266. });
  267. this.$jweixin.ready(ress => {
  268. this.$jweixin.onMenuShareTimeline({
  269. title: this.dataInfo.title,
  270. desc: this.dataInfo.title, // 分享描述
  271. link: `http://liyuyu.xzaiyp.top/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  272. success: function() {
  273. // 用户点击了分享后执行的回调函数
  274. }
  275. })
  276. this.$jweixin.onMenuShareAppMessage({
  277. title: this.dataInfo.title,
  278. desc: this.dataInfo.title, // 分享描述
  279. link: `http://liyuyu.xzaiyp.top/pages/home/course-detial?id=${this.id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  280. success: function() {
  281. // 用户点击了分享后执行的回调函数
  282. }
  283. })
  284. })
  285. this.$jweixin.error(err => {
  286. // uni.showModal({
  287. // content:'err:' + JSON.stringify(err)
  288. // })
  289. // config信息验证失败会执行 error 函数,如签名过期导致验证失败,具体错误信息可以打开 config 的debug模式查看,也可以在返回的 res 参数中查看,对于 SPA 可以在这里更新签名。
  290. });
  291. // uni.navigateTo({
  292. // url:`/pages/home/buy-course?id=${this.id}`
  293. // })
  294. }
  295. })
  296. },
  297. getactivityFindById(id) {
  298. uni.showLoading()
  299. this.$api('getShopDetailsById', {
  300. id
  301. })
  302. .then(res => {
  303. uni.hideLoading()
  304. if (res.code == 200) {
  305. this.dataInfo = res.result;
  306. }
  307. })
  308. },
  309. poster() {
  310. this.showp = true;
  311. this.getmyInfo()
  312. }
  313. }
  314. }
  315. </script>
  316. <style lang="scss" scoped>
  317. .hide-context {
  318. margin: 20rpx 0;
  319. padding: 30rpx 30rpx;
  320. outline: 0px;
  321. width: 100%;
  322. max-width: 100%;
  323. box-sizing: border-box;
  324. overflow-wrap: break-word;
  325. display: inline-block;
  326. vertical-align: top;
  327. background-image: linear-gradient(#dceefc 0%, #fefeff 100%);
  328. height: auto;
  329. overflow: hidden;
  330. border: 0px none;
  331. color: #B0B0B0;
  332. text-align: center;
  333. font-size: 26rpx;
  334. }
  335. .active-card {
  336. background: #ffffff;
  337. padding: 20rpx 29rpx 13rpx;
  338. border-bottom: 20rpx solid #F5F5F5;
  339. .active-title {
  340. font-size: 36rpx;
  341. color: #000;
  342. font-weight: 700;
  343. margin-top: 20rpx;
  344. line-height: 40rpx;
  345. }
  346. .active-time {
  347. color: #707070;
  348. font-size: 30rpx;
  349. margin: 30rpx 0;
  350. }
  351. .active-add {
  352. color: #707070;
  353. font-size: 30rpx;
  354. margin: 30rpx 0;
  355. }
  356. .active-add2 {
  357. color: #707070;
  358. font-size: 30rpx;
  359. }
  360. .menu-price {
  361. font-weight: 700;
  362. font-size: 40rpx;
  363. color: #D33D3E;
  364. .unit {
  365. font-size: 40rpx;
  366. }
  367. .tips {
  368. font-size: 30rpx;
  369. }
  370. }
  371. .copy {
  372. padding-left: 20rpx;
  373. font-size: 26rpx;
  374. color: #1b2bbc;
  375. cursor: pointer;
  376. }
  377. .active-menu {
  378. margin-top: 31rpx;
  379. .menu-btn {
  380. width: 213rpx;
  381. height: 79rpx;
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. background-color: #ED1450;
  386. color: #FFFFFF;
  387. font-size: 26rpx;
  388. border-radius: 40rpx;
  389. }
  390. }
  391. }
  392. .contnet {
  393. padding: 20rpx 20rpx 150rpx 20rpx;
  394. font-weight: 500;
  395. font-size: 40rpx;
  396. }
  397. .btn-box {
  398. position: fixed;
  399. bottom: 0;
  400. left: 0;
  401. right: 0;
  402. }
  403. .share-box {
  404. width: 100%;
  405. height: 100vh;
  406. position: fixed;
  407. top: 0;
  408. left: 0;
  409. background-color: rgba(0, 0, 0, .8);
  410. .jiantou {
  411. position: absolute;
  412. top: 140rpx;
  413. right: 40rpx;
  414. image {
  415. width: 138rpx;
  416. height: 138rpx;
  417. }
  418. }
  419. .title {
  420. position: absolute;
  421. top: 50%;
  422. left: 50%;
  423. transform: translate(-50%, -50%);
  424. image {
  425. width: 526rpx;
  426. height: 212rpx;
  427. }
  428. }
  429. }
  430. </style>