index.vue 12 KB

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