order.vue 12 KB

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