index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. <template>
  2. <view class="index">
  3. <view class="head">
  4. <!-- 顶部状态栏占位 -->
  5. <view class="top"></view>
  6. <!-- 头部内容 -->
  7. <view class="header" @click="shopDetails">
  8. <view class="logo">
  9. <image :src="logo?logo:'/static/index/address.png'" mode=""></image>
  10. </view>
  11. {{ name }}
  12. <image src="/static/index/down.png" mode=""></image>
  13. </view>
  14. <view class="data_box">
  15. <view class="title" @click="scanRecordaa">
  16. 今日概况
  17. </view>
  18. <view class="data">
  19. <view class="item">
  20. <span>{{ numberOrders }}</span>订单数
  21. </view>
  22. <view class="item">
  23. <span>{{ turnover }}</span>营业总额(元)
  24. </view>
  25. <view class="item" @click="goUser">
  26. <span>{{ newCustomer || 0 }}</span>新客
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="head-back">
  32. <image src="/static/index/top-back.png" mode="widthFix"></image>
  33. </view>
  34. <view class="service">
  35. <view class="main">
  36. <view class="left">
  37. <view class="scan blue" @click="scanRecord">
  38. <view class="">
  39. <span>核销记录</span><br />
  40. 查看历史核销记录<u-icon name="arrow-right" ></u-icon>
  41. </view>
  42. <view class="back">
  43. <image src="/static/index/recores-back.png" mode=""></image>
  44. </view>
  45. <image src="/static/index/scan.png" mode=""></image>
  46. </view>
  47. <view class="scan green" @click="goOrder">
  48. <view class="">
  49. <span>售卖订单</span><br />
  50. 查看历史订单记录<u-icon name="arrow-right" ></u-icon>
  51. </view>
  52. <view class="back">
  53. <image src="/static/index/order-back.png" mode=""></image>
  54. </view>
  55. <image src="/static/index/order.png" mode=""></image>
  56. </view>
  57. </view>
  58. <view class="right" @click="scan">
  59. <span>核销扫码</span><br />
  60. 扫一扫快速核销<u-icon name="arrow-right" style="margin-left: 10rpx;"></u-icon>
  61. <view class="back">
  62. <image src="/static/index/scan-back.png" mode=""></image>
  63. </view>
  64. <image src="/static/index/records.png" mode=""></image>
  65. </view>
  66. </view>
  67. <view class="other">
  68. <indexNav />
  69. </view>
  70. </view>
  71. <!-- 完善信息弹窗,storeStatus == 3 (店铺已经审核通过 ) -->
  72. <checkPopup :status="storeStatus" :describe="describe" :referenceId="referenceId" @cutPopup="isPopup = false"
  73. v-if="isPopup" />
  74. <!-- <view class="message">
  75. <view class="title">
  76. 实时消息
  77. </view>
  78. <view class="msg">
  79. <view class="item" v-for="(item,index) in msg" :key="index">
  80. <view class="type">
  81. <view class="img">
  82. <image src="/static/index/deal.png" mode="" v-if="item.msgType=='1'"></image>
  83. <image src="/static/index/verify.png" mode="" v-if="item.msgType=='2'"></image>
  84. <image src="/static/index/client.png" mode="" v-if="item.msgType=='3'"></image>
  85. <image src="/static/index/system.png" mode="" v-if="item.msgType=='4'"></image>
  86. <span v-if="item.msgType=='1'">交易信息</span>
  87. <span v-if="item.msgType=='2'">产品核销</span>
  88. <span v-if="item.msgType=='3'">客户评价</span>
  89. <span v-if="item.msgType=='4'">系统消息</span>
  90. </view>
  91. <view class="time">
  92. {{item.msgDate}}
  93. </view>
  94. </view>
  95. <view class="details">
  96. {{item.msgContent}}
  97. </view>
  98. </view>
  99. </view>
  100. </view> -->
  101. </view>
  102. </template>
  103. <script>
  104. import indexNav from "@/components/index_nav.vue";
  105. import checkPopup from "@/components/check-popup.vue";
  106. export default {
  107. components: {
  108. indexNav,
  109. checkPopup,
  110. },
  111. data() {
  112. return {
  113. numberOrders: "", //订单
  114. newCustomer: "", //新客
  115. turnover: "", //营业总额
  116. name: "",
  117. num: 222,
  118. msg: [],
  119. merchantId: "",
  120. storeStatus: 0, //商户店铺设置状态
  121. userId: "", //用户id
  122. describe: "", //描述
  123. isPopup: false, //弹窗是否出现
  124. referenceId: "", //邀请码
  125. logo: ''
  126. };
  127. },
  128. onLoad: function() {
  129. this.PageCur = "home";
  130. ++this.commponent1Key;
  131. ++this.commponent2Key;
  132. },
  133. methods: {
  134. NavChange: function(e) {
  135. this.PageCur = e.currentTarget.dataset.cur;
  136. },
  137. //新客
  138. goUser() {
  139. uni.navigateTo({
  140. url: "/pages/index/userControl",
  141. });
  142. },
  143. //扫码核销
  144. scan() {
  145. uni.navigateTo({
  146. url: "/pages/scan/manual",
  147. });
  148. },
  149. goOrder(){
  150. uni.switchTab({
  151. url:'/pages/order/index'
  152. })
  153. },
  154. //跳转至门店详情页
  155. shopDetails() {
  156. uni.navigateTo({
  157. url: "/pages/index/shop",
  158. });
  159. },
  160. scanRecord() {
  161. uni.navigateTo({
  162. url: "/pages/scan/record",
  163. });
  164. },
  165. scanRecordaa() {
  166. // uni.navigateTo({
  167. // url: '/pages/login/login'
  168. // })
  169. },
  170. gettodayData() {
  171. this.$http
  172. .get("/merchant/account/todayOverview", {})
  173. .then((res) => {
  174. if (res.data.code == 200) {
  175. this.turnover = res.data.result.turnover;
  176. this.numberOrders = res.data.result.numberOrders;
  177. this.newCustomer = res.data.result.newCustomer;
  178. }
  179. });
  180. },
  181. getMessage() {
  182. this.$http
  183. .get("/merchant/app/home/realMessage?merchantId=" + this.merchantId, {})
  184. .then((res) => {
  185. if (res.data.code == 200) {
  186. this.msg = res.data.result.records;
  187. // this.income = res.data.result.income
  188. // this.newCustomer = res.data.result.newCustomer
  189. // this.numberOrders = res.data.result.numberOrders
  190. }
  191. });
  192. },
  193. // getNum 已合并到 gettodayData,新客由 /merchant/account/todayOverview 返回
  194. getNum() {},
  195. //获取商户是否完善店铺信息
  196. getStroeStatus() {
  197. this.$http
  198. .get("/merchant/app/checkMerchantInfo?userId=" + this.userId)
  199. .then((res) => {
  200. if (res.data.code == 200) {
  201. //message == 3(审核已通过)
  202. if (res.data.result != 3) {
  203. this.storeStatus = res.data.result;
  204. this.describe = res.data.message;
  205. // this.referenceId = res.data.result.referenceId
  206. res.data.result == 3 ?
  207. (this.isPopup = false) :
  208. (this.isPopup = true);
  209. uni.hideTabBar();
  210. }
  211. }
  212. });
  213. },
  214. },
  215. mounted() {
  216. // let info =
  217. let that = this;
  218. },
  219. onShow() {
  220. let that = this;
  221. uni.getStorage({
  222. key: "login_user_info",
  223. success: function(res) {
  224. console.log(res);
  225. that.name = res.data.merchantName;
  226. that.merchantId = res.data.merchantId;
  227. that.userId = res.data.id;
  228. that.logo = res.data.merchantHeadPhoto;
  229. that.gettodayData();
  230. that.getMessage();
  231. that.getNum();
  232. that.getStroeStatus();
  233. },
  234. });
  235. },
  236. };
  237. </script>
  238. <style scoped lang="scss">
  239. .index {
  240. width: 100vw;
  241. height: 100vh;
  242. background: #F2F3F5;
  243. z-index: 1;
  244. .head-back {
  245. position: fixed;
  246. top: 0;
  247. left: 0;
  248. width: 100%;
  249. // height: 100%;
  250. z-index: 1;
  251. image {
  252. width: 100%;
  253. height: 100%;
  254. // object-fit: cover;
  255. }
  256. }
  257. .head {
  258. width: 100%;
  259. height: auto;
  260. position: relative;
  261. overflow: hidden;
  262. z-index: 2;
  263. .top {
  264. width: 100%;
  265. height: var(--status-bar-height);
  266. background-color: transparent;
  267. }
  268. .header {
  269. width: 100%;
  270. height: 56rpx;
  271. display: flex;
  272. align-items: center;
  273. padding: 0px 32rpx;
  274. font-size: 32rpx;
  275. font-weight: 600;
  276. position: relative;
  277. z-index: 10;
  278. // margin-top: 44rpx;
  279. .logo {
  280. width: 56rpx;
  281. height: 56rpx;
  282. border-radius: 50%;
  283. overflow: hidden;
  284. margin-right: 10rpx;
  285. image {
  286. width: 56rpx;
  287. height: 56rpx;
  288. margin: 0;
  289. }
  290. }
  291. image {
  292. width: 25rpx;
  293. height: 25rpx;
  294. margin-left: 10rpx;
  295. }
  296. }
  297. .data_box {
  298. width: 686rpx;
  299. height: 180rpx;
  300. margin: 36rpx auto 16rpx;
  301. background: #ffffff;
  302. box-shadow: 0px 2rpx 8rpx 0px rgba(214, 225, 237, 0.1);
  303. border-radius: 16rpx;
  304. position: relative;
  305. z-index: 19;
  306. .title {
  307. display: flex;
  308. align-items: center;
  309. width: 100%;
  310. height: 53rpx;
  311. font-size: 26rpx;
  312. color: #86909C;
  313. padding: 18rpx;
  314. image {
  315. width: 40rpx;
  316. height: 40rpx;
  317. margin-left: 10rpx;
  318. }
  319. }
  320. .data {
  321. display: flex;
  322. justify-content: space-around;
  323. align-items: center;
  324. padding: 20rpx 0px;
  325. .item {
  326. display: flex;
  327. flex-direction: column;
  328. justify-content: space-around;
  329. align-items: center;
  330. font-size: 24rpx;
  331. line-height: 28rpx;
  332. color: #86909C;
  333. span {
  334. height: 62rpx;
  335. color: #333;
  336. font-size: 48rpx;
  337. font-weight: 600;
  338. line-height: 56rpx;
  339. }
  340. }
  341. }
  342. }
  343. }
  344. .service {
  345. width: 686rpx;
  346. // height: 468rpx;
  347. box-shadow: 0px 2rpx 8rpx 0px rgba(214, 225, 237, 0.1);
  348. border-radius: 16rpx;
  349. margin: 0 auto;
  350. .main {
  351. height: auto;
  352. display: flex;
  353. justify-content: space-between;
  354. margin-bottom: 16rpx;
  355. align-items: stretch;
  356. background: #FFFFFF;
  357. padding: 20rpx;
  358. border-radius: 20rpx;
  359. .left {
  360. flex: 1;
  361. margin-right: 22rpx;
  362. height: 340rpx;
  363. display: flex;
  364. flex-direction: column;
  365. justify-content: space-between;
  366. .scan {
  367. font-size: 20rpx;
  368. font-weight: 600;
  369. width: 352rpx;
  370. height: 160rpx;
  371. padding: 10rpx 12rpx 16rpx 28rpx;
  372. display: flex;
  373. justify-content: space-between;
  374. align-items: center;
  375. position: relative;
  376. z-index: 2;
  377. border-radius: 8rpx;
  378. overflow: hidden;
  379. .back {
  380. width: 100%;
  381. height: 100%;
  382. position: absolute;
  383. bottom: 0;
  384. right: 0;
  385. z-index: -1;
  386. image {
  387. width: 100%;
  388. height: 100%;
  389. }
  390. }
  391. span {
  392. font-size: 32rpx;
  393. }
  394. image {
  395. width: 138rpx;
  396. height: 134rpx;
  397. }
  398. }
  399. .scan.blue {
  400. color: #197FFD;
  401. margin-bottom: 22rpx;
  402. }
  403. .scan.green {
  404. color: #14C584;
  405. background: #E7FFF7;
  406. }
  407. }
  408. .right {
  409. width: 272rpx;
  410. height: 340rpx;
  411. color: #624FE3;
  412. font-size: 20rpx;
  413. padding: 28rpx;
  414. background: #F6F4FF;
  415. position: relative;
  416. z-index: 2;
  417. border-radius: 8rpx;
  418. overflow: hidden;
  419. .back {
  420. width: 100%;
  421. height: 100%;
  422. position: absolute;
  423. bottom: 0;
  424. right: 0;
  425. z-index: -1;
  426. image {
  427. width: 100%;
  428. height: 100%;
  429. }
  430. }
  431. span {
  432. font-weight: 600;
  433. font-size: 32rpx;
  434. margin-bottom: 10rpx;
  435. }
  436. image {
  437. width: 182rpx;
  438. height: 214rpx;
  439. margin: 8rpx auto 0;
  440. }
  441. }
  442. }
  443. .other{
  444. width: 100%;
  445. height: 304rpx;
  446. padding: 32rpx ;
  447. background: #FFFFFF;
  448. border-radius: 16rpx;
  449. }
  450. }
  451. .message {
  452. width: 676rpx;
  453. padding: 20rpx 16rpx;
  454. margin: 20rpx auto 0px;
  455. background: linear-gradient(0, #ffffff 0%, #e2efff 100%);
  456. border-radius: 16rpx;
  457. .title {
  458. width: 100%;
  459. height: 53rpx;
  460. display: flex;
  461. align-items: center;
  462. margin-bottom: 20rpx;
  463. }
  464. .msg {
  465. width: 100%;
  466. .item {
  467. width: 100%;
  468. border-bottom: 1px solid #dddddd;
  469. margin-bottom: 20rpx;
  470. .type {
  471. width: 100%;
  472. height: 38rpx;
  473. display: flex;
  474. align-items: center;
  475. justify-content: space-between;
  476. margin-bottom: 8rpx;
  477. .img {
  478. font-size: 26rpx;
  479. font-weight: 600;
  480. display: flex;
  481. align-items: center;
  482. image {
  483. width: 30rpx;
  484. height: 30rpx;
  485. margin-right: 8rpx;
  486. }
  487. }
  488. .time {
  489. font-size: 22rpx;
  490. color: #999999;
  491. }
  492. }
  493. .details {
  494. font-size: 22rpx;
  495. color: #999999;
  496. margin-bottom: 16rpx;
  497. }
  498. }
  499. }
  500. }
  501. }
  502. </style>