jiameng.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <view class="main">
  3. <view class="top">
  4. <image src="../../static/index/img1.png" mode=""></image>
  5. </view>
  6. <view class="protocol">
  7. <view class="protocol-btn" @click="protocol" data-target="protocol">查看协议</view>
  8. <view class="protocol-content">
  9. <image src="../../static/apply/jiangjin.png" mode="" class="protocol-content-img"></image>
  10. <view class="title">销售拿奖金</view>
  11. <view class="txt">成为推广人后,推广其他用户下单,您可以获得奖金</view>
  12. </view>
  13. </view>
  14. <view class="tabs">
  15. <view @click="join(index)" class="tab" :key="index" v-for="( item , index ) in tabs">
  16. <view class="tab-img">
  17. <image :src="item.img" mode="" class="i1"></image>
  18. </view>
  19. <view class="tab-txt">
  20. <view>{{index == 1 ? item.txt+money+'元即可': item.txt}}</view>
  21. <view>{{item.txt2}}</view>
  22. </view>
  23. <view class="tab-foot-img">
  24. <image :src="item.gimg" mode="" class="i2"></image>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 公告栏 -->
  29. <view class="cu-modal" :class="modalName == 'protocol'?'show':''">
  30. <view class="cu-dialog offset-top">
  31. <view class="cu-bar bg-white justify-end">
  32. <view class="content">协议</view>
  33. <view class="action" @tap="hideModal">
  34. <text class="cuIcon-close yellow" />
  35. </view>
  36. </view>
  37. <view class="padding-xl">
  38. <u-parse :content="promote_agreement == null? '暂无文章数据' : promote_agreement" @preview="preview" @navigate="navigate"
  39. className="articleDetailContent" />
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 获取微信信息弹窗框 -->
  44. <view class="cu-modal" :class="modalName == 'login' ? 'show' : ''">
  45. <view class="cu-dialog">
  46. <view class="cu-bar bg-white justify-end">
  47. <view class="content">登录</view>
  48. <view class="action" @tap="modalName = ''">
  49. <text class="cuIcon-close yellow" />
  50. </view>
  51. </view>
  52. <view class="padding-xl">
  53. <view class="top-title" style="">
  54. <text class="top-title1">您还未登陆</text></br>
  55. <text class="top-title2">请先登录再进行操作</text>
  56. </view>
  57. <view class="flex justify-around">
  58. <button type="primary" @tap="modalName = ''" class="cu-btn round greyBg lg">暂不登录</button>
  59. <button type="primary" @click="gotologin" class="cu-btn round yellowBg lg" hover-class="btn-hover">立刻登录</button>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. var user = require('../../common/user.js');
  68. import {
  69. mapState,
  70. mapMutations,
  71. mapGetters,
  72. mapActions
  73. } from 'vuex';
  74. import uParse from '@/components/u-parse/u-parse.vue'
  75. export default {
  76. components: {
  77. uParse
  78. },
  79. data() {
  80. return {
  81. promote_agreement: '',
  82. money: '',
  83. modalName: null, //协议框状态
  84. tabs: [{
  85. img: '../../static/apply/xiadan.png',
  86. txt: '完成任意订单即可',
  87. txt2: '享受推广人特权',
  88. gimg: '../../static/apply/godan.png'
  89. },
  90. {
  91. img: '../../static/apply/qianbao.png',
  92. txt: '支付',
  93. txt2: '享受推广人特权',
  94. gimg: '../../static/apply/gopay.png'
  95. },
  96. ]
  97. }
  98. },
  99. onLoad() {
  100. },
  101. computed: {
  102. ...mapGetters({
  103. hasLogin: 'verifyJwt'
  104. }),
  105. ...mapState(['user'])
  106. },
  107. mounted() {
  108. this.configData()
  109. },
  110. methods: {
  111. ...mapActions({
  112. getUser: 'getUser' // 将 `this.getUser()` 映射为 `this.$store.dispatch('getUser')`
  113. }),
  114. configData: async function() {
  115. let res = await this.$request.post('/api/SystemConfig/getSysteConfig');
  116. console.log(res)
  117. if (res.code == 200) {
  118. this.money = res.data.promote_price
  119. this.promote_agreement = res.data.promote_agreement
  120. }
  121. },
  122. // 协议
  123. protocol(e) {
  124. this.modalName = e.currentTarget.dataset.target
  125. },
  126. hideModal(e) {
  127. this.modalName = null
  128. },
  129. onBridgeReady: function(res) {
  130. WeixinJSBridge.invoke(
  131. 'getBrandWCPayRequest', {
  132. "appId": res.data.appId,
  133. "timeStamp": res.data.timeStamp,
  134. "nonceStr": res.data.nonceStr,
  135. "package": res.data.package,
  136. "signType": res.data.signType,
  137. "paySign": res.data.paySign
  138. },
  139. function(re) {
  140. if (re.err_msg == "get_brand_wcpay_request:ok") {
  141. uni.showToast({
  142. icon: 'success',
  143. title: '支付成功',
  144. duration: 1000
  145. });
  146. setTimeout(function() {
  147. uni.navigateBack();
  148. }, 1000);
  149. }
  150. });
  151. },
  152. async join(index) {
  153. if (index == 1) {
  154. if (this.hasLogin) {
  155. if (this.$util.is_weixin()) {
  156. console.log("weixin")
  157. // let res = await this.$request.post('/api/payment/payPromote', {
  158. // plat_type: 1
  159. // });
  160. // if (res.code == 200) {
  161. // if (typeof WeixinJSBridge == "undefined") {
  162. // if (document.addEventListener) {
  163. // document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady, false);
  164. // } else if (document.attachEvent) {
  165. // document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady);
  166. // document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady);
  167. // }
  168. // } else {
  169. // this.onBridgeReady(res)
  170. // }
  171. // // uni.requestPayment({
  172. // // provider: 'wxpay',
  173. // // timeStamp: res.data.timeStamp,
  174. // // nonceStr: res.data.nonceStr,
  175. // // package: res.data.package,
  176. // // signType: res.data.signType,
  177. // // paySign: res.data.paySign,
  178. // // success: function(res) {
  179. // // uni.showToast({
  180. // // icon: 'success',
  181. // // title: '支付成功'
  182. // // });
  183. // // setTimeout(function() {
  184. // // uni.navigateTo({
  185. // // url: 'index'
  186. // // })
  187. // // }, 2000)
  188. // // },
  189. // // fail: function(res) {
  190. // // uni.showToast({
  191. // // icon: 'none',
  192. // // title: '支付失败'
  193. // // })
  194. // // },
  195. // // complete: function(res) {
  196. // // console.log('支付过程结束');
  197. // // }
  198. // // });
  199. // } else {
  200. // uni.showToast({
  201. // icon: 'none',
  202. // title: res.message
  203. // })
  204. // }
  205. } else {
  206. console.log("进来了")
  207. // let res = await this.$request.post("/api/payment/webPayPromote")
  208. // console.log(res)
  209. }
  210. } else {
  211. this.modalName = 'login'
  212. }
  213. } else {
  214. uni.switchTab({
  215. url: '/pages/index/index'
  216. });
  217. }
  218. },
  219. gotologin() {
  220. this.modalName = '';
  221. uni.navigateTo({
  222. url: "../login/login",
  223. fail: (err) => {
  224. console.log(err)
  225. }
  226. })
  227. }
  228. // wxLogin: function(e) {
  229. // if (e.detail.userInfo == undefined) {
  230. // uni.showToast({
  231. // title: '微信登录失败'
  232. // });
  233. // return;
  234. // }
  235. // user.loginByWeixin(e.detail.userInfo)
  236. // .then(res => {
  237. // this.getUser(true);
  238. // })
  239. // .catch(res => {
  240. // uni.showToast({
  241. // title: '微信登录失败'
  242. // });
  243. // });
  244. // }
  245. }
  246. }
  247. </script>
  248. <style>
  249. @import url("@/components/u-parse/u-parse.css");
  250. page {
  251. background: #F5F5F5;
  252. }
  253. .main {
  254. width: 100vw;
  255. height: auto;
  256. margin-bottom: 20px;
  257. }
  258. .top {
  259. width: 100%;
  260. height: auto;
  261. }
  262. .top image {
  263. width: 100vw;
  264. height: 42vw;
  265. padding: 10px;
  266. }
  267. .protocol {
  268. width: 90vw;
  269. height: 140px;
  270. background: #fff;
  271. border-radius: 5px;
  272. padding: 20px 10px;
  273. margin: 5vw;
  274. position: relative;
  275. }
  276. .protocol .protocol-btn {
  277. /* width: auto;
  278. height: auto; */
  279. width: 160rpx;
  280. height: 48rpx;
  281. line-height: 48rpx;
  282. /* padding: 3px 20px; */
  283. color: #F5CC57;
  284. font-size: 24rpx;
  285. font-weight: 500;
  286. text-align: center;
  287. font-family: PingFangSC-Regular, sans-serif;
  288. background: rgba(236, 207, 125, 0.2);
  289. border-radius: 8px;
  290. float: right;
  291. }
  292. .protocol .protocol-content .protocol-content-img {
  293. width: 120rpx;
  294. height: 120rpx;
  295. position: absolute;
  296. top: 60px;
  297. }
  298. .protocol .protocol-content .title {
  299. width: calc(90vw - 90px);
  300. height: 45rpx;
  301. line-height: 45rpx;
  302. font-size: 32rpx;
  303. font-weight: 300;
  304. font-family: PingFangSC-Regular, sans-serif;
  305. color: #555864;
  306. position: absolute;
  307. top: 60px;
  308. left: 80px;
  309. }
  310. .protocol .protocol-content .txt {
  311. width: calc(90vw - 90px);
  312. height: 66rpx;
  313. line-height: 66rpx;
  314. font-size: 24rpx;
  315. font-weight: 300;
  316. font-family: PingFangSC-Regular, sans-serif;
  317. line-height: 20px;
  318. color: #777;
  319. position: absolute;
  320. top: 85px;
  321. left: 80px;
  322. }
  323. .tabs {
  324. width: 90vw;
  325. height: auto;
  326. margin: 0 5vw;
  327. display: flex;
  328. justify-content: space-between;
  329. }
  330. .tabs .tab {
  331. width: 42.5vw;
  332. height: auto;
  333. border-radius: 5px;
  334. background: #fff;
  335. padding: 20px 0;
  336. }
  337. .tab .i1 {
  338. width: 36px;
  339. height: 36px;
  340. margin: 0 calc(21.25vw - 18px);
  341. }
  342. .tab .tab-txt {
  343. width: 81%;
  344. height: auto;
  345. line-height: 20px;
  346. text-align: center;
  347. margin: 10px 10%;
  348. font-size: 30rpx;
  349. font-weight: 300;
  350. font-family: PingFangSC-Regular, sans-serif;
  351. color: #555864;
  352. }
  353. .tab .i2 {
  354. width: 100px;
  355. height: 30px;
  356. margin: 0 calc(21.25vw - 50px);
  357. }
  358. .yellow {
  359. color: #F5CC57;
  360. }
  361. .yellowBg {
  362. background: #F5CC57 !important;
  363. }
  364. .greyBg {
  365. background: grey !important;
  366. }
  367. .top-title {
  368. margin-bottom: 15px;
  369. }
  370. .top-title .top-title1 {
  371. font-size: 19px;
  372. color: #000000;
  373. margin-top: 10px;
  374. }
  375. .top-title .top-title2 {
  376. font-size: 13px;
  377. color: #999;
  378. }
  379. .offset-top {
  380. bottom: 200px;
  381. }
  382. </style>