index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  1. <template>
  2. <view class="rf-index">
  3. <view class="index">
  4. <view class="header">
  5. <view class="header-warp">
  6. <view class="header-left">
  7. <view class="uni-list">
  8. <view class="uni-list-cell">
  9. <view class="uni-list-cell-db">
  10. <picker @change="bindPickerChange" :value="index" :range="shopArray" range-key="name">
  11. <view class="uni-input" >{{ shopArray[index].name }}</view>
  12. </picker>
  13. <image src="../../static/images/downicon.png" mode="" class="icon"></image>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="header-bar header-center">首页</view>
  19. <view class="header-right">
  20. <image src="../../static/images/seticon.png" mode="" class="icon" @tap="tosetting"></image>
  21. </view>
  22. </view>
  23. <view class="user">
  24. <view class="user-left">
  25. <open-data type="userAvatarUrl" class="usericon"></open-data>
  26. <!-- <image :src="userInfo.avatarUrl" mode="" class="usericon"></image> -->
  27. <view class="message">
  28. <!-- <view class="name">{{userInfo.nickName}}</view> -->
  29. <open-data type="userNickName" class="name"></open-data>
  30. <view class="tele"></view>
  31. </view>
  32. </view>
  33. <view class="user-right" @tap="scanCode">
  34. <image src="../../static/images/scan.png" mode="" class="sacnicon"></image>
  35. <view class="txt">
  36. 验证码核销
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="" style="height: 284upx;"></view>
  42. <!-- 输入框 -->
  43. <view class="input-code">
  44. <input type="text" v-model="ordernum" maxlength="-1" placeholder-style="color:#b8bbbb;font-size:28upx;" class="code" placeholder="请输入验证码核验">
  45. <view class="search" @tap="searchOrder">搜索</view>
  46. </view>
  47. <view class="index-content">
  48. <!-- 关键指数 -->
  49. <view class="exponent">
  50. <view class="title-warp">
  51. <view class="name">
  52. 关键指数
  53. </view>
  54. <view class="time">
  55. 数据截至:2020.07.03 <text class="hour">10:10</text>
  56. </view>
  57. </view>
  58. <view class="exponent-list">
  59. <view class="item seale">
  60. <view class="left">
  61. <view class="title">
  62. 销售总额
  63. </view>
  64. <view class="num">
  65. {{sellSun.num}}
  66. </view>
  67. <view class="ratio">
  68. <view class="detail">
  69. <image src="../../static/images/down.png" class="icon" v-if="sellSun.num < 0">
  70. <image src="../../static/images/up.png" class="icon" v-if="sellSun.num>0"> {{ sellSun.percent }}% <text class="compare">{{ sellSun.status ? '无增长' :'同比上月' }}</text>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="right">
  75. <image src="../../static/images/sealenum.png" mode="" class="logoicon"></image>
  76. </view>
  77. </view>
  78. <view class="item order">
  79. <view class="left">
  80. <view class="title">
  81. 订单总量
  82. </view>
  83. <view class="num">
  84. {{orderSun.num}}
  85. </view>
  86. <view class="ratio">
  87. <view class="detail">
  88. <image src="../../static/images/down.png" class="icon" v-if="orderSun.num < 0">
  89. <image src="../../static/images/up.png" class="icon" v-if="orderSun.num>0"> {{ orderSun.percent }}% <text class="compare">{{ orderSun.status ? '无增长' :'同比上月' }}</text>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="right">
  94. <image src="../../static/images/sealenum.png" mode="" class="logoicon"></image>
  95. </view>
  96. </view>
  97. <view class="item todayseale">
  98. <view class="left">
  99. <view class="title">
  100. 今日销售额
  101. </view>
  102. <view class="num">
  103. {{todaysellSun.num}}
  104. </view>
  105. <view class="ratio">
  106. <view class="detail">
  107. <image src="../../static/images/down.png" class="icon" v-if="todaysellSun.num < 0">
  108. <image src="../../static/images/up.png" class="icon" v-if="todaysellSun.num>0"> {{ todaysellSun.percent }}% <text class="compare">{{ todaysellSun.status ? '无增长' :'同比上月' }}</text>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="right">
  113. <image src="../../static/images/sealenum.png" mode="" class="logoicon"></image>
  114. </view>
  115. </view>
  116. <view class="item todayorder">
  117. <view class="left">
  118. <view class="title">
  119. 今日订单量
  120. </view>
  121. <view class="num">
  122. {{todayorderSun.num}}
  123. </view>
  124. <view class="ratio">
  125. <view class="detail">
  126. <image src="../../static/images/down.png" class="icon" v-if="todayorderSun.num < 0">
  127. <image src="../../static/images/up.png" class="icon" v-if="todayorderSun.num>0"> {{ todayorderSun.percent }}% <text class="compare">{{ todayorderSun.status ? '无增长' :'同比上月' }}</text>
  128. </view>
  129. </view>
  130. </view>
  131. <view class="right">
  132. <image src="../../static/images/sealenum.png" mode="" class="logoicon"></image>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. <!-- 待处理事物 -->
  138. <view class="something">
  139. <view class="title">
  140. 待处理事物
  141. </view>
  142. <view class="todo-list">
  143. <view class="item">
  144. <view class="title">
  145. 待审核店铺
  146. </view>
  147. <view class="num">
  148. {{ pendingData.store }}
  149. </view>
  150. </view>
  151. <view class="item">
  152. <view class="title">
  153. 待审核商品
  154. </view>
  155. <view class="num">
  156. {{ pendingData.shop }}
  157. </view>
  158. </view>
  159. <view class="item">
  160. <view class="title">
  161. 待上架产品
  162. </view>
  163. <view class="num">
  164. {{ pendingData.shelf }}
  165. </view>
  166. </view>
  167. <view class="item">
  168. <view class="title">
  169. 待退款订单
  170. </view>
  171. <view class="num">
  172. {{ pendingData.refund }}
  173. </view>
  174. </view>
  175. <view class="item ">
  176. <view class="title">
  177. 已支付订单
  178. </view>
  179. <view class="num">
  180. {{ pendingData.payorder }}
  181. </view>
  182. </view>
  183. </view>
  184. </view>
  185. <!-- 数据概况 -->
  186. <view class="data">
  187. <view class="qiun-bg-white qiun-title-bar qiun-common-mt">
  188. <view class="qiun-title-dot-light">数据概况</view>
  189. </view>
  190. <!-- 产品销售数量走势 -->
  191. <view class="echarts shopsell">
  192. <view class="title">
  193. <view class="left">
  194. <text class="future">产品销售数量走势:<text class="num">0</text>
  195. <text class="yesterday">昨日全天:<text class="daynum">0</text></text>
  196. </text>
  197. </view>
  198. <view class="right">
  199. <view class="today-icon"></view><text class="title">今日</text>
  200. <view class="yesterday-icon"></view><text class="title">昨日</text>
  201. </view>
  202. </view>
  203. <view class="qiun-charts">
  204. <canvas canvas-id="shopsellEcharts" id="shopsellEcharts" class="shopsellEcharts" disable-scroll=true @touchend="shopSellEndTouch"></canvas>
  205. </view>
  206. </view>
  207. <!-- 产品销售金额走势 -->
  208. <view class="echarts shopmoney">
  209. <view class="title">
  210. <view class="left">
  211. <text class="future">产品销售金额走势:<text class="num">0</text>
  212. <text class="yesterday">昨日全天:<text class="daynum">0</text></text>
  213. </text>
  214. </view>
  215. <view class="right">
  216. <view class="today-icon"></view><text class="title">今日</text>
  217. <view class="yesterday-icon"></view><text class="title">昨日</text>
  218. </view>
  219. </view>
  220. <view class="qiun-charts">
  221. <canvas canvas-id="shopmoneyEcharts" id="shopmoneyEcharts" class="shopmoneyEcharts" @touchstart="shopMoneyTouch"></canvas>
  222. </view>
  223. </view>
  224. <!-- 未来7天预定 -->
  225. <view class="echarts">
  226. <view class="title">
  227. <view class="left">
  228. <text class="future">未来七天预定:<text class="num">0</text>
  229. <text class="yesterday">昨日全天:<text class="daynum">0</text></text>
  230. </text>
  231. </view>
  232. <view class="right">
  233. <view class="today-icon"></view><text class="title">今日</text>
  234. </view>
  235. </view>
  236. <view class="qiun-charts">
  237. <canvas canvas-id="canvasLineA" id="canvasLineA" class="charts" @touchstart="touchLineA"></canvas>
  238. </view>
  239. </view>
  240. </view>
  241. <!-- 商品销售占比 -->
  242. <view class="shop-echarts-warp">
  243. <view class="title">
  244. 商品销售占比
  245. </view>
  246. <view class="shop-echarts">
  247. <canvas canvas-id="shopecharts" id="shopecharts" class="shopecharts" @touchstart="touchPie"></canvas>
  248. </view>
  249. </view>
  250. <view id="testecharts"></view>
  251. <view class="" style="height: 40upx;"></view>
  252. </view>
  253. </view>
  254. <mask :txt="masktxt" :iconShow="iconShow" v-if="isShowMask" @isSureConver="isSureConver"></mask>
  255. <rf-loading v-if="loading"></rf-loading>
  256. </view>
  257. </template>
  258. <script>
  259. import uCharts from '../../js_sdk/u-charts/u-charts/u-charts';
  260. import moment from '@/common/moment';
  261. import mask from '../components/mask'
  262. let _self;
  263. let canvaLineA = null;
  264. let canvaPie = null;
  265. let shopSellLine = null;
  266. let shopMoneyLine = null;
  267. export default {
  268. name: 'Header',
  269. components: {
  270. mask
  271. },
  272. data() {
  273. return {
  274. //用户信息
  275. userInfo:uni.getStorageSync('wechatUserInfo'),
  276. loading: true,
  277. // 遮罩层
  278. isShowMask: false,
  279. iconShow: false,
  280. masktxt:'',
  281. shopArray: [{ name: '全部', id: 0 }],
  282. shopID: 0,
  283. index: 0,
  284. // 商品销售走势
  285. shopwidth: '',
  286. shopheight: '',
  287. // 销售金额走势
  288. moneywidth: '',
  289. moneyheight: '',
  290. // 未来七天
  291. cWidth: '',
  292. cHeight: '',
  293. // 饼图数据
  294. bWidth: '',
  295. bHeight: '',
  296. pixelRatio: 1, // 像素比
  297. ordernum: '', // 订单号
  298. orderMessage: {},
  299. today: moment().format('YYYY-MM-DD'),
  300. // 数据还可以优化
  301. sellSun: {
  302. num: 0,
  303. percent: 0,
  304. status: null,
  305. },
  306. todaysellSun: {
  307. num: 0,
  308. percent: 0,
  309. status: null,
  310. },
  311. orderSun: {
  312. num: 0,
  313. percent: 0,
  314. status: null,
  315. },
  316. todayorderSun: {
  317. num: 0,
  318. percent: 0,
  319. status: null,
  320. },
  321. // 待处理事物
  322. pendingData: {
  323. store: 0,
  324. shop: 0,
  325. shelf: 0,
  326. payorder: 0,
  327. refund: 0,
  328. },
  329. };
  330. },
  331. // 此处定义传入的数据
  332. props: {
  333. shoplist: {
  334. type: Object,
  335. value: null,
  336. },
  337. },
  338. // 页面生命周期 监听页面加载
  339. onLoad() {
  340. _self = this;
  341. this.cWidth = uni.upx2px(690); // upx2px 转换为px
  342. this.cHeight = uni.upx2px(300);
  343. this.bWidth = uni.upx2px(690);
  344. this.bHeight = uni.upx2px(300);
  345. this.getShopList();
  346. this.loading = false;
  347. },
  348. methods: {
  349. // 监听遮罩层行为
  350. isSureConver(e) {
  351. this.isShowMask = false;
  352. this.$mRouter.back()
  353. },
  354. // 扫码订单
  355. scanCode() {
  356. // 允许从相机和相册扫码
  357. uni.scanCode({
  358. success: function (res) {
  359. _self.ordernum = res.result
  360. _self.searchOrder()
  361. },
  362. });
  363. },
  364. // 搜索框根据订单号查询订单
  365. searchOrder() {
  366. if (this.ordernum === '') {
  367. this.$mHelper.toast('请输入正确的订单号进行查询,不能为空!')
  368. return
  369. }
  370. this.$http.get('/orders/getOrdersByNo/'+this.ordernum).then(res=>{
  371. if (res.code === 200 ) {
  372. this.ordernum = ''
  373. if (res.data === "该订单已失效!") {
  374. this.iconShow = false
  375. this.isShowMask = true
  376. this.masktxt = res.data
  377. } else if (res.data === "未查询到该订单,请输入正确的核销码!") {
  378. this.iconShow = false
  379. this.isShowMask = true
  380. this.masktxt = "未查询到该订单,请重新输入!"
  381. } else {
  382. uni.setStorageSync('orderDetail', res.data);
  383. this.$mRouter.push({ route: '/pages/index/conversion' });
  384. }
  385. this.orderMessage = res.data
  386. }
  387. }).catch( error=>{
  388. this.ordernum = ''
  389. })
  390. },
  391. // 选择商铺
  392. bindPickerChange(e) {
  393. this.shopID = null;
  394. this.index = e.detail.value;
  395. this.shopID = this.shopArray[this.index].id;
  396. this.getExponentData();
  397. this.getPendingData();
  398. this.futureDayData();
  399. this.shopSellData();
  400. this.shopSellTrend();
  401. this.shopSellMoneyTrend();
  402. },
  403. // 跳转设置页
  404. tosetting() {
  405. this.$mRouter.push({ route: '/pages/index/setting/setting' });
  406. },
  407. // 获取店铺列表
  408. async getShopList() {
  409. await this.$http.get('/homePage/getShopByMerId').then((res) => {
  410. if (res.data && res.code === 200) {
  411. let newarr = [{ name: '全部', id: 0 }];
  412. this.shopArray = newarr.concat(res.data);
  413. this.getExponentData();
  414. this.getPendingData();
  415. this.shopSellTrend();
  416. this.shopSellMoneyTrend();
  417. this.futureDayData();
  418. this.shopSellData();
  419. }
  420. });
  421. },
  422. // 关键指数
  423. async getExponentData() {
  424. if (this.shopID === 0) {
  425. this.shopID = '';
  426. }
  427. await this.$http
  428. .get('/homePage/gjzs', {
  429. date: this.today,
  430. shopId: this.shopID,
  431. })
  432. .then(async (res) => {
  433. if (res.code === 200 && res.data) {
  434. let todaynum = 0;
  435. let yesnum = 0;
  436. // 销售总额
  437. this.dataDo(res.data.xsze, this.sellSun);
  438. // 今日销售总额
  439. this.dataDo(res.data.jrxxe, this.todaysellSun);
  440. // 订单总量
  441. this.dataDo(res.data.xsze, this.orderSun);
  442. // 今日订单总量
  443. this.dataDo(res.data.xsze, this.todayorderSun);
  444. }
  445. });
  446. },
  447. // 指数数据处理
  448. dataDo(data, itemEle) {
  449. let todaynum = 0;
  450. let yesnum = 0;
  451. data.forEach((element) => {
  452. if (element.time === 'all') {
  453. itemEle.num = (element.num / 100).toFixed(2);
  454. } else if (element.time === 'dy') {
  455. todaynum = element.num;
  456. } else if (element.time === 'sy') {
  457. yesnum = element.num;
  458. }
  459. });
  460. if (yesnum === 0) {
  461. itemEle.percent = 100;
  462. } else {
  463. itemEle.percent = ((todaynum - yesnum) / yesnum).toFixed(2);
  464. }
  465. if (yesnum === todaynum) {
  466. itemEle.percent = 0;
  467. itemEle.status = true;
  468. } else {
  469. itemEle.status = false;
  470. }
  471. return itemEle;
  472. },
  473. // 待处理事物
  474. async getPendingData() {
  475. if (this.shopID === 0) {
  476. this.shopID = '';
  477. }
  478. await this.$http
  479. .get('/homePage/pendingTransaction', {
  480. date: this.today,
  481. shopId: this.shopID,
  482. })
  483. .then(async (res) => {
  484. if (res.data) {
  485. this.pendingData.store = res.data.shopCheck;
  486. this.pendingData.shop = res.data.goodsCheck;
  487. this.pendingData.shelf = res.data.upGoods;
  488. this.pendingData.payorder = res.data.payNum;
  489. this.pendingData.refund = res.data.refundNum;
  490. }
  491. });
  492. },
  493. // 商品销售走势
  494. async shopSellTrend() {
  495. if (this.shopID === 0) {
  496. this.shopI = '';
  497. }
  498. await this.$http
  499. .get('/homePage/getData2', {
  500. date: this.today,
  501. shopId: this.shopID,
  502. })
  503. .then(async (res) => {
  504. if (res.data) {
  505. let shopSellData = {
  506. xdata: [],
  507. jrdata: [],
  508. zrdata: [],
  509. };
  510. res.data.forEach((ele) => {
  511. shopSellData.xdata.push(ele.time);
  512. shopSellData.jrdata.push(ele.jr);
  513. shopSellData.zrdata.push(ele.zr);
  514. });
  515. _self.shopSellEcharts('shopsellEcharts', shopSellData);
  516. }
  517. });
  518. },
  519. shopSellEcharts(id, echartsData) {
  520. shopSellLine = new uCharts({
  521. $this: _self,
  522. canvasId: id,
  523. type: 'line',
  524. fontSize: 12,
  525. legend: {
  526. show: false,
  527. },
  528. dataLabel: true,
  529. duration: 500,
  530. dataPointShape: false, // 折点
  531. background: '#FFFFFF',
  532. pixelRatio: _self.pixelRatio,
  533. categories: echartsData.xdata, // x轴数据
  534. series: [
  535. {
  536. textColor:'#ffcc01',
  537. color: '#ffcc01',
  538. data: echartsData.jrdata,
  539. name: '今日',
  540. pointShape: 'circle',
  541. show: true,
  542. type: 'line',
  543. },
  544. {
  545. color: '#7d66f3',
  546. textColor:'#7d66f3',
  547. data: echartsData.zrdata,
  548. name: '昨日',
  549. pointShape: 'circle',
  550. show: true,
  551. type: 'line',
  552. },
  553. ], // 值
  554. animation: true,
  555. // enableScroll: true,
  556. xAxis: {
  557. type: 'grid',
  558. disableGrid: true,
  559. labelCount: 7
  560. },
  561. yAxis: {
  562. gridType: 'solid',
  563. gridColor: '#cccccc',
  564. min: 0,
  565. max: 180,
  566. data: [
  567. {
  568. axisLine: false,
  569. format: (val) => {
  570. return val.toFixed(0);
  571. },
  572. }],
  573. },
  574. width: _self.cWidth * _self.pixelRatio,
  575. height: _self.cHeight * _self.pixelRatio,
  576. padding: [15,15,4,15],
  577. extra: {
  578. line: {
  579. type: 'curve', // 平滑曲线; straight直线
  580. },
  581. },
  582. });
  583. },
  584. shopSellEndTouch(e) {
  585. shopSellLine.showToolTip(e, {
  586. format: function (item, category) {
  587. return category + ' ' + item.name + ':' + item.data
  588. }
  589. });
  590. },
  591. // 商品销售金额走势
  592. async shopSellMoneyTrend() {
  593. if (this.shopID === 0) {
  594. this.shopI = '';
  595. }
  596. await this.$http
  597. .get('/homePage/getData3', {
  598. date: this.today,
  599. shopId: this.shopID,
  600. })
  601. .then(async (res) => {
  602. if (res.data) {
  603. let shopMoney = {
  604. xdata: [],
  605. jrdata: [],
  606. zrdata: [],
  607. };
  608. res.data.forEach((ele) => {
  609. shopMoney.xdata.push(ele.time);
  610. shopMoney.jrdata.push(ele.jr);
  611. shopMoney.zrdata.push(ele.zr);
  612. });
  613. _self.shopMoneyEcharts('shopmoneyEcharts', shopMoney);
  614. }
  615. });
  616. },
  617. shopMoneyEcharts(id, echartsData) {
  618. shopMoneyLine = new uCharts({
  619. $this: _self,
  620. canvasId: id,
  621. type: 'line',
  622. fontSize: 12,
  623. legend: {
  624. show: false,
  625. },
  626. dataLabel: true, // 图表中是否显示数据
  627. duration: 500,
  628. dataPointShape: false, // 折点
  629. background: '#FFFFFF',
  630. pixelRatio: _self.pixelRatio,
  631. categories: echartsData.xdata, // x轴数据
  632. series: [
  633. {
  634. textColor: '#f79554',
  635. color: '#f79554',
  636. data: echartsData.jrdata,
  637. name: '今日',
  638. pointShape: 'circle',
  639. show: true,
  640. type: 'line',
  641. },
  642. {
  643. color: '#2ad3a1',
  644. textColor: '#2ad3a1',
  645. data: echartsData.zrdata,
  646. name: '昨日',
  647. pointShape: 'circle',
  648. show: true,
  649. type: 'line',
  650. },
  651. ], // 值
  652. animation: true,
  653. xAxis: {
  654. type: 'grid',
  655. disableGrid: true,
  656. labelCount: 7
  657. },
  658. yAxis: {
  659. gridType: 'solid',
  660. gridColor: '#CCCCCC',
  661. min: 0,
  662. max: 180,
  663. data: [{
  664. axisLine: false,
  665. format: (val) => {
  666. return val.toFixed(2);
  667. }
  668. }],
  669. },
  670. width: _self.cWidth * _self.pixelRatio,
  671. height: _self.cHeight * _self.pixelRatio,
  672. padding: [15,15,4,15],
  673. extra: {
  674. line: {
  675. type: 'curve', // 平滑曲线; straight直线
  676. },
  677. },
  678. });
  679. },
  680. shopMoneyTouch(e) {
  681. shopMoneyLine.showToolTip(e, {
  682. format: function (item, category) {
  683. return category + ' ' + item.name + ':' + item.data;
  684. },
  685. });
  686. },
  687. // 未来七天
  688. async futureDayData() {
  689. if (this.shopID === 0) {
  690. this.shopID = '';
  691. }
  692. await this.$http
  693. .get('/homePage/getData0', {
  694. date: this.today,
  695. shopId: this.shopID,
  696. })
  697. .then(async (res) => {
  698. if (res.data) {
  699. let LineA = {
  700. categories: [],
  701. series: [],
  702. };
  703. res.data.forEach((ele) => {
  704. LineA.series.push(ele.num);
  705. LineA.categories.push(ele.date.slice(5));
  706. });
  707. _self.showLineA('canvasLineA', LineA);
  708. }
  709. });
  710. },
  711. // 折线图表
  712. showLineA(canvasId, chartData) {
  713. canvaLineA = new uCharts({
  714. $this: _self,
  715. canvasId: canvasId,
  716. type: 'line',
  717. fontSize: 12,
  718. legend: {
  719. show: false,
  720. },
  721. dataLabel: true, // 图表中是否显示数据
  722. duration: 500,
  723. dataPointShape: false, // 折点
  724. background: '#FFFFFF',
  725. pixelRatio: _self.pixelRatio,
  726. categories: chartData.categories, // x轴数据
  727. series: [
  728. {
  729. color: '#ffcc01',
  730. data: chartData.series,
  731. name: '人次',
  732. pointShape: 'circle',
  733. show: true,
  734. type: 'line',
  735. },
  736. ], // 值
  737. animation: true,
  738. xAxis: {
  739. type: 'grid',
  740. disableGrid: true,
  741. },
  742. yAxis: {
  743. gridType: 'solid',
  744. gridColor: '#CCCCCC',
  745. min: 0,
  746. max: 180,
  747. data: [{
  748. axisLine: false,
  749. format: (val) => {
  750. return val.toFixed(0);
  751. },
  752. }],
  753. },
  754. width: _self.cWidth * _self.pixelRatio,
  755. height: _self.cHeight * _self.pixelRatio,
  756. padding: [15,15,4,15],
  757. extra: {
  758. line: {
  759. type: 'curve', // 平滑曲线; straight直线
  760. },
  761. },
  762. });
  763. },
  764. touchLineA(e) {
  765. canvaLineA.showToolTip(e, {
  766. format: function (item, category) {
  767. return category + ' ' + item.name + ':' + item.data;
  768. },
  769. });
  770. },
  771. // 商品销售占比
  772. async shopSellData() {
  773. await this.$http
  774. .get('/homePage/getData1', {
  775. // date: this.today,
  776. date: '2020-07-28',
  777. shopId: this.shopID
  778. })
  779. .then(async (res) => {
  780. let pie = {
  781. series: [],
  782. };
  783. if (res.data.length > 0) {
  784. for (let i = 0; i < res.data.length; i++) {
  785. let element = res.data[i];
  786. pie.series.push({name: element.name, data: element.value})
  787. }
  788. _self.showPie('shopecharts', pie);
  789. } else {
  790. pie.series = [{ name: '无数据', data: 0 }];
  791. _self.showPie('shopecharts', pie);
  792. }
  793. });
  794. },
  795. // 饼图
  796. showPie(canvasId, chartData) {
  797. canvaPie = new uCharts({
  798. $this: _self,
  799. colors: ['#FFBC3C', '#F25051', '#FE7DDE', '#4880FF', '#47EDFB'],
  800. canvasId: canvasId,
  801. type: 'pie',
  802. fontSize: 12,
  803. legend: {
  804. show: true,
  805. position: 'left',
  806. float: 'center',
  807. itemGap: 10,
  808. padding: 5,
  809. lineHeight: 20,
  810. margin: 5,
  811. borderWidth: 1,
  812. },
  813. background: '#FFFFFF',
  814. pixelRatio: _self.pixelRatio,
  815. series: chartData.series,
  816. animation: true,
  817. width: _self.bWidth * _self.pixelRatio,
  818. height: _self.bHeight * _self.pixelRatio,
  819. dataLabel: true,
  820. extra: {
  821. pie: {
  822. lableWidth: 15,
  823. },
  824. },
  825. });
  826. },
  827. touchPie(e) {
  828. canvaPie.showToolTip(e, {
  829. format: function (item) {
  830. return item.name + ':' + item.data;
  831. },
  832. });
  833. },
  834. },
  835. };
  836. </script>
  837. <style lang="scss" scoped>
  838. .header {
  839. width: 100%;
  840. padding: 0 30rpx;
  841. background-color: $barColor;
  842. position: fixed;
  843. top: 0;
  844. box-sizing: border-box;
  845. z-index: 99;
  846. .header-warp {
  847. display: flex;
  848. height: 80rpx;
  849. color: #231726;
  850. background-color: #ffcc01;
  851. position: relative;
  852. .header-left {
  853. position: absolute;
  854. font-size: 28rpx;
  855. .uni-list:after {
  856. border-color: transparent;
  857. }
  858. .uni-list-cell-db {
  859. height: 80rpx;
  860. font-size: 28rpx;
  861. display: flex;
  862. justify-content: center;
  863. align-items: center;
  864. background-color: $barColor;
  865. .icon {
  866. width: 17rpx;
  867. height: 12rpx;
  868. margin-left: 10rpx;
  869. }
  870. }
  871. }
  872. .header-center {
  873. flex: 1;
  874. font-size: 36rpx;
  875. font-weight: 700;
  876. text-align: center;
  877. line-height: 80rpx;
  878. }
  879. .header-right {
  880. position: absolute;
  881. right: 0;
  882. top: 50%;
  883. margin-top: -20upx;
  884. .icon {
  885. width: 40rpx;
  886. height: 40rpx;
  887. }
  888. }
  889. }
  890. .user {
  891. padding: 30upx 30upx 75upx;
  892. display: flex;
  893. justify-content: space-between;
  894. align-items: center;
  895. .user-left {
  896. display: flex;
  897. justify-content: center;
  898. align-items: center;
  899. .usericon {
  900. width: 100upx;
  901. height: 100upx;
  902. border-radius: 50%;
  903. background-color: #ffffff;
  904. overflow: hidden;
  905. }
  906. .message {
  907. margin-left: 32rpx;
  908. color: #2c1b0a;
  909. .name {
  910. font-size: 30rpx;
  911. font-weight: 700;
  912. }
  913. .tele {
  914. font-size: 24rpx;
  915. }
  916. }
  917. }
  918. .user-right {
  919. display: flex;
  920. justify-content: center;
  921. align-items: center;
  922. flex-direction: column;
  923. .sacnicon {
  924. width: 40rpx;
  925. height: 40rpx;
  926. }
  927. .txt {
  928. font-size: 24rpx;
  929. margin-top: 20rpx;
  930. }
  931. }
  932. }
  933. }
  934. .input-code {
  935. position: fixed;
  936. left: 50%;
  937. margin-left: -344upx;
  938. top: 234upx;
  939. background-color: #fff;
  940. width: 686upx;
  941. padding: 0 38upx;
  942. box-shadow: 0 10upx 10upx rgba($color: #f4f4f4, $alpha: 0.1);
  943. z-index: 100;
  944. border-radius: 10upx;
  945. box-sizing: border-box;
  946. display: flex;
  947. justify-content: space-between;
  948. align-items: center;
  949. .code {
  950. flex: 1;
  951. height: 100upx;
  952. }
  953. .search {
  954. width: 60upx;
  955. height: 100upx;
  956. line-height: 100upx;
  957. font-size: 28upx;
  958. color: #ffcd00;
  959. margin-left: 20upx;
  960. }
  961. }
  962. .index {
  963. background-color: #fafafa;
  964. .index-content {
  965. padding: 85upx 33rpx;
  966. .exponent {
  967. .title-warp {
  968. display: flex;
  969. justify-content: space-between;
  970. align-items: center;
  971. padding: 30rpx 0;
  972. .name {
  973. font-size: 32rpx;
  974. font-weight: 700;
  975. }
  976. .time {
  977. font-size: 24rpx;
  978. color: #191919;
  979. .hour {
  980. margin-left: 15rpx;
  981. }
  982. }
  983. }
  984. .exponent-list {
  985. display: flex;
  986. flex-wrap: wrap;
  987. .item {
  988. width: 320rpx;
  989. border-radius: 10rpx;
  990. color: #ffffff;
  991. display: flex;
  992. justify-content: space-between;
  993. align-items: center;
  994. padding: 25rpx;
  995. box-sizing: border-box;
  996. margin-bottom: 32rpx;
  997. &:nth-child(odd) {
  998. margin-right: 44rpx;
  999. }
  1000. &:nth-child(3),
  1001. &:nth-child(4) {
  1002. margin-bottom: 0;
  1003. }
  1004. .left {
  1005. .title {
  1006. font-size: 24rpx;
  1007. }
  1008. .num {
  1009. font-size: 36rpx;
  1010. font-weight: 700;
  1011. margin-top: 5rpx;
  1012. }
  1013. .ratio {
  1014. margin-top: 10rpx;
  1015. font-size: 20rpx;
  1016. .detail {
  1017. display: flex;
  1018. justify-content: center;
  1019. align-items: center;
  1020. .icon {
  1021. width: 12rpx;
  1022. height: 16rpx;
  1023. margin-right: 5rpx;
  1024. }
  1025. .compare {
  1026. margin-left: 10rpx;
  1027. font-size: 20rpx;
  1028. }
  1029. }
  1030. }
  1031. }
  1032. .right {
  1033. width: 90rpx;
  1034. height: 90rpx;
  1035. border-radius: 50%;
  1036. background-color: rgba($color: #ffffff, $alpha: 0.2);
  1037. display: flex;
  1038. justify-content: center;
  1039. align-items: center;
  1040. .logoicon {
  1041. width: 44rpx;
  1042. height: 53rpx;
  1043. }
  1044. }
  1045. }
  1046. .seale {
  1047. background-image: linear-gradient(to top right, #e379d0, #f767b1);
  1048. }
  1049. .order {
  1050. background-image: linear-gradient(to top right, #f38867, #fca43d);
  1051. }
  1052. .todayseale {
  1053. background-image: linear-gradient(to top right, #9859fd, #d98afa);
  1054. }
  1055. .todayorder {
  1056. background-image: linear-gradient(to top right, #17c1b1, #40e98f);
  1057. }
  1058. }
  1059. }
  1060. .something {
  1061. margin-top: 30rpx;
  1062. .title {
  1063. font-size: 32rpx;
  1064. font-weight: 700;
  1065. color: $titleColor;
  1066. }
  1067. .todo-list {
  1068. display: flex;
  1069. // justify-content: center;
  1070. align-items: center;
  1071. flex-wrap: wrap;
  1072. margin-top: 30rpx;
  1073. background-color: #ffffff;
  1074. box-sizing: border-box;
  1075. padding: 43rpx 30rpx;
  1076. border-radius: 10rpx;
  1077. .item {
  1078. width: 33.33%;
  1079. display: flex;
  1080. justify-content: center;
  1081. align-items: center;
  1082. flex-direction: column;
  1083. margin-bottom: 30upx;
  1084. .title {
  1085. color: $subheadColor;
  1086. font-size: 30rpx;
  1087. }
  1088. .num {
  1089. color: $titleColor;
  1090. }
  1091. }
  1092. }
  1093. }
  1094. .data {
  1095. margin-top: 40rpx;
  1096. .echarts {
  1097. background-color: #ffffff;
  1098. border-radius: 10rpx;
  1099. margin-bottom: 30upx;
  1100. }
  1101. .title {
  1102. display: flex;
  1103. justify-content: space-between;
  1104. color: #333333;
  1105. padding-top: 30rpx;
  1106. padding-left: 15rpx;
  1107. padding-bottom: 30rpx;
  1108. box-sizing: border-box;
  1109. .left {
  1110. .future {
  1111. font-size: 28rpx;
  1112. .num {
  1113. font-size: 30rpx;
  1114. }
  1115. .yesterday {
  1116. margin-left: 10rpx;
  1117. }
  1118. }
  1119. }
  1120. .right {
  1121. display: flex;
  1122. justify-content: center;
  1123. align-items: center;
  1124. box-sizing: border-box;
  1125. .today-icon {
  1126. width: 20rpx;
  1127. height: 9rpx;
  1128. background-color: #ff9c2f;
  1129. margin-right: 10rpx;
  1130. }
  1131. .title {
  1132. font-size: 20rpx;
  1133. margin-right: 20rpx;
  1134. }
  1135. .yesterday-icon {
  1136. width: 20rpx;
  1137. height: 9rpx;
  1138. background-color: #b15cfa;
  1139. margin-left: 10rpx;
  1140. }
  1141. .title {
  1142. font-size: 20rpx;
  1143. }
  1144. }
  1145. }
  1146. .qiun-title-dot-light {
  1147. color: $titleColor;
  1148. font-size: 32rpx;
  1149. font-weight: 700;
  1150. padding-bottom: 25rpx;
  1151. }
  1152. /* 样式的width和height一定要与定义的cWidth和cHeight相对应 */
  1153. .qiun-charts {
  1154. width: 690rpx;
  1155. height: 300rpx;
  1156. }
  1157. .charts {
  1158. width: 690rpx;
  1159. height: 300rpx;
  1160. }
  1161. .shopsell {
  1162. .shopsellEcharts {
  1163. width: 690rpx;
  1164. height: 300rpx;
  1165. }
  1166. }
  1167. .shopmoney {
  1168. .shopmoneyEcharts {
  1169. width: 690rpx;
  1170. height: 300rpx;
  1171. }
  1172. }
  1173. }
  1174. .shop-echarts-warp {
  1175. background-color: #ffffff;
  1176. border-radius: 10rpx;
  1177. margin-top: 40rpx;
  1178. .title {
  1179. padding: 40rpx 24rpx 30rpx;
  1180. font-size: 26rpx;
  1181. color: $titleColor;
  1182. }
  1183. .shop-echarts {
  1184. width: 690rpx;
  1185. height: 300rpx;
  1186. }
  1187. .shopecharts {
  1188. width: 690rpx;
  1189. height: 300rpx;
  1190. }
  1191. }
  1192. }
  1193. }
  1194. </style>