index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. <template>
  2. <view>
  3. <view style="color: #000000;">
  4. <tn-nav-bar backgroundColor="#ffffff" :bottomShadow="false">{{commission_alias}}</tn-nav-bar>
  5. <view :style="{height: tobheight+'px'}"></view>
  6. </view>
  7. <view style="width:100%;height: 100%;padding-right: 30rpx;">
  8. <view class="commission-wrap" :class="{ blur: !hasAuth }">
  9. <!-- 用户资料 -->
  10. <view class="user-card">
  11. <view class="card-top u-flex u-row-between">
  12. <view class="u-flex">
  13. <view class="head-img-box">
  14. <image class="head-img" :src="userInfo.avatar?userInfo.avatar:'/static/images/head.jpg'"
  15. mode=""></image>
  16. </view>
  17. <view class="u-flex-col">
  18. <view class="user-name">{{ userInfo.nickname }}</view>
  19. <view class="user-info-box u-flex">
  20. <view class="tag-box u-flex">
  21. <!-- <image v-if="commissionLv.image" class="tag-img" :src="commissionLv.image" mode=""></image> -->
  22. <text class="tag-title">{{ commissionLv.name }}</text>
  23. <!-- <view v-show="showLv" class="u-iconfont uicon-arrow-right" style="color: #fff;font-size: 28rpx;"></view> -->
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="u-flex-col">
  29. <view class="u-flex-col u-col-center">
  30. <button class="u-reset-button log-btn u-m-b-20" @tap="toTeam">明细</button>
  31. <button class="u-reset-button look-btn" @tap="showMoney = !showMoney">
  32. <!-- <view class="u-iconfont" :class="showMoney ? 'uicon-eye-fill' : 'uicon-eye-off'" style="color: #fff;font-size: 50rpx;"></view> -->
  33. <u-icon :name="showMoney ? 'eye-fill':'eye-off'" color="#fff" size="22"></u-icon>
  34. </button>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 收益 -->
  39. <view class="card-bottom u-flex">
  40. <view class="u-flex-1 ">
  41. <view class="item-title">累计收入</view>
  42. <view class="item-detail">{{showMoney? money_total || 0.00:'****'}}</view>
  43. </view>
  44. <view class="u-flex-1 u-col-center">
  45. <view class="item-title">待入账佣金</view>
  46. <view class="item-detail">{{showMoney? on_cashout_money || 0.00:'****'}}</view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 滚动明细 -->
  51. <view class="commission-log">
  52. <scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box log-scroll">
  53. <view class="log-item-box u-flex u-row-between" v-for="item in commissionLog" :key="item.id"
  54. @tap="$u.toast(item.remark)">
  55. <view class="log-item-wrap">
  56. <view class="log-item u-flex u-ellipsis-1 u-col-center">
  57. <view class="u-flex u-col-center ">
  58. <!-- <image
  59. class="log-img"
  60. :src="item.oper_type !== 'user' ? logMap[item.oper_type] : item.oper ? item.oper.avatar : logMap['admin']"
  61. mode=""
  62. ></image> -->
  63. <!-- <image class="log-img" :src="appInfo.site_logo_path" mode=""></image> -->
  64. <image class="log-img" :src="item.oper" mode=""></image>
  65. </view>
  66. <view class="log-text u-ellipsis-1">{{ item.remark }}</view>
  67. </view>
  68. </view>
  69. <text class="log-time">{{ item.createtime }}</text>
  70. </view>
  71. <!-- 更多 -->
  72. <!-- <view class="loadmore-wrap" v-if="commissionLog.length"><u-loadmore :status="loadStatus" icon-type="flower" color="#f6f6f6" /></view> -->
  73. </scroll-view>
  74. </view>
  75. <!-- 功能菜单 -->
  76. <view class="menu-box u-flex">
  77. <view class="menu-item u-flex-col u-col-center" v-for="(menu, index) in menuList"
  78. v-if="!menu.isAgentFrom" :key="index" @tap="jump(menu.path)">
  79. <image class="item-img" :src="menu.img" mode=""></image>
  80. <view class="item-title">{{ menu.title }}</view>
  81. </view>
  82. <!-- #ifdef H5 -->
  83. <view @click="createPoster" class="menu-item u-flex-col u-col-center">
  84. <image class="item-img" src="https://file.shopro.top/imgs/commission/commission_icon5.png"
  85. mode=""></image>
  86. <view class="item-title">分享海报</view>
  87. </view>
  88. <view @click="sharelink" class="menu-item u-flex-col u-col-center">
  89. <image class="item-img" src="https://file.shopro.top/imgs/commission/commission_icon7.png"
  90. mode=""></image>
  91. <view class="item-title">分享链接</view>
  92. </view>
  93. <!-- #endif -->
  94. </view>
  95. <!-- #ifdef H5 -->
  96. <!-- <view class="bill">
  97. <u-button @click="createPoster" color="#ffc107" type="primary" shape="circle" text="推广海报"></u-button>
  98. </view> -->
  99. <!-- #endif -->
  100. </view>
  101. <!-- 佣金中心权限验证 -->
  102. <u-popup class="auth-box" :mask="false" v-model="showAuthModal" mode="center" :mask-close-able="false"
  103. close-icon-pos="top-left" border-radius="20">
  104. <view class="notice-box">
  105. <view class="img-wrap">
  106. <image class="notice-img" :src="authNotice.img" mode=""></image>
  107. </view>
  108. <view class="notice-title">{{ authNotice.title }}</view>
  109. <view class="notice-detail">{{ authNotice.detail }}</view>
  110. <button class="u-reset-button notice-btn"
  111. @tap="onAuthBtn(authNotice.btnPath)">{{ authNotice.btnText }}</button>
  112. <button class="u-reset-button back-btn" @tap="$Router.back()" v-if="!authNotice.hideBtn">返回</button>
  113. <button class="u-reset-button back-btn" @tap="hasAuth = true" v-else>取消</button>
  114. </view>
  115. </u-popup>
  116. <!-- 成为分销商条件 -->
  117. <u-popup v-if="showTerm" class="into-agent-modal" :bgStyle="{
  118. background: 'none'
  119. }" v-model="showTerm" mode="center" :mask="false" :mask-close-able="false">
  120. <view class="condition-box u-flex u-row-center u-col-center">
  121. <!-- 金额人数 -->
  122. <view class="goods-condition u-flex u-row-between" v-if="showMoneyTerm">
  123. <view class="btn-box u-flex-col u-p-20 u-col-center">
  124. <button class="u-reset-button buy-btn u-m-b-10" @tap="$Router.back()">知道了</button>
  125. <view class="tips">* 满足指定消费金额即可成为分销商</view>
  126. </view>
  127. </view>
  128. </view>
  129. </u-popup>
  130. </view>
  131. <u-popup :show="showPoster" mode="bottom" @close="showPoster = false">
  132. <!-- <view :style="{height: tobheight+'px'}"></view> -->
  133. <scroll-view scroll-y="true" :style="{maxHeight: posterheight +'px'}">
  134. <view class="haibaoBox">
  135. <image :src="genBgHaibaoUrl" mode="" class="haibao"></image>
  136. <view class="bgList">
  137. <image
  138. @click="currBgIndex=index;poster_bg_img_path=info.poster_bg_img_path[index];createPoster();"
  139. :src="item" mode="" class="item" :class="[currBgIndex==index?'item_a':'']" v-for="(item,index) in info.poster_bg_img_path
  140. "></image>
  141. </view>
  142. <view style="height: 78px;"></view>
  143. <view class="dygbhg">
  144. <view class="whole" @click="showPoster = false">取消</view>
  145. <view class="distinguish" @click="toSave">保存/分享</view>
  146. </view>
  147. </view>
  148. </scroll-view>
  149. </u-popup>
  150. <wike-painter :board="posterObj" style="height: 1px;margin-top: -99999999999999999999999px;"
  151. @done="posterSuccess" ref="painter"></wike-painter>
  152. <wike-loading-page :isLoading="isLoading"></wike-loading-page>
  153. </view>
  154. </template>
  155. <script>
  156. import {
  157. mapMutations,
  158. mapActions,
  159. mapState,
  160. mapGetters
  161. } from 'vuex';
  162. export default {
  163. data() {
  164. return {
  165. currBgIndex: 0,
  166. isLoading: true,
  167. tobheight: 45,
  168. platform: this.$platform.get(),
  169. showAuthModal: true,
  170. empty: false,
  171. team: [{
  172. headimg: 'https://dev.iduomi.cc/attachment/headimg_2.jpg?time=1673514485',
  173. nickname: '多级火箭好',
  174. times: '2020/12/24'
  175. }, {
  176. headimg: 'https://dev.iduomi.cc/attachment/headimg_2.jpg?time=1673514485',
  177. nickname: '多级火箭好',
  178. times: '2020/12/24'
  179. }, {
  180. headimg: 'https://dev.iduomi.cc/attachment/headimg_2.jpg?time=1673514485',
  181. nickname: '多级火箭好',
  182. times: '2020/12/24'
  183. }],
  184. pages: 1,
  185. currentTab: 0,
  186. navbar: [{
  187. name: "下一级",
  188. type: 'shareuid'
  189. }, {
  190. name: "下下级",
  191. type: 'shareuid_grandpa'
  192. },
  193. // {
  194. // name: "下三级",
  195. // type:'shareuid_great_grandpa'
  196. // },
  197. ],
  198. showShare: false, //是否显示分享海报
  199. showMoney: true, //是否显示金额
  200. hasAuth: true, //是否有权限
  201. commissionLv: {
  202. name: '合伙人'
  203. },
  204. //合伙人等级
  205. commissionWallet: null, //合伙人钱包
  206. agentFrom: null, //是否显示我的资料
  207. showLv: true,
  208. commissionLog: [{
  209. id: 1,
  210. oper_type: 'gf',
  211. // oper: 'https://file.shopro.top/imgs/commission/commission_icon1.png',
  212. oper: require('@/static/images/fanyunLogo.png'),
  213. remark: '恭喜您成为了合伙人',
  214. createtime: 1676428876
  215. }], //动态
  216. loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
  217. currentPage: 1,
  218. lastPage: 1,
  219. logMap: {
  220. system: this.$IMG_URL + '/imgs/commission/commission_base_notice.png',
  221. admin: this.$IMG_URL + '/imgs/commission/commission_base_avatar.png'
  222. },
  223. showTerm: true, //条件弹窗
  224. showGoodsTerm: false, //商品条件
  225. showMoneyTerm: false, //金额条件
  226. goodsTermList: [],
  227. moneyTermNum: 0,
  228. authNotice: {},
  229. menuList: [
  230. //menu
  231. {
  232. img: 'https://file.shopro.top/imgs/commission/commission_icon1.png',
  233. title: '我的团队',
  234. path: '/pages/user/commission/team'
  235. },
  236. {
  237. img: 'https://file.shopro.top/imgs/commission/commission_icon2.png',
  238. title: '佣金明细',
  239. path: '/pages/user/commission/commission-log'
  240. },
  241. {
  242. img: 'https://file.shopro.top/imgs/commission/commission_icon4.png',
  243. title: '推广套餐',
  244. path: '/pages/user/commission/goods',
  245. },
  246. {
  247. img: 'https://file.shopro.top/imgs/commission/commission_icon3.png',
  248. title: '提现佣金',
  249. path: '/pages/user/commission/withdraw',
  250. },
  251. // {
  252. // img: 'https://file.shopro.top/imgs/commission/commission_icon6.png',
  253. // title: '排行榜',
  254. // path: '/pages/user/commission/rankings'
  255. // },
  256. {
  257. img: 'https://file.shopro.top/imgs/commission/commission_icon8.png',
  258. title: '提现记录',
  259. path: '/pages/user/commission/withdraw-log',
  260. },
  261. // {
  262. // img: 'https://file.shopro.top/imgs/commission/commission_icon5.png',
  263. // title: '分享海报',
  264. // path: '/pages/user/commission/withdraw',
  265. // },
  266. // {
  267. // img: 'https://file.shopro.top/imgs/commission/commission_icon7.png',
  268. // title: '分享记录',
  269. // path: '/pages/app/commission/share-log',
  270. // }
  271. ],
  272. money_total: '0.00',
  273. on_cashout_money: '0.00',
  274. showPoster: false,
  275. posterObj: {},
  276. posterfff: '您好,我是AI语言模型,可以帮助你做很多事情。例如:\n- 回答你的问题\n- 给你提供某些信息\n- 帮你搜索网页\n- 聊天和闲聊\n- 玩一些小游戏\n- 计算数学题\n- 翻译语言\n- 生成文本\n等等.....\n如果你有任何问题或需要帮助,请随时告诉我。',
  277. spmplatform: 0,
  278. is_examine: 1,
  279. commission_price: 0,
  280. info: {},
  281. posterheight: 0,
  282. poster_bg_img_path: '',
  283. commission_alias: '',
  284. genBgHaibaoUrl: ''
  285. }
  286. },
  287. computed: {
  288. ...mapGetters(['appInfo', 'isLogin', 'userInfo'])
  289. },
  290. onLoad() {
  291. // this.getInviteList()
  292. const that = this;
  293. if (this.platform == 'wxMiniProgram') {
  294. var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight
  295. var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop
  296. this.tobheight = (menumtop + paddingtop + uni.getMenuButtonBoundingClientRect().height)
  297. }
  298. this.posterheight = uni.$u.sys().windowHeight - this.tobheight
  299. this.spmplatform = ['H5', 'wxOfficialAccount', 'wxMiniProgram', 'App'].indexOf(this.platform) + 1;
  300. this.commonqrcodePath()
  301. // console.log('http://vmoushivideomerge.oss-cn-shanghai.aliyuncs.com/20230422/96f1f662dcfc68cb3eff1dcbf660ed92.jpg');
  302. // that.$base64.imageUrlToBase64('http://vmoushivideomerge.oss-cn-shanghai.aliyuncs.com/20230422/96f1f662dcfc68cb3eff1dcbf660ed92.jpg')
  303. },
  304. onShow() {
  305. this.islogin();
  306. },
  307. methods: {
  308. islogin() {
  309. var that = this;
  310. if (!this.isLogin) {
  311. uni.navigateTo({
  312. url: '../user/signin'
  313. });
  314. } else {
  315. this.commission()
  316. // this.getCheck()
  317. }
  318. },
  319. commission() {
  320. let that = this;
  321. that.$http('conf.getGroupConf', {
  322. group: 'system.commission'
  323. }).then(res => {
  324. if (res.code === 0) {
  325. // res.data.poster_bg_img_path = [
  326. // "https://face.cdn.zhishuyun.com/attachments/1133012400174534792/1204009950465101866/0d47db66-1faf-42df-a732-22cf18697a65_ins.png?ex=65d32ca5&is=65c0b7a5&hm=7219a0f250453314cfbf9eefaf2e927ba8d6adea944774b3fe32e67c0787a877&",
  327. // "https://face.cdn.zhishuyun.com/attachments/1133012400174534792/1204010768786526248/a38d536d-7950-400c-bbc7-b37cd86c8de1_ins.png?ex=65d32d68&is=65c0b868&hm=fd5db147a0eb2e6b13719e1acc3f240a3a5ab8e81358df06c86808b68d0b0923"
  328. // ]
  329. that.info = res.data
  330. that.poster_bg_img_path = res.data.poster_bg_img_path[0]
  331. // uni.showToast({
  332. // title: that.poster_bg_img_path
  333. // })
  334. console.log('生成海报需要的info信息=============', that.info);
  335. that.commission_alias = res.data.commission_alias ? res.data.commission_alias : '分销中心'
  336. if (res.data.is_examine) {
  337. that.is_examine = res.data.is_examine
  338. // console.log(that.is_examine);
  339. }
  340. if (res.data.commission_price) {
  341. that.commission_price = res.data.commission_price
  342. }
  343. if (res.data.is_ranking == 1) {
  344. if (that.menuList.length == 5) {
  345. let obj = {
  346. img: 'https://file.shopro.top/imgs/commission/commission_icon6.png',
  347. title: '排行榜',
  348. path: '/pages/user/commission/rankings'
  349. };
  350. that.menuList.splice(2, 0, obj);
  351. }
  352. }
  353. that.getCheck()
  354. }
  355. });
  356. },
  357. commonqrcodePath() {
  358. let spm = this.userInfo.id + '.1.0.' + this.spmplatform + '.1';
  359. // console.log(spm);
  360. this.$http('common.qrcodePath', {
  361. spm: spm
  362. }).then(res => {
  363. if (res.code == 0) {
  364. this.qrcode = res.data;
  365. console.log('二维码需要包含的信息======', this.qrcode);
  366. // setTimeout(() => {
  367. // this.createPoster()
  368. // }, 2000)
  369. }
  370. });
  371. },
  372. sharelink() {
  373. let spm = this.userInfo.id + '.1.0.' + this.spmplatform + '.1';
  374. // #ifdef MP-WEIXIN
  375. let url = '/pages/index/index?' + 'spm=' + spm
  376. uni.setClipboardData({
  377. data: url,
  378. success: function() {
  379. uni.showToast({
  380. title: '复制链接成功'
  381. });
  382. }
  383. });
  384. // #endif
  385. // #ifdef H5
  386. let uniacid = uni.getStorageSync('uniacid');
  387. if (uniacid) {
  388. let url = window.location.href.split('/h5')[0] + '/h5/?uniacid=' + uniacid + '&spm=' + spm;
  389. uni.setClipboardData({
  390. data: url,
  391. success: function() {
  392. uni.showToast({
  393. title: '复制链接成功'
  394. });
  395. }
  396. });
  397. } else {
  398. uni.showToast({
  399. title: '复制链接失败',
  400. icon: 'none'
  401. })
  402. }
  403. // #endif
  404. },
  405. getdownload(e) {
  406. return new Promise((resolve, reject) => {
  407. uni.request({
  408. url: e,
  409. method: 'GET',
  410. responseType: 'arraybuffer',
  411. success: ress => {
  412. let base64 = wx.arrayBufferToBase64(ress.data);
  413. base64 = 'data:image/jpeg;base64,' + base64
  414. resolve(base64);
  415. },
  416. fail: (e) => {
  417. resolve('fail');
  418. }
  419. })
  420. });
  421. },
  422. posterSuccess() {
  423. uni.hideLoading();
  424. },
  425. async createPoster(e) {
  426. let that = this;
  427. let httpsurl = '';
  428. uni.showLoading({
  429. title: '海报渲染中'
  430. });
  431. // that.poster_bg_img_path =
  432. // "https://mjcdn.iduomi.cc/attachments/1124768570157564029/1132713072260292789/oreynolds_Portrait_retouching_DSLR_effect_green_small_and_fresh_98e8b936-ca9b-45e4-89cd-3d3cd7fd8a60.png"
  433. console.log('that.poster_bg_img_path', that.poster_bg_img_path);
  434. // if (that.poster_bg_img_path.indexOf("https") < 0) {
  435. // httpsurl = await that.getdownload(that.poster_bg_img_path.replace("http:", "https:"));
  436. // } else {
  437. httpsurl = await that.getdownload(that.poster_bg_img_path);
  438. // }
  439. if (httpsurl == 'fail') {
  440. uni.hideLoading();
  441. uni.showToast({
  442. title: '生成失败',
  443. icon: 'none'
  444. })
  445. return;
  446. }
  447. let proportionally = this.info.poster_bg_width / uni.$u.sys().windowWidth;
  448. (this.posterObj = {
  449. width: (this.info.poster_bg_width / proportionally) + 'px',
  450. height: (this.info.poster_bg_height / proportionally) + 'px',
  451. background: '#fff',
  452. borderRadius: '16rpx',
  453. views: [{
  454. src: httpsurl,
  455. type: "image",
  456. css: {
  457. width: (this.info.poster_bg_width / proportionally) + 'px',
  458. height: (this.info.poster_bg_height / proportionally) + 'px',
  459. }
  460. },
  461. {
  462. type: 'view',
  463. css: {
  464. left: ((this.info.poster_qrcode_x / proportionally) + 40) + 'px',
  465. top: ((this.info.poster_qrcode_y / proportionally)) + 'px',
  466. position: 'fixed',
  467. },
  468. views: [{
  469. type: 'qrcode',
  470. text: this.qrcode,
  471. css: {
  472. width: (this.info.poster_qrcode_width / proportionally) + 'px',
  473. height: (this.info.poster_qrcode_width / proportionally) + 'px',
  474. background: '#fff'
  475. }
  476. },
  477. // {
  478. // src: '/static/images/fanyunLogo.png',
  479. // type: "image",
  480. // css: {
  481. // position: 'absolute',
  482. // width: 30 + 'rpx',
  483. // height: 30 + 'rpx',
  484. // left: '60rpx',
  485. // top: '50rpx',
  486. // }
  487. // }
  488. ],
  489. },
  490. ]
  491. }),
  492. (
  493. setTimeout(() => {
  494. that.$refs.painter.canvasToTempFilePathSync({
  495. // 在nvue里是jpeg
  496. fileType: 'jpg',
  497. quality: 1,
  498. success: res => {
  499. console.log('res.tempFilePath', res.tempFilePath);
  500. this.genBgHaibaoUrl = res.tempFilePath
  501. uni.hideLoading();
  502. }
  503. })
  504. that.showPoster = true
  505. }, 1000)
  506. );
  507. },
  508. is_weixin() {
  509. var ua = window.navigator.userAgent.toLowerCase();
  510. if (ua.match(/MicroMessenger/i) == 'micromessenger') {
  511. console.log('微信浏览器');
  512. return true;
  513. } else {
  514. console.log("不是微信浏览器");
  515. return false;
  516. }
  517. },
  518. toSave() {
  519. let _this = this
  520. if (!this.is_weixin()) {
  521. return uni.showModal({
  522. showCancel: false,
  523. title: '提示',
  524. content: '请在微信内置浏览器打开,长按图片下载/分享',
  525. confirmColor: '#207CF7'
  526. })
  527. }
  528. uni.showModal({
  529. confirmColor: '#207CF5',
  530. confirmText: '查看图片',
  531. title: '提示',
  532. content: '查看图片后长按图片即可保存或分享',
  533. success(src) {
  534. if (src.confirm) {
  535. _this.showPoster = false
  536. uni.previewImage({
  537. urls: [_this.genBgHaibaoUrl]
  538. });
  539. } else if (src.cancel) {
  540. // this.showPoster = true;
  541. }
  542. }
  543. });
  544. return
  545. uni.showLoading({
  546. title: '海报生成中'
  547. });
  548. this.$refs.painter.canvasToTempFilePathSync({
  549. // 在nvue里是jpeg
  550. fileType: 'jpg',
  551. quality: 1,
  552. success: res => {
  553. wx.showShareImageMenu({
  554. path: res.tempFilePath
  555. })
  556. this.showPoster = false;
  557. uni.hideLoading();
  558. // #ifdef H5
  559. this.showPoster = false;
  560. uni.hideLoading();
  561. uni.showModal({
  562. confirmColor: '#26B3A0',
  563. confirmText: '查看图片',
  564. title: '提示',
  565. content: '查看图片后长按图片即可保存或分享',
  566. success(src) {
  567. if (src.confirm) {
  568. uni.previewImage({
  569. urls: [res.tempFilePath]
  570. });
  571. } else if (src.cancel) {
  572. this.showPoster = true;
  573. }
  574. }
  575. });
  576. // #endif
  577. }
  578. });
  579. },
  580. getCheck() {
  581. var that = this;
  582. that.$http('commission.auth').then(res => {
  583. if (res.code == 0) {
  584. this.isLoading = false
  585. uni.setNavigationBarTitle({
  586. title: this.appInfo.site_name
  587. });
  588. that.money_total = res.data.money_total > 0 ? res.data.money_total : '0.00'
  589. that.on_cashout_money = res.data.on_cashout_money > 0 ? res.data.on_cashout_money : '0.00'
  590. that.commissionLog[0].createtime = res.data.create_time
  591. if (res.data.status == 0 && that.is_examine == 1) {
  592. uni.showModal({
  593. confirmText: '确定',
  594. showCancel: false,
  595. confirmColor: '#5e49c3',
  596. content: '分销商申请已提交,等待后台审核通过',
  597. title: '提示',
  598. success(res) {
  599. if (res.confirm) {
  600. uni.navigateBack()
  601. }
  602. }
  603. })
  604. }
  605. if (res.data.status == 2) {
  606. uni.showModal({
  607. confirmText: '联系客服',
  608. confirmColor: '#5e49c3',
  609. content: '已被禁用,有疑问请咨询客服',
  610. title: '提示',
  611. success(res) {
  612. if (res.confirm) {
  613. uni.navigateTo({
  614. url: '/pages/user/public/kefu'
  615. })
  616. } else if (res.cancel) {
  617. uni.navigateBack()
  618. }
  619. }
  620. })
  621. }
  622. } else {
  623. // uni.showModal({
  624. // confirmText:'申请',
  625. // confirmColor:'#5e49c3',
  626. // content:'立即申请成为合伙人',
  627. // title:'提示',
  628. // success(res) {
  629. // if(res.confirm){
  630. // that.commissionapply()
  631. // }else if(res.cancel){
  632. // uni.navigateBack()
  633. // }
  634. // }
  635. // })
  636. uni.redirectTo({
  637. url: '/pages/user/commission/apply'
  638. })
  639. }
  640. });
  641. },
  642. commissionapply() {
  643. var that = this;
  644. that.$http('commission.apply').then(res => {
  645. if (res.code == 0) {
  646. uni.showToast({
  647. title: '申请成功'
  648. })
  649. that.getCheck()
  650. } else {
  651. uni.showModal({
  652. confirmText: '重新申请',
  653. confirmColor: '#5e49c3',
  654. content: '合伙人申请失败',
  655. title: '提示',
  656. success(res) {
  657. if (res.confirm) {
  658. that.commissionapply()
  659. } else if (res.cancel) {
  660. uni.navigateBack()
  661. }
  662. }
  663. })
  664. }
  665. });
  666. },
  667. // 我的团队
  668. getInviteList() {
  669. var that = this;
  670. that.$api('distribution.ulist', {
  671. uid: this.userInfo.id,
  672. type: this.navbar[this.currentTab].type
  673. }).then(res => {
  674. // console.log(res)
  675. if (res.data.length > 0) {
  676. if (that.team.length > 0) {
  677. var dd = this.team;
  678. this.team = dd.concat(res.data);
  679. this.pages++;
  680. } else {
  681. this.team = res.data;
  682. this.pages++;
  683. }
  684. } else {
  685. // this.empty = true
  686. }
  687. });
  688. },
  689. jump(e) {
  690. uni.navigateTo({
  691. url: e
  692. })
  693. },
  694. change(index) {
  695. this.currentTab = index;
  696. this.team = [];
  697. this.pages = 1;
  698. this.getInviteList()
  699. },
  700. toTeam() {
  701. // uni.navigateTo({
  702. // url:'/pages/user/commission/team'
  703. // })
  704. uni.navigateTo({
  705. url: '/pages/user/commission/commission-log'
  706. })
  707. }
  708. },
  709. onPullDownRefresh() {
  710. var that = this;
  711. // setTimeout(function() {
  712. // this.pages = 1;
  713. // this.team = [];
  714. // that.getInviteList();
  715. // uni.stopPullDownRefresh();
  716. // }, 1000);
  717. },
  718. onReachBottom() {
  719. // this.getInviteList();
  720. },
  721. }
  722. </script>
  723. <style lang="scss" scoped>
  724. @import './index.scss';
  725. </style>