slimming.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <view class="app">
  3. <view id="app-top">
  4. <view class="app-body">
  5. <!--关键词搜索-->
  6. <view class="sreach fx-r fx-bc fx-ac">
  7. <image class="icon" src="/static/img/tb-seach.png"></image>
  8. <input type="text" v-model="keyword" placeholder="请输入用户昵称/用户ID"
  9. placeholder-style="color: #B3B3B3;" />
  10. <view class="fx-g1"></view>
  11. <view class="search-btn" @tap="tapSerach">搜索</view>
  12. </view>
  13. </view>
  14. <view class="app-inner">
  15. <view class="pannel">
  16. <view class="status fx-r">
  17. <view class="people fx-r fx-bc fx-ac" @tap="isShowTime = true">
  18. <image src="/static/img/gz_yy.png"></image>
  19. <view class="label">检索日期:</view>
  20. <view class="value">
  21. <uni-datetime-picker :border="false" type="daterange" start="2023-01-01" :end="endTime"
  22. rangeSeparator="至" @change="tapDateTime" v-model="datetime">
  23. {{ utils.date('m月d日',utils.strtotime(datetime[0])) }}/
  24. {{ utils.date('m月d日',utils.strtotime(datetime[1])) }}
  25. </uni-datetime-picker>
  26. </view>
  27. </view>
  28. <view class="fx-g1"></view>
  29. <view class="search-tm fx-r fx-bc fx-ac" @tap="tapCg">
  30. <view class="text">{{ gzItem.id == 0 ? '全部场馆' : gzItem.nickname }}</view>
  31. <uv-icon name="arrow-down" class="icon"></uv-icon>
  32. </view>
  33. </view>
  34. <view class="panel-info fx-r">
  35. <view class="item">
  36. <view class="count">{{ total.count || 0 }}</view>
  37. <view class="label">瘦身单数</view>
  38. </view>
  39. <view class="line"></view>
  40. <view class="item">
  41. <view class="count">{{ total.price || 0 }}</view>
  42. <view class="label">瘦身金额</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <scroll-view scroll-y class="scroll" :style="'height: calc(100vh - ' + hFoot + 'px - ' + barheight + 'px);'"
  49. @scrolltolower="loadMoreData">
  50. <view class="sc-body">
  51. <view class="item" v-for="item in listAr">
  52. <view class="info fx-r fx-bc">
  53. <view class="nickname">{{ item.nickname }}({{ item.auction_name }})</view>
  54. <view class="fx-r fx-bc" @tap="tapCall(item.mobile)">
  55. <view class="mobile">{{ item.mobile }}</view>
  56. <image src="/static/img/call-tel.png" style="width: 15px;height: 15px;margin-left: 5px;">
  57. </image>
  58. </view>
  59. </view>
  60. <view class="info fx-r">
  61. <view class="id">ID号:{{ item.uid }}</view>
  62. <view class="fx-g1"></view>
  63. <view class="changci">订单编号:{{ item.order_id }}</view>
  64. </view>
  65. <view class="info fx-r">
  66. <view class="id">瘦身时间:{{ item.time }}</view>
  67. </view>
  68. <view class="infos fx-r">
  69. <view class="time">原价格:<text style="color: red;">{{ item.price }}</text></view>
  70. <view class="fx-g1"></view>
  71. <view class="time">瘦身后:<text style="color: red;">{{ item.new_price }}</text></view>
  72. </view>
  73. </view>
  74. <view v-if="listAr.length > 0">
  75. <view class="loading fx-r fx-ac fx-bc" v-if="page.isFrite && !page.isFoot">
  76. <image src="/static/img/xloading.png"></image>
  77. <text>正在载入更多...</text>
  78. </view>
  79. <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
  80. </view>
  81. <view v-if="listAr.length == 0 && isFirst">
  82. <uv-empty mode="data" icon="/static/img/no-empty.png"></uv-empty>
  83. </view>
  84. </view>
  85. </scroll-view>
  86. <uv-popup ref='slimPopup' @close="closePopup()">
  87. <scroll-view style="height: 40vh;background: #fff;">
  88. <view class="pop-info">
  89. <view class="item ihover" @tap="tapGzItem(item)" v-for="item in gzData">{{ item.nickname }}</view>
  90. </view>
  91. </scroll-view>
  92. </uv-popup>
  93. </view>
  94. </template>
  95. <script>
  96. import dayjs from 'dayjs';
  97. import {
  98. mapState,
  99. mapMutations
  100. } from 'vuex';
  101. export default {
  102. computed: mapState(['user']),
  103. data() {
  104. return {
  105. isFirst: false,
  106. listAr: [],
  107. keyword: "",
  108. id: 0,
  109. hFoot: 0,
  110. barheight: 0,
  111. datetime: ["", ""],
  112. total: {},
  113. isShowTime: false,
  114. page: {
  115. isFirst: false,
  116. isLoad: false,
  117. isFoot: false,
  118. page: 1
  119. },
  120. gzData: [],
  121. gzItem: {
  122. name: "",
  123. id: 0
  124. },
  125. }
  126. },
  127. onLoad(options) {
  128. this.id = options.id || 0;
  129. //基本配置
  130. this.endTime = dayjs().format("YYYY-MM-DD");
  131. //this.form
  132. this.datetime = [
  133. dayjs().format("YYYY-MM-01"),
  134. dayjs().format("YYYY-MM-DD")
  135. ];
  136. this
  137. .request
  138. .get("gzAuction")
  139. .then(res => {
  140. if (res.code == 200) {
  141. this.gzData = res.data;
  142. }
  143. });
  144. this.initView();
  145. // #ifdef H5
  146. this.hFoot = 60;
  147. // #endif
  148. },
  149. methods: {
  150. ...mapMutations(['checkUserLogin']),
  151. /**
  152. * 加载基础配置
  153. */
  154. initView: function() {
  155. this.$nextTick(() => {
  156. uni.createSelectorQuery().select("#app-top").boundingClientRect(res => {
  157. this.barheight = res.height + 20;
  158. }).exec();
  159. });
  160. this.initData();
  161. this.getData(true);
  162. },
  163. initData: function() {
  164. this.request.post("slimInit", {
  165. str_time: this.datetime[0],
  166. end_time: this.datetime[1],
  167. auActionId: this.gzItem.id
  168. }).then(res => {
  169. if (res.code == 200) {
  170. this.total = res.data;
  171. }
  172. });
  173. },
  174. /**
  175. * 获取数据
  176. */
  177. getData: function(isPull = false) {
  178. if (this.page.isLoad) return;
  179. this.page.isLoad = true;
  180. if (isPull) {
  181. this.page.page = 1;
  182. this.page.isLoad = false;
  183. this.page.isFoot = false;
  184. }
  185. uni.showLoading({
  186. title: '获取数据中..'
  187. });
  188. var post = {};
  189. post.page = this.page.page;
  190. this
  191. .request
  192. .post("auctionSlimLog", {
  193. keyword: this.keyword,
  194. page: this.page.page,
  195. str_time: this.datetime[0],
  196. end_time: this.datetime[1],
  197. auActionId: this.gzItem.id
  198. })
  199. .then(res => {
  200. uni.hideLoading();
  201. this.page.isFirst = true;
  202. this.page.isLoad = false;
  203. this.isFirst = true;
  204. if (isPull) {
  205. this.listAr = res.data.list;
  206. } else {
  207. this.listAr = this.listAr.concat(res.data.list);
  208. }
  209. //是否到底
  210. if (res.data.list.length != res.data.pageSize) {
  211. this.page.isFoot = true;
  212. }
  213. })
  214. .catch((res) => {
  215. console.log(res);
  216. uni.hideLoading();
  217. uni.showModal({
  218. title: '系统提示',
  219. content: '加载失败,返回在尝试',
  220. showCancel: false
  221. });
  222. });
  223. },
  224. //选择场馆
  225. tapCg: function() {
  226. this.$refs.slimPopup.open();
  227. },
  228. closePopup() {
  229. this.$refs.slimPopup.close();
  230. },
  231. tapGzItem: function(item) {
  232. this.$refs.slimPopup.close();
  233. this.gzItem = item;
  234. this.initData();
  235. this.getData(true);
  236. },
  237. tapSerach: function() {
  238. this.getData(true);
  239. this.initData();
  240. },
  241. tapDateTime: function(ev) {
  242. this.initData();
  243. this.getData(true);
  244. },
  245. loadMoreData: function() {
  246. if (this.page.isFoot || this.page.isLoad) {
  247. return;
  248. }
  249. this.page.page++;
  250. this.getData();
  251. },
  252. tapCall: function(tel) {
  253. if (tel == null) {
  254. this.utils.showAlert({
  255. title: "系统提示",
  256. content: "暂无联系方式"
  257. });
  258. return;
  259. }
  260. const info = uni.getSystemInfoSync();
  261. if (info.platform == 'android') {
  262. uni.showModal({
  263. content: "确认拨打" + tel,
  264. confirmText: "确定",
  265. cancelText: "取消",
  266. success: function(res) {
  267. if (res.confirm) {
  268. this.$store.dispatch('permission/requestPermissions', 'CALL_PHONE').then(
  269. res => {
  270. if (res !== 1) return;
  271. uni.makePhoneCall({
  272. phoneNumber: tel,
  273. });
  274. });
  275. }
  276. }
  277. });
  278. } else {
  279. uni.makePhoneCall({
  280. phoneNumber: tel
  281. });
  282. }
  283. }
  284. },
  285. }
  286. </script>
  287. <style lang="scss">
  288. .app-body {
  289. padding: 0px 20rpx;
  290. }
  291. .sreach {
  292. background: #fff;
  293. margin: 20rpx 0;
  294. border-radius: 32rpx;
  295. padding: 16rpx 32rpx;
  296. .icon {
  297. width: 46rpx;
  298. height: 46rpx;
  299. }
  300. input {
  301. width: calc(100% - 46rpx - 16rpx - 50px);
  302. font-size: 16px;
  303. }
  304. .search-btn {
  305. font-size: 14px;
  306. color: #FF4C4C;
  307. }
  308. }
  309. .sc-body {
  310. padding: 20rpx;
  311. .item {
  312. background: #FFFFFF;
  313. border-radius: 16rpx;
  314. padding: 26rpx 44rpx;
  315. margin-bottom: 10px;
  316. .info {
  317. margin-bottom: 10rpx;
  318. .nickname {
  319. font-weight: bold;
  320. font-size: 32rpx;
  321. color: #303133;
  322. }
  323. .mobile {
  324. font-weight: 500;
  325. font-size: 30rpx;
  326. color: #999999;
  327. margin-left: 10px;
  328. }
  329. .id {
  330. font-weight: 500;
  331. font-size: 26rpx;
  332. color: #666666;
  333. }
  334. .changci {
  335. font-weight: 500;
  336. font-size: 26rpx;
  337. color: #666666;
  338. text {
  339. color: #333333;
  340. }
  341. }
  342. }
  343. .infos {
  344. margin-top: 10px;
  345. border-top: 1px solid #f1f1f1;
  346. padding-top: 6px;
  347. .time {
  348. font-size: 14px;
  349. color: #666;
  350. }
  351. }
  352. }
  353. }
  354. .search-tm {
  355. height: 40px;
  356. color: #787878;
  357. font-size: 14px;
  358. .icon {
  359. width: 10px;
  360. height: 10px;
  361. margin-left: 5px;
  362. }
  363. }
  364. .pop-info {
  365. .item {
  366. padding: 20rpx 0;
  367. text-align: center;
  368. border-bottom: 1px solid #f1f1f1;
  369. }
  370. }
  371. .app-inner {
  372. padding: 0px 10px;
  373. }
  374. .pannel {
  375. background: #FFFFFF;
  376. border-radius: 20px;
  377. padding: 15px;
  378. margin-top: 10px;
  379. .panel-info {
  380. .line {
  381. width: 1px;
  382. height: 50px;
  383. background: #999999;
  384. opacity: 0.38;
  385. margin-top: 10px;
  386. }
  387. .item {
  388. width: calc(50% - 1px);
  389. display: flex;
  390. flex-direction: column;
  391. justify-content: center;
  392. align-items: center;
  393. padding-top: 20px;
  394. .label {
  395. font-weight: 500;
  396. font-size: 12px;
  397. color: #787878;
  398. margin-top: 5px;
  399. }
  400. .count {
  401. font-weight: bold;
  402. font-size: 19px;
  403. color: #333333;
  404. }
  405. }
  406. }
  407. .status {
  408. padding: 10px 0;
  409. border-bottom: 1px solid #f1f1f1;
  410. .people {
  411. image {
  412. width: 24rpx;
  413. height: 22rpx;
  414. margin-right: 10rpx;
  415. }
  416. .label {
  417. color: #666666;
  418. font-size: 13px;
  419. }
  420. .value {
  421. font-size: 13px;
  422. color: #000;
  423. margin-left: 4px;
  424. }
  425. }
  426. }
  427. }
  428. </style>