order.vue 12 KB

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