shop.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <template>
  2. <view class="body">
  3. <view class="vheigh"></view>
  4. <view class="background"></view>
  5. <view class="content">
  6. <view class="userInfo">
  7. <view class="userInfo-box">
  8. <view class="userInfo-img" v-if="store_info"><image class="portrait" :src="store_info.image"></image></view>
  9. <view class="userInfo-img" v-else><image class="portrait" src="../../static/error/missing-face.png"></image></view>
  10. <view class="userInfo-xinxi">
  11. <view class="title clamp">
  12. <text>{{ store_info ? store_info.name : '总店' }}</text>
  13. </view>
  14. <view class="phone">
  15. <text>{{ store_info ? store_info.phone : '' }}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="saoma" @click="sao()">
  21. <view class="saoma-left">
  22. <image class="saoma-icon" src="../../static/img/shop1.png" mode=""></image>
  23. <view class="saoma-font">扫码登录</view>
  24. </view>
  25. <view class="saoma-jt"><image src="../../static/img/shop2.png" mode=""></image></view>
  26. </view>
  27. <view class="userInfoList">
  28. <view class="userInfoList-bottom" @click="navTo('/pages/shop/turnover')">
  29. <view class="bottom"><image class="bottom-icon1" src="../../static/img/shop3.png" mode=""></image></view>
  30. <view class="num">¥{{ achievement }}</view>
  31. <view class="font">成交金额</view>
  32. </view>
  33. <view class="userInfoList-bottom" @click="navTo('/pages/shop/order?id=' + userInfo.store_id)">
  34. <view class="bottom"><image class="bottom-icon2" src="../../static/img/shop4.png" mode=""></image></view>
  35. <view class="num">{{ order_count }}</view>
  36. <view class="font">订单总数</view>
  37. </view>
  38. <view class="userInfoList-bottom" @click="navTo('/pages/shop/employee?id=' + userInfo.store_id)">
  39. <view class="bottom"><image class="bottom-icon3" src="../../static/img/shop5.png" mode=""></image></view>
  40. <view class="num">¥{{ achievement_waiter || 0 }}</view>
  41. <view class="font">员工业绩</view>
  42. </view>
  43. <!-- <view class="userInfoList-bottom" @click="navTo('/pages/shop/vipDetail')"> -->
  44. <view class="userInfoList-bottom">
  45. <view class="bottom"><image class="bottom-icon4" src="../../static/img/shop6.png" mode=""></image></view>
  46. <view class="num">{{ store_info ? store_info.valid_time : 0 }}</view>
  47. <view class="font">曝光量</view>
  48. </view>
  49. <view class="userInfoList-bottom" @click="navTo('/pages/shop/myriad?id=' + userInfo.store_id)">
  50. <view class="bottom"><image class="bottom-icon5" src="../../static/img/shop7.png" mode=""></image></view>
  51. <view class="num">{{ over }}</view>
  52. <view class="font">破万大神</view>
  53. </view>
  54. <view class="userInfoList-bottom" @click="navTo('/pages/shop/product')">
  55. <view class="bottom"><image class="bottom-icon6" src="../../static/img/shop8.png" mode=""></image></view>
  56. <view class="num">{{ productNum }}</view>
  57. <view class="font">热卖项目排行</view>
  58. </view>
  59. <!-- <view class="userInfoList-bottom" @click="navTo('/pages/shop/fissioned')"> -->
  60. <view class="userInfoList-bottom">
  61. <view class="bottom"><image class="bottom-icon7" src="../../static/img/shop9.png" mode=""></image></view>
  62. <view class="num">{{ user_explode }}</view>
  63. <view class="font">已裂变客数</view>
  64. </view>
  65. <!-- <view class="userInfoList-bottom" @click="navTo('/pages/shop/fission')">
  66. <view class="bottom"><image class="bottom-icon8" src="../../static/img/shop10.png" mode=""></image></view>
  67. <view class="num">30</view>
  68. <view class="font">待裂变客数</view>
  69. </view> -->
  70. <view class="userInfoList-bottom" @click="navTo('/pages/shop/subbranch')" v-if="userInfo.user_rule == 'admin'">
  71. <view class="bottom"><image class="bottom-icon9" src="../../static/img/shop11.png" mode=""></image></view>
  72. <view class="num">{{ shopNum }}</view>
  73. <view class="font">分店数据</view>
  74. </view>
  75. <view class="userInfoList-bottom" @click="navTo('/pages/shop/group')">
  76. <view class="bottom"><image class="bottom-icon8" src="../../static/img/shop10.png" mode=""></image></view>
  77. <view class="num"></view>
  78. <view class="font">分组数据</view>
  79. </view>
  80. <view class="userInfoList-bottom" @click="navTo('/pages/dp/infoOne')" v-if="userInfo.user_rule == 'admin'">
  81. <view class="bottom"><image class="bottom-icon10" src="../../static/img/shop12.png" mode=""></image></view>
  82. <view class="num"></view>
  83. <view class="font">大屏数据1</view>
  84. </view>
  85. <view class="userInfoList-bottom" @click="navTo('/pages/dp/infoTwo')" v-if="userInfo.user_rule == 'admin'">
  86. <view class="bottom"><image class="bottom-icon10" src="../../static/img/shop12.png" mode=""></image></view>
  87. <view class="num"></view>
  88. <view class="font">大屏数据2</view>
  89. </view>
  90. </view>
  91. </view>
  92. <uni-popup ref="popuphx" class="agree-wrapper">
  93. <view class="hx-wrapper">
  94. <view class="hx-img"><image src="../../static/img/hxbg.png" mode=""></image></view>
  95. <view class="hx-body">
  96. <view class="hx-title">输入核销码核销</view>
  97. <input type="text" v-model="code" placeholder="请输入核销码" placeholder-class="hx-placeholder" />
  98. <view class="hx-btn" @click="qhx">立即核销</view>
  99. </view>
  100. <view class="hx-close" @click="close"><image src="../../static/icon/close.png" mode=""></image></view>
  101. </view>
  102. </uni-popup>
  103. <u-tabbar
  104. v-if="userInfo.user_rule == 'leader' || userInfo.user_rule == 'admin'"
  105. v-model="current"
  106. :list="tabbar"
  107. active-color="#FF4C4C"
  108. inactive-color="#666666"
  109. ></u-tabbar>
  110. <u-tabbar v-else v-model="current" :list="tabbar1" active-color="#FF4C4C" inactive-color="#666666"></u-tabbar>
  111. </view>
  112. </template>
  113. <script>
  114. import { mapState, mapMutations } from 'vuex';
  115. import { tabbar, tabbar1 } from '@/utils/tabbar.js';
  116. import { getStoreGoods } from '@/api/product.js';
  117. import { userinfo, h5Auth } from '@/api/user.js';
  118. import { store, over10000, store_list, product } from '@/api/info.js';
  119. // #ifdef H5
  120. import { weixindata } from '@/utils/wxAuthorized';
  121. // #endif
  122. export default {
  123. // #ifdef MP
  124. onShareAppMessage: function(res) {
  125. if (res.from === 'button') {
  126. // 来自页面内分享按钮
  127. let pages = getCurrentPages();
  128. // 获取当前页面
  129. let page = pages[pages.length - 1];
  130. let path = '/' + page.route + '?';
  131. // 保存传值
  132. for (let i in page.options) {
  133. path += i + '=' + page.options[i] + '&';
  134. }
  135. // 保存邀请人
  136. path += 'shopId=' + this.userInfo.store_info.id + '&spread=' + this.userInfo.uid;
  137. let data = {
  138. path: path,
  139. imageUrl: this.userInfo.store_info.image,
  140. title: this.userInfo.store_info.name
  141. };
  142. console.log('data', data);
  143. return data;
  144. }
  145. },
  146. // #endif
  147. data() {
  148. return {
  149. current: 1,
  150. tabbar: tabbar,
  151. tabbar1: tabbar1,
  152. code: '',
  153. achievement: '',
  154. order_count: '',
  155. user_explode: '',
  156. store_info: {},
  157. over: '',
  158. shopNum: '',
  159. productNum: '',
  160. achievement_waiter: '',
  161. store_id: ''
  162. };
  163. },
  164. computed: {
  165. ...mapState(['userInfo'])
  166. },
  167. onLoad(option) {
  168. // this.loadData();
  169. },
  170. // 进入页面刷新数据
  171. onShow() {
  172. this.loadData();
  173. },
  174. methods: {
  175. loadData() {
  176. store({}, this.userInfo.store_id).then(({ data }) => {
  177. this.achievement = data.achievement;
  178. this.order_count = data.order_count;
  179. this.user_explode = data.user_explode;
  180. this.store_info = data.store_info;
  181. this.achievement_waiter = data.achievement_waiter;
  182. console.log(data, '123456');
  183. });
  184. over10000({}).then(e => {
  185. this.over = e.data.count;
  186. console.log(this.over, 111);
  187. });
  188. console.log(this.userInfo.user_rule == 'admin');
  189. if (this.userInfo.user_rule == 'admin') {
  190. store_list({}).then(e => {
  191. this.shopNum = e.data.count;
  192. console.log(this.shopNum, 111);
  193. });
  194. }
  195. product({}).then(e => {
  196. this.productNum = e.data.count;
  197. console.log(this.productNum, 111);
  198. });
  199. },
  200. //调取扫描二维码
  201. sao() {
  202. let obj = this;
  203. // #ifndef H5
  204. uni.scanCode({
  205. success(e) {
  206. obj.code = e.result;
  207. obj.qhx();
  208. // obj.$refs.popuphx.open();
  209. // console.log(obj.$refs.popuphx);
  210. }
  211. });
  212. // #endif
  213. // #ifdef H5
  214. let wx = require('jweixin-module');
  215. wx.scanQRCode({
  216. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  217. scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
  218. success: function(res) {
  219. obj.code = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  220. obj.$refs.popuphx.open();
  221. }
  222. });
  223. // #endif
  224. },
  225. qhx() {
  226. console.log('进入');
  227. h5Auth({}, this.code)
  228. .then(e => {
  229. this.$api.msg('登录成功');
  230. this.close();
  231. })
  232. .catch(e => {
  233. console.log(e);
  234. });
  235. },
  236. //跳转
  237. navTo(url) {
  238. console.log(url, '123456');
  239. uni.navigateTo({
  240. url
  241. });
  242. },
  243. close() {
  244. this.$refs.popuphx.close();
  245. this.code = '';
  246. }
  247. }
  248. };
  249. </script>
  250. <style lang="scss">
  251. page {
  252. height: auto;
  253. min-height: 100%;
  254. background-color: #eeeded;
  255. padding: 0;
  256. margin: 0;
  257. }
  258. // 弹窗
  259. .hx-wrapper {
  260. width: 536rpx;
  261. height: 630rpx;
  262. position: relative;
  263. // background-color: #fff;
  264. .hx-img {
  265. width: 536rpx;
  266. height: 281rpx;
  267. image {
  268. width: 536rpx;
  269. height: 281rpx;
  270. }
  271. }
  272. .hx-close {
  273. position: absolute;
  274. left: 243rpx;
  275. bottom: -80rpx;
  276. width: 52rpx;
  277. height: 52rpx;
  278. image {
  279. width: 52rpx;
  280. height: 52rpx;
  281. }
  282. }
  283. .hx-body {
  284. width: 536rpx;
  285. height: 349rpx;
  286. background-color: #fff;
  287. border-radius: 0 0 10rpx 10rpx;
  288. .hx-title {
  289. width: 536rpx;
  290. font-size: 36rpx;
  291. font-weight: 500;
  292. color: #333333;
  293. line-height: 1;
  294. padding-top: 42rpx;
  295. text-align: center;
  296. }
  297. input {
  298. width: 439rpx;
  299. height: 68rpx;
  300. background: #dbf3e9;
  301. border-radius: 10rpx;
  302. margin: 39rpx auto 0;
  303. padding-left: 26rpx;
  304. .hx-placeholder {
  305. font-size: 26rpx;
  306. font-weight: 500;
  307. color: #ff4c4c;
  308. }
  309. }
  310. .hx-btn {
  311. margin: 44rpx auto 0;
  312. width: 353rpx;
  313. height: 71rpx;
  314. background: #ff4c4c;
  315. border-radius: 34rpx;
  316. font-size: 36rpx;
  317. font-weight: 500;
  318. color: #f8f9f9;
  319. line-height: 71rpx;
  320. text-align: center;
  321. }
  322. }
  323. }
  324. .saoma {
  325. width: 690rpx;
  326. background: #ffffff;
  327. border-radius: 20rpx;
  328. margin: 20rpx auto;
  329. display: flex;
  330. justify-content: space-between;
  331. padding: 24rpx 46rpx;
  332. align-items: center;
  333. .saoma-left {
  334. display: flex;
  335. justify-content: center;
  336. align-items: center;
  337. .saoma-icon {
  338. width: 50rpx;
  339. height: 50rpx;
  340. }
  341. .saoma-font {
  342. margin-left: 20rpx;
  343. font-size: 30rpx;
  344. font-family: PingFang SC;
  345. font-weight: 500;
  346. color: #4d4d4d;
  347. }
  348. }
  349. .saoma-jt {
  350. width: 18rpx;
  351. height: 30rpx;
  352. image {
  353. width: 100%;
  354. height: 100%;
  355. }
  356. }
  357. }
  358. .content {
  359. background-color: #eeeded;
  360. margin: 0 auto;
  361. width: 690rpx;
  362. display: flex;
  363. flex-direction: column;
  364. }
  365. .background {
  366. width: 750rpx;
  367. height: 220rpx;
  368. background-color: #ff4c4c;
  369. }
  370. .vheigh {
  371. height: var(--status-bar-height);
  372. background-color: #ff4c4c;
  373. }
  374. .userInfo {
  375. margin-top: -110rpx;
  376. display: flex;
  377. flex-direction: column;
  378. align-items: center;
  379. background-color: #f9f9f9;
  380. border-radius: 19rpx;
  381. width: 100%;
  382. height: 220rpx;
  383. .userInfo-box {
  384. display: flex;
  385. flex-direction: column;
  386. align-items: center;
  387. .userInfo-img {
  388. margin: -65rpx 0 0 0;
  389. width: 130rpx;
  390. height: 130rpx;
  391. border: 5rpx solid #fff;
  392. border-radius: 50%;
  393. image {
  394. border-radius: 50%;
  395. width: 100%;
  396. height: 100%;
  397. }
  398. }
  399. .userInfo-xinxi {
  400. .title {
  401. margin: 20rpx 0;
  402. font-size: 32rpx;
  403. font-family: PingFang SC;
  404. font-weight: bold;
  405. color: #333333;
  406. text-align: center;
  407. }
  408. .phone {
  409. text-align: center;
  410. font-size: 28rpx;
  411. font-family: PingFang SC;
  412. font-weight: 500;
  413. color: #666666;
  414. line-height: 21rpx;
  415. }
  416. }
  417. .balance {
  418. margin-top: 10rpx;
  419. text-align: center;
  420. width: 500rpx;
  421. height: 60rpx;
  422. background: #ff4c4c;
  423. border-radius: 30rpx;
  424. font-size: 28rpx;
  425. font-family: PingFang SC;
  426. font-weight: 500;
  427. color: #ffffff;
  428. line-height: 60rpx;
  429. }
  430. }
  431. }
  432. .userInfoList {
  433. display: flex;
  434. flex-wrap: wrap;
  435. justify-content: space-between;
  436. .userInfoList-bottom {
  437. margin-bottom: 15rpx;
  438. width: 340rpx;
  439. height: 250rpx;
  440. background: #f9f9f9;
  441. border-radius: 20rpx;
  442. display: flex;
  443. flex-direction: column;
  444. justify-content: center;
  445. align-items: center;
  446. line-height: 1;
  447. .bottom {
  448. .bottom-icon1 {
  449. width: 68rpx;
  450. height: 68rpx;
  451. }
  452. .bottom-icon2 {
  453. width: 60rpx;
  454. height: 68rpx;
  455. }
  456. .bottom-icon3 {
  457. width: 66rpx;
  458. height: 74rpx;
  459. }
  460. .bottom-icon4 {
  461. width: 76rpx;
  462. height: 62rpx;
  463. }
  464. .bottom-icon5 {
  465. width: 56rpx;
  466. height: 52rpx;
  467. }
  468. .bottom-icon6 {
  469. width: 66rpx;
  470. height: 70rpx;
  471. }
  472. .bottom-icon7 {
  473. width: 70rpx;
  474. height: 60rpx;
  475. }
  476. .bottom-icon8 {
  477. width: 74rpx;
  478. height: 52rpx;
  479. }
  480. .bottom-icon9 {
  481. width: 74rpx;
  482. height: 68rpx;
  483. }
  484. .bottom-icon10 {
  485. width: 74rpx;
  486. height: 74rpx;
  487. }
  488. }
  489. .num {
  490. margin-top: 16rpx;
  491. font-size: 30rpx;
  492. font-family: PingFang SC;
  493. font-weight: 500;
  494. color: #333333;
  495. }
  496. .font {
  497. margin-top: 10rpx;
  498. font-size: 26rpx;
  499. font-family: PingFang SC;
  500. font-weight: 500;
  501. color: #4d4d4d;
  502. }
  503. }
  504. }
  505. </style>