page2.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="index">
  3. <view class="index_top">
  4. <view class="image">
  5. <image :src="userinfo.headimgurl" mode="widthFix" style="width: 112rpx;"></image>
  6. </view>
  7. <view class="right">
  8. <view class="title">
  9. {{ userinfo.remark_name | getNickname }}
  10. </view>
  11. <view class="flex">
  12. <view class="level">
  13. {{ userinfo.level | userLevel }}
  14. </view>
  15. <text>{{ userinfo.mobile | getPhone }}</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="index_title">
  20. 招代理情况
  21. </view>
  22. <view style="margin-bottom: 40rpx;">
  23. <view class="li" :class="level != null?'flex1':'flex2'">
  24. <view class="item one">
  25. <text class="bold">{{ data.yestoday | getNum }}</text>
  26. <text>昨日团队新增</text>
  27. </view>
  28. <view class="item two">
  29. <text class="bold">{{ data.month | getNum }}</text>
  30. <text>本月累计新增</text>
  31. </view>
  32. <view class="item three">
  33. <text class="bold">{{ data.year | getNum }}</text>
  34. <text>{{ year }}累计新增</text>
  35. </view>
  36. <view v-show="level != null" class="item four">
  37. <text class="bold">{{ level | getNum }}</text>
  38. <text>昨日新增经理</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="index_title">
  43. 卖货情况
  44. <text>(数据来源: 大卫博士微店)</text>
  45. </view>
  46. <view class="index_box one">
  47. <view class="left">
  48. <image src="../../static/img/1.png" mode="widthFix" style="width: 54rpx;margin-right: 25rpx;"></image>
  49. <text class="">昨日销量</text>
  50. </view>
  51. <view class="right">
  52. <text class="">{{ data.yestoday_oder_num | getNum }}套,{{ data.ye_money | parseMoney }}元</text>
  53. <!-- <image src="../../static/img/right.png" mode="widthFix" style="width: 30rpx;margin-left: 25rpx;"></image> -->
  54. </view>
  55. </view>
  56. <view class="index_box two">
  57. <view class="left">
  58. <image src="../../static/img/2.png" mode="widthFix" style="width: 54rpx;margin-right: 25rpx;"></image>
  59. <text class="">本月销量</text>
  60. </view>
  61. <view class="right">
  62. <text class="">{{ data.month_order_num | getNum }}套,{{ data.mon_money | parseMoney }}元</text>
  63. <!-- <image src="../../static/img/right.png" mode="widthFix" style="width: 30rpx;margin-left: 25rpx;"></image> -->
  64. </view>
  65. </view>
  66. <view class="index_box three">
  67. <view class="left">
  68. <image src="../../static/img/4.png" mode="widthFix" style="width: 54rpx;margin-right: 25rpx;"></image>
  69. <text class="">本年销量</text>
  70. </view>
  71. <view class="right">
  72. <text class="">{{ data.year_order_num | getNum }}套,{{ data.year_money | parseMoney }}元</text>
  73. <!-- <image src="../../static/img/right.png" mode="widthFix" style="width: 30rpx;margin-left: 25rpx;"></image> -->
  74. </view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import { GetUserStoreInfo, GetLevelUp } from '../../api/index.js';
  80. // http://192.168.2.129:8080/#/pages/view/page2?id=7190&time=2021%2F09%2F08%2000%3A00%3A00
  81. export default {
  82. data() {
  83. return {
  84. userinfo: {},
  85. data: {},
  86. id: '',
  87. time: '',
  88. year: '',
  89. level: null
  90. }
  91. },
  92. onLoad() {
  93. this.id = this.$route.query.id
  94. this.time = this.$route.query.time
  95. this.getData()
  96. var date = new Date();
  97. this.year = date.getFullYear(); //获取完整的年份(4位)
  98. },
  99. filters: {
  100. userLevel(level) {
  101. if (!level) return '公司'
  102. let out = ''
  103. switch (+level) {
  104. case 1:
  105. out = '销售主管'
  106. break;
  107. case 2:
  108. out = '销售经理'
  109. break;
  110. case 3:
  111. out = '代理公司'
  112. break;
  113. default:
  114. out = '待定'
  115. }
  116. return out;
  117. },
  118. getPhone(value) {
  119. if (value) {
  120. // var reg = getRegExp('^(\d{3})\d{4}(\d{4})$')
  121. return value.substr(0, 3) + '****' + value.substr(7)
  122. }
  123. },
  124. getNum(value) {
  125. if (value) {
  126. return value
  127. } else {
  128. return 0
  129. }
  130. },
  131. getNickname(value) {
  132. if (value) {
  133. return value.length > 10 ? value.slice(0, 10) + '...' : value;
  134. }
  135. },
  136. parseMoney(money) {
  137. const reg = /(^[1-9][0-9]{0,12}([.][0-9]{0,2})?$)|(^0?(\.[0-9]{0,2})?$)/
  138. if (!money || !reg.test(money)) return '0.00'
  139. money = String(money)
  140. money = money.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
  141. return money
  142. }
  143. },
  144. methods: {
  145. goAdd(num) {
  146. if (num === 0) {
  147. uni.navigateTo({
  148. url: '../query/one?num='+ '昨日新增'
  149. })
  150. } else {
  151. uni.navigateTo({
  152. url: '../query/one?num='+'本月新增'
  153. })
  154. }
  155. },
  156. goShop(num) {
  157. if (num === 0) {
  158. uni.navigateTo({
  159. url: '../query/two?num='+'昨日销量'
  160. })
  161. } else {
  162. uni.navigateTo({
  163. url: '../query/two?num='+'本月销量'
  164. })
  165. }
  166. },
  167. getData() {
  168. // id=39517
  169. GetUserStoreInfo({ id: this.id, time: this.time }).then(res => {
  170. if (res.code === 200) {
  171. this.userinfo = res.data.user
  172. if (!this.userinfo.remark_name) {
  173. this.userinfo.remark_name = this.userinfo.nickname
  174. }
  175. this.data = res.data
  176. } else {
  177. uni.showToast({
  178. title: res.message || '获取失败',
  179. icon: 'none'
  180. })
  181. }
  182. }).catch(err => {})
  183. GetLevelUp({ id: this.id }).then(res => {
  184. if (res.code === 200) {
  185. if (res.data.level_up || res.data.level_up == 0) {
  186. this.level = res.data.level_up
  187. }
  188. } else {
  189. uni.showToast({
  190. title: res.message || '获取失败',
  191. icon: 'none'
  192. })
  193. }
  194. }).catch(err => {})
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .index {
  201. color: #333;
  202. padding: 30rpx 24rpx;
  203. &_top {
  204. height: 112rpx;
  205. display: flex;
  206. align-items: center;
  207. margin-bottom: 44rpx;
  208. .image {
  209. width: 112rpx;
  210. height: 112rpx;
  211. border-radius: 8rpx;
  212. overflow: hidden;
  213. }
  214. .right {
  215. margin-left: 20rpx;
  216. color: #333333;
  217. font-weight: bold;
  218. display: flex;
  219. justify-content: space-between;
  220. flex-direction: column;
  221. .title {
  222. font-size: 40rpx;
  223. }
  224. .flex {
  225. display: flex;
  226. align-items: center;
  227. margin-top: 10rpx;
  228. .level {
  229. width: 116rpx;
  230. height: 42rpx;
  231. background: #D9AE00;
  232. border-radius: 4rpx;
  233. text-align: center;
  234. line-height: 42rpx;
  235. font-size: 24rpx;
  236. color: #FFFFFF;
  237. font-weight: 200;
  238. }
  239. text {
  240. font-size: 30rpx;
  241. margin-left: 20rpx;
  242. }
  243. }
  244. }
  245. }
  246. &_title {
  247. font-size: 38rpx;
  248. font-weight: bold;
  249. line-height: 38rpx;
  250. padding-left: 20rpx;
  251. border-left: 8rpx #FB231F solid;
  252. margin: 30rpx 0;
  253. text {
  254. font-size: 30rpx;
  255. font-weight: 600;
  256. margin-left: 10rpx;
  257. }
  258. }
  259. .flex1 {
  260. display: flex;
  261. justify-content: space-between;
  262. flex-wrap: wrap;
  263. .item {
  264. width: 340rpx;
  265. margin-top: 20rpx;
  266. }
  267. }
  268. .flex2 {
  269. display: flex;
  270. justify-content: space-between;
  271. .item {
  272. width: 218rpx;
  273. }
  274. }
  275. .li {
  276. .item {
  277. height: 148rpx;
  278. border-radius: 8px;
  279. // padding: 14rpx 0;
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. flex-direction: column;
  284. color: #fff;
  285. font-size: 28rpx;
  286. font-weight: 400;
  287. .bold {
  288. font-size: 40rpx;
  289. font-weight: 500;
  290. // font-weight: bold;
  291. margin-bottom: 10rpx;
  292. }
  293. }
  294. .one {
  295. background: linear-gradient(90deg, #5B50FF 0%, #8D3EFF 100%);
  296. }
  297. .two {
  298. background: linear-gradient(93deg, #FF4646 0%, #FF893A 100%);
  299. }
  300. .three {
  301. background: linear-gradient(90deg, #00D59F 0%, #009AD1 100%);
  302. }
  303. .four {
  304. background: linear-gradient(90deg, #FB1A5D 0%, #FF41D1 100%);
  305. }
  306. }
  307. &_box {
  308. // width: 702rpx;
  309. height: 150rpx;
  310. border-radius: 8rpx;
  311. display: flex;
  312. justify-content: space-between;
  313. align-items: center;
  314. font-size: 32rpx;
  315. font-weight: bold;
  316. color: #fff;
  317. padding: 0 30rpx;
  318. margin-bottom: 32rpx;
  319. .left {
  320. display: flex;
  321. align-items: center;
  322. }
  323. .right {
  324. font-weight: 500;
  325. font-size: 36rpx;
  326. }
  327. }
  328. .one {
  329. background: linear-gradient(270deg, #FF30CD 0%, #FF0347 100%);
  330. }
  331. .two {
  332. background: linear-gradient(270deg, #FF3434 0%, #FF6500 100%);
  333. }
  334. .three {
  335. background: linear-gradient(270deg, #9821FF 0%, #FF00B2 100%);
  336. }
  337. .four {
  338. background: linear-gradient(270deg, #10CE9D 0%, #0098DC 100%);
  339. }
  340. }
  341. </style>