order.vue 11 KB

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