order.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389
  1. <template>
  2. <view class="content">
  3. <view class="order-title">
  4. <view class="body-title">
  5. <!-- <view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view> -->
  6. <view class="header">我的订单</view>
  7. </view>
  8. <view class="roder-content">
  9. <view class="left" :class="{ current: currentIndex === index }" :key="index"
  10. v-for="(item, index) in maiList" @click="navGo(index)">{{ item.title }}</view>
  11. </view>
  12. </view>
  13. <view class="navbar" v-show="currentIndex == 0">
  14. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  15. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index, 0)">
  16. {{ item.text }}
  17. <view class="dian" v-if="tabCurrentIndex != index && item.isnew == 2"></view>
  18. </view>
  19. </view>
  20. <view class="navbar" v-show="currentIndex == 1">
  21. <view v-for="(item, index) in navList1" :key="index" class="nav-item"
  22. :class="{ current: tabCurrentIndex1 === index }" @click="tabClick(index, 1)">
  23. {{ item.text }}
  24. <view class="dian" v-if="tabCurrentIndex1 != index && item.isnew == 2"></view>
  25. </view>
  26. </view>
  27. <swiper :current="currentAuto" class="swiper-box-one" duration="0" @change="changeTab">
  28. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex"
  29. v-if="currentIndex == 0">
  30. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  31. <!-- 空白页 -->
  32. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  33. <!-- 订单列表 -->
  34. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
  35. <view class="i-top b-b">
  36. <text class="time">{{ item.order_id }}</text>
  37. <text class="state" :style="{ color: item.stateTipColor }">{{ item.stateTip }}</text>
  38. </view>
  39. <view class="goods-box-single">
  40. <image class="goods-img" :src="item.image" mode="aspectFill"></image>
  41. <view class="right">
  42. <text class="title clamp">{{ item.name }}</text>
  43. <text class="attr-box">x1</text>
  44. <text class="price">{{ moneyNum(item.price) }}</text>
  45. </view>
  46. </view>
  47. <view class="price-box" style="position: relative;">
  48. <text style="display: inline-block;position: absolute;left: 20rpx;"
  49. v-if="currentIndex == 0 && tabIndex == 2">{{item.update_time}}</text>
  50. {{(currentIndex == 0 && tabItem.state == 3) ? '当前挂售价': '实付'}}
  51. <text class="price"
  52. v-if="currentIndex == 0 && tabItem.state == 3">{{ moneyNum(item.hanging_price) }}</text>
  53. <text class="price" v-else>{{ moneyNum(item.actual_price) }}</text>
  54. </view>
  55. <view class="action-box b-t" v-if="item.stateTip == '待支付'"><button @click.stop="pay(item)"
  56. class="action-btn recom">立即支付</button></view>
  57. <view class="action-box b-t" v-if="item.stateTip == '待挂售'"><button @click.stop="gsell(item)"
  58. class="action-btn recom">立即挂售</button></view>
  59. </view>
  60. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  61. </scroll-view>
  62. </swiper-item>
  63. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList1" :key="tabIndex"
  64. v-if="currentIndex == 1">
  65. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  66. <!-- 空白页 -->
  67. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  68. <!-- 订单列表 -->
  69. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
  70. <view class="i-top b-b">
  71. <text class="time">{{ item.order_id ? item.order_id : item.order }}</text>
  72. <text class="state" :style="{ color: item.stateTipColor }">{{ item.stateTip }}</text>
  73. </view>
  74. <view class="goods-box-single">
  75. <image class="goods-img" :src="item.image" mode="scaleToFill"></image>
  76. <view class="right">
  77. <view class="flex-start">
  78. <text class="title clamp">{{ item.name }}</text>
  79. <text class="price">{{ item.price | moneyNum }}</text>
  80. </view>
  81. <view class="row flex"><text class="attr-box">x1</text></view>
  82. </view>
  83. </view>
  84. <view class="buy-box">
  85. <view class="buy-info" v-if="item.status != 0 && item.status">
  86. <view class="font">买家:</view>
  87. <image class="avter" :src="item.avatar" mode=""></image>
  88. <view class="buy-name">{{ item.nickname }}</view>
  89. <view class="phone">{{ item.phone }}</view>
  90. </view>
  91. <view class="" style="padding-top: 5rpx;" v-if="item.status != 0 && item.status">
  92. 成交时间:{{item.update_time}}
  93. </view>
  94. <view v-if="!item.status">
  95. <view class="buy-info">
  96. <view class="font">挂售价格:{{ item.hanging_price }}</view>
  97. </view>
  98. <view class="buy-info">
  99. <view class="font">挂售时间:{{ item.update_time }}</view>
  100. </view>
  101. </view>
  102. </view>
  103. <!-- <view class="upimg" v-if="item.status == 2 || item.status == 3">
  104. <view class="up-tit">打款凭证:</view>
  105. <view class="img-wrap" v-if="item.upload_image" @click="lookimg(item.upload_image)"><image :src="item.upload_image" mode=""></image></view>
  106. <view class="" style="color: #0F253A;font-weight: bold;font-size: 26rpx;" v-else>买家未上传支付凭证</view>
  107. </view> -->
  108. <!-- <view class="action-box b-t" v-if="item.status == 1"><button @click.stop="orderPay(item)" class="action-btn recom">联系买家</button></view> -->
  109. <!-- <view class="action-box b-t" v-if="item.status == 2">
  110. <button @click.stop="orderPay(item)" class="action-btn recom">通过</button>
  111. </view> -->
  112. <!-- <view class="action-box b-t" v-if="!item.status">
  113. <button @click.stop="cancel(item)" class="action-btn recom">取消挂售</button>
  114. </view> -->
  115. </view>
  116. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  117. </scroll-view>
  118. </swiper-item>
  119. </swiper>
  120. <!-- 待支付支付弹窗 -->
  121. <uni-popup ref="uppass" type="center">
  122. <view class="psw-wrapper">
  123. <view class="psw-title">请输入支付密码</view>
  124. <view class="psw-content">购买需支付消费积分</view>
  125. <view class="psw-price">
  126. {{good.actual_price}}
  127. </view>
  128. <view class="psw-jg"></view>
  129. <view class="psw-paytype flex">
  130. <view class="">
  131. 支付方式
  132. </view>
  133. <view class="">
  134. 消费积分
  135. </view>
  136. </view>
  137. <input type="password" v-model="password" class="psw-ipt" focus />
  138. <view class="psw-btn">
  139. <text @click="cancel">取消</text>
  140. <text class="psw-qd" @click="pswQd">确定</text>
  141. </view>
  142. </view>
  143. </uni-popup>
  144. <uni-popup ref="gspass" type="center">
  145. <view class="psw-wrapper" style="height: 350rpx;">
  146. <view class="psw-title">请输入支付密码</view>
  147. <input type="password" v-model="password" class="psw-ipt" />
  148. <view class="psw-btn">
  149. <text @click="cancelpass">取消</text>
  150. <text class="psw-qd" @click="pswQdpass">确定</text>
  151. </view>
  152. </view>
  153. </uni-popup>
  154. <!-- <u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar> -->
  155. </view>
  156. </template>
  157. <script>
  158. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  159. import empty from '@/components/empty';
  160. import {
  161. orderList,
  162. orderCancel,
  163. orderDel,
  164. orderTake,
  165. adopt,
  166. user_auction_order,
  167. seller,
  168. cancel,
  169. untreated
  170. } from '@/api/order.js';
  171. import {
  172. tabbar
  173. } from '@/utils/tabbar.js';
  174. import {
  175. zfpay,
  176. hanging_sale
  177. } from '@/api/index.js'
  178. export default {
  179. components: {
  180. uniLoadMore,
  181. empty
  182. },
  183. data() {
  184. return {
  185. good: {},
  186. height: '', //第一层swiper高度
  187. tabbar: tabbar,
  188. current: 1, //底部tabar选中的icon对象
  189. currentIndex: 0, //当前选中的第一级0为我要买单,1我要卖单
  190. tabCurrentIndex: 0, //当前选中的第二级别我要买单选中项
  191. tabCurrentIndex1: 0, //当前选中的第二级别我要卖单选中项
  192. maiList: [{
  193. title: '我的买单'
  194. },
  195. {
  196. title: '我的卖单'
  197. }
  198. ],
  199. navList: [{
  200. state: 0,
  201. text: '已过期',
  202. loadingType: 'more',
  203. orderList: [],
  204. isnew: 1, //判断是否有新的订单
  205. page: 1, //当前页数
  206. limit: 10 //每次信息条数
  207. },
  208. {
  209. state: 1,
  210. text: '待支付',
  211. loadingType: 'more',
  212. orderList: [],
  213. isnew: 1, //判断是否有新的订单
  214. page: 1, //当前页数
  215. limit: 10 //每次信息条数
  216. },
  217. {
  218. state: 2,
  219. text: '已完成',
  220. loadingType: 'more',
  221. orderList: [],
  222. isnew: 1, //判断是否有新的订单
  223. page: 1, //当前页数
  224. limit: 10 //每次信息条数
  225. },
  226. {
  227. state: 3,
  228. text: '待挂售',
  229. loadingType: 'more',
  230. orderList: [],
  231. isnew: 1, //判断是否有新的订单
  232. page: 1, //当前页数
  233. limit: 10 //每次信息条数
  234. }
  235. ],
  236. navList1: [{
  237. state: 1,
  238. text: '待支付',
  239. loadingType: 'more',
  240. orderList: [],
  241. isnew: 1, //判断是否有新的订单
  242. page: 1, //当前页数
  243. limit: 10 //每次信息条数
  244. },
  245. {
  246. state: 3,
  247. text: '寄售中',
  248. loadingType: 'more',
  249. orderList: [],
  250. isnew: 1, //判断是否有新的订单
  251. page: 1, //当前页数
  252. limit: 10 //每次信息条数
  253. },
  254. {
  255. state: 2,
  256. text: '已完成',
  257. loadingType: 'more',
  258. orderList: [],
  259. isnew: 1, //判断是否有新的订单
  260. page: 1, //当前页数
  261. limit: 10 //每次信息条数
  262. },
  263. ],
  264. password: '',
  265. gsgood: {}
  266. };
  267. },
  268. computed: {
  269. currentAuto() {
  270. if (this.currentIndex == 0) {
  271. return this.tabCurrentIndex;
  272. }
  273. if (this.currentIndex == 1) {
  274. return this.tabCurrentIndex1;
  275. }
  276. }
  277. },
  278. onLoad(options) {
  279. /**
  280. * 修复app端点击除全部订单外的按钮进入时不加载数据的问题
  281. * 替换onLoad下代码即可
  282. */
  283. this.tabCurrentIndex = +options.state || 0;
  284. },
  285. onShow() {
  286. this.loadData();
  287. // this.upData();
  288. },
  289. // #ifdef APP-PLUS || H5
  290. onBackPress(e) {
  291. uni.switchTab({
  292. url: '/pages/user/user'
  293. });
  294. return true;
  295. },
  296. // #endif
  297. filters: {
  298. moneyNum(value) {
  299. return +value;
  300. }
  301. },
  302. // 页面加载完获取swiper高度
  303. onReady(res) {
  304. var obj = this;
  305. uni.getSystemInfo({
  306. success: resu => {
  307. const query = uni.createSelectorQuery();
  308. query.select('.swiper-box-one').boundingClientRect();
  309. query.exec(function(res) {
  310. console.log(res, 'ddddddddddddd');
  311. obj.height = resu.windowHeight - res[0].top + 'px';
  312. console.log('打印页面的剩余高度', obj.height);
  313. });
  314. },
  315. fail: res => {}
  316. });
  317. },
  318. onHide() {
  319. console.log('页面隐藏')
  320. this.current = 1, //底部tabar选中的icon对象
  321. this.currentIndex = 0, //当前选中的第一级0为我要买单,1我要卖单
  322. this.tabCurrentIndex = 0, //当前选中的第二级别我要买单选中项
  323. this.tabCurrentIndex1 = 0, //当前选中的第二级别我要卖单选中项
  324. this.navList = [{
  325. state: 0,
  326. text: '已过期',
  327. loadingType: 'more',
  328. orderList: [],
  329. isnew: 1, //判断是否有新的订单
  330. page: 1, //当前页数
  331. limit: 10 //每次信息条数
  332. },
  333. {
  334. state: 1,
  335. text: '待支付',
  336. loadingType: 'more',
  337. orderList: [],
  338. isnew: 1, //判断是否有新的订单
  339. page: 1, //当前页数
  340. limit: 10 //每次信息条数
  341. },
  342. {
  343. state: 2,
  344. text: '已完成',
  345. loadingType: 'more',
  346. orderList: [],
  347. isnew: 1, //判断是否有新的订单
  348. page: 1, //当前页数
  349. limit: 10 //每次信息条数
  350. },
  351. {
  352. state: 3,
  353. text: '待挂售',
  354. loadingType: 'more',
  355. orderList: [],
  356. isnew: 1, //判断是否有新的订单
  357. page: 1, //当前页数
  358. limit: 10 //每次信息条数
  359. }
  360. ],
  361. this.navList1 = [{
  362. state: 1,
  363. text: '待支付',
  364. loadingType: 'more',
  365. orderList: [],
  366. isnew: 1, //判断是否有新的订单
  367. page: 1, //当前页数
  368. limit: 10 //每次信息条数
  369. },
  370. {
  371. state: 3,
  372. text: '寄售中',
  373. loadingType: 'more',
  374. orderList: [],
  375. isnew: 1, //判断是否有新的订单
  376. page: 1, //当前页数
  377. limit: 10 //每次信息条数
  378. },
  379. {
  380. state: 2,
  381. text: '已完成',
  382. loadingType: 'more',
  383. orderList: [],
  384. isnew: 1, //判断是否有新的订单
  385. page: 1, //当前页数
  386. limit: 10 //每次信息条数
  387. },
  388. ]
  389. },
  390. methods: {
  391. //顶部tab点击
  392. tabClick(index, type) {
  393. if (type == 0) {
  394. this.tabCurrentIndex = index;
  395. }
  396. if (type == 1) {
  397. this.tabCurrentIndex1 = index;
  398. }
  399. },
  400. toBack() {
  401. uni.switchTab({
  402. url: '/pages/order/index'
  403. });
  404. },
  405. navGo(index) {
  406. this.currentIndex = index;
  407. console.log(this.currentIndex, '点击');
  408. this.loadData();
  409. },
  410. // 转换金额为数字
  411. moneyNum(value) {
  412. return +value;
  413. },
  414. upData() {
  415. // untreated().then(({ data }) => {
  416. // console.log(data);
  417. // if(data.user.hanging != 0){
  418. // this.navList[3].isnew = 2
  419. // }
  420. // if(data.user.hanging == 0){
  421. // this.navList[3].isnew = 1
  422. // }
  423. // if(data.user.paid != 0){
  424. // this.navList[1].isnew = 2
  425. // }
  426. // if(data.user.paid == 0){
  427. // this.navList[1].isnew = 1
  428. // }
  429. // if(data.seller.reviewed != 0) {
  430. // this.navList1[3].isnew = 2
  431. // }
  432. // if(data.seller.reviewed == 0) {
  433. // this.navList1[3].isnew = 1
  434. // }
  435. // });
  436. },
  437. // 查看大图
  438. lookimg(src) {
  439. console.log(src);
  440. let arr = [src];
  441. uni.previewImage({
  442. current: src,
  443. urls: arr
  444. });
  445. },
  446. // 确认收货
  447. orderTake(item, index) {
  448. let obj = this;
  449. uni.showModal({
  450. title: '是否确认收货?',
  451. success: () => {
  452. orderTake({
  453. uni: item.order_id
  454. })
  455. .then(e => {
  456. obj.navList[obj.tabCurrentIndex].orderList.splice(index, 1);
  457. uni.showToast({
  458. title: '收货成功'
  459. });
  460. })
  461. .catch(e => {
  462. console.log(e);
  463. });
  464. }
  465. });
  466. },
  467. //跳转到订单详情
  468. goToOrderDetail(e) {
  469. uni.navigateTo({
  470. url: '/pages/order/orderDetail?id=' + e.order_id
  471. });
  472. },
  473. // 申请退款
  474. orderRefund(e) {
  475. uni.navigateTo({
  476. url: '/pages/order/orderRefund?id=' + e.order_id
  477. });
  478. },
  479. // 订单支付
  480. pay(item) {
  481. // uni.navigateTo({
  482. // url: '/pages/hall/hallpay?ordid=' + item.order_id
  483. // });
  484. let obj = this
  485. obj.good = item
  486. obj.$refs.uppass.open()
  487. },
  488. gsell(item) {
  489. console.log(item)
  490. let obj = this
  491. obj.gsgood = item
  492. obj.$refs.gspass.open()
  493. },
  494. orderPay(e) {
  495. adopt({
  496. order_id: e.order_id
  497. }).then(({
  498. data
  499. }) => {
  500. console.log('1111');
  501. this.loadData('reload');
  502. });
  503. },
  504. //获取订单列表
  505. loadData(source) {
  506. //这里是将订单挂载到tab列表下
  507. let index, navItem;
  508. if (this.currentIndex == 0) {
  509. index = this.tabCurrentIndex;
  510. navItem = this.navList[index];
  511. }
  512. if (this.currentIndex == 1) {
  513. index = this.tabCurrentIndex1;
  514. navItem = this.navList1[index];
  515. }
  516. let state = navItem.state;
  517. if (source == 'reload') {
  518. navItem.orderList = [];
  519. navItem.page = 1;
  520. navItem.limit = 10;
  521. navItem.loadingType = 'more';
  522. }
  523. if (source === 'tabChange' && navItem.loaded === true) {
  524. //tab切换只有第一次需要加载数据
  525. return;
  526. }
  527. if (navItem.loadingType === 'loading') {
  528. //防止重复加载
  529. return;
  530. }
  531. if (navItem.loadingType === 'noMore') {
  532. //防止重复加载
  533. return;
  534. }
  535. // 修改当前对象状态为加载中
  536. navItem.loadingType = 'loading';
  537. if (this.currentIndex == 0) {
  538. user_auction_order({
  539. type: state,
  540. page: navItem.page,
  541. limit: navItem.limit
  542. })
  543. .then(({
  544. data
  545. }) => {
  546. let arr = data.map(e => {
  547. console.log(state == 4);
  548. if (state == 3) {
  549. e.stateTip = '待挂售';
  550. e.stateTipColor = '#fa436a';
  551. } else {
  552. let b = this.orderStateExp(e.status);
  553. e.stateTip = b.stateTip;
  554. e.stateTipColor = b.stateTipColor;
  555. }
  556. return e;
  557. });
  558. console.log(arr, '123456');
  559. navItem.orderList = navItem.orderList.concat(arr);
  560. // console.log(navItem.orderList);
  561. navItem.page++;
  562. if (navItem.limit == data.length) {
  563. //判断是否还有数据, 有改为 more, 没有改为noMore
  564. navItem.loadingType = 'more';
  565. return;
  566. } else {
  567. //判断是否还有数据, 有改为 more, 没有改为noMore
  568. navItem.loadingType = 'noMore';
  569. }
  570. uni.hideLoading();
  571. this.$set(navItem, 'loaded', true);
  572. })
  573. .catch(e => {
  574. console.log(e);
  575. });
  576. }
  577. if (this.currentIndex == 1) {
  578. seller({
  579. type: state,
  580. page: navItem.page,
  581. limit: navItem.limit
  582. })
  583. .then(({
  584. data
  585. }) => {
  586. console.log(data);
  587. let arr = data.map(e => {
  588. if (state == 4) {
  589. e.stateTip = '售卖中';
  590. e.stateTipColor = '#fa436a';
  591. } else {
  592. let b = this.orderStateExp(e.status);
  593. e.stateTip = b.stateTip;
  594. e.stateTipColor = b.stateTipColor;
  595. }
  596. return e;
  597. });
  598. navItem.orderList = navItem.orderList.concat(arr);
  599. // console.log(navItem.orderList);
  600. navItem.page++;
  601. if (navItem.limit == data.length) {
  602. //判断是否还有数据, 有改为 more, 没有改为noMore
  603. navItem.loadingType = 'more';
  604. return;
  605. } else {
  606. //判断是否还有数据, 有改为 more, 没有改为noMore
  607. navItem.loadingType = 'noMore';
  608. }
  609. uni.hideLoading();
  610. this.$set(navItem, 'loaded', true);
  611. })
  612. .catch(e => {
  613. console.log(e);
  614. });
  615. }
  616. },
  617. //swiper 切换
  618. changeTab(e) {
  619. if (this.currentIndex == 0) {
  620. this.tabCurrentIndex = e.target.current;
  621. }
  622. if (this.currentIndex == 1) {
  623. this.tabCurrentIndex1 = e.target.current;
  624. }
  625. this.loadData('tabChange');
  626. },
  627. //删除订单
  628. deleteOrder(index) {
  629. uni.showLoading({
  630. title: '请稍后'
  631. });
  632. setTimeout(() => {
  633. this.navList[this.tabCurrentIndex].orderList.splice(index, 1);
  634. uni.hideLoading();
  635. }, 600);
  636. },
  637. //取消订单
  638. cancelOrder(item) {
  639. uni.showModal({
  640. title: '订单取消',
  641. content: '是否取消订单?',
  642. success: e => {
  643. if (e.confirm) {
  644. uni.showLoading({
  645. title: '请稍后'
  646. });
  647. orderCancel({
  648. id: item.order_id
  649. })
  650. .then(e => {
  651. uni.showToast({
  652. title: '取消成功',
  653. duration: 2000,
  654. position: 'top'
  655. });
  656. })
  657. .catch(e => {
  658. console.log(e);
  659. });
  660. //取消订单后删除待付款中该项
  661. let list = this.navList[this.tabCurrentIndex].orderList;
  662. let index = list.findIndex(val => val.id === item.id);
  663. index !== -1 && list.splice(index, 1);
  664. uni.hideLoading();
  665. }
  666. }
  667. });
  668. },
  669. //订单状态文字和颜色
  670. orderStateExp(state) {
  671. let stateTip = '',
  672. stateTipColor = '#fa436a';
  673. switch (+state) {
  674. case 0:
  675. stateTip = '已过期';
  676. break;
  677. case 1:
  678. stateTip = '待支付';
  679. break;
  680. case 2:
  681. stateTip = '已完成';
  682. break;
  683. case 3:
  684. stateTip = '待挂售';
  685. break;
  686. case 4:
  687. stateTip = '待挂售';
  688. break;
  689. case 9:
  690. stateTip = '订单已关闭';
  691. stateTipColor = '#909399';
  692. break;
  693. //更多自定义
  694. }
  695. return {
  696. stateTip,
  697. stateTipColor
  698. };
  699. },
  700. cancel() {
  701. let obj = this
  702. obj.password = ''
  703. obj.$refs.uppass.close()
  704. },
  705. cancelpass() {
  706. let obj = this
  707. obj.password = ''
  708. obj.$refs.gspass.close()
  709. },
  710. pswQd() {
  711. let obj = this
  712. zfpay({
  713. order_id: obj.good.order_id,
  714. pas: obj.password
  715. }).then(res => {
  716. obj.$api.msg('支付成功')
  717. obj.$refs.uppass.close()
  718. obj.password = ''
  719. })
  720. },
  721. pswQdpass() {
  722. let obj = this
  723. hanging_sale({
  724. id: obj.gsgood.id,
  725. pas: obj.password
  726. }).then(res => {
  727. obj.$api.msg('挂售成功')
  728. let s = obj.navList[obj.tabCurrentIndex].orderList.indexOf(obj.gsgood);
  729. obj.navList[obj.tabCurrentIndex].orderList.splice(s, 1);
  730. obj.cancelpass()
  731. })
  732. }
  733. }
  734. };
  735. </script>
  736. <style lang="scss">
  737. page,
  738. .content {
  739. background: $page-color-base;
  740. height: 100%;
  741. }
  742. .order-title {
  743. width: 750rpx;
  744. height: 270rpx;
  745. background: url(../../static/img/order99.png) repeat-x 0;
  746. display: flex;
  747. flex-direction: column;
  748. // padding: 50rpx 0;
  749. text-align: center;
  750. .body-title {
  751. height: 80rpx;
  752. text-align: center;
  753. font-size: 35rpx;
  754. position: relative;
  755. .header {
  756. position: absolute;
  757. left: 0;
  758. top: 30rpx;
  759. width: 100%;
  760. font-size: 36rpx;
  761. font-family: PingFang SC;
  762. font-weight: bold;
  763. color: #fffeff;
  764. height: 80rpx;
  765. font-size: 36rpx;
  766. font-weight: 700;
  767. z-index: 9;
  768. display: flex;
  769. justify-content: center;
  770. align-items: center;
  771. }
  772. .goback-box {
  773. position: absolute;
  774. left: 18rpx;
  775. top: 30rpx;
  776. height: 80rpx;
  777. display: flex;
  778. align-items: center;
  779. }
  780. .goback {
  781. z-index: 100;
  782. width: 34rpx;
  783. height: 34rpx;
  784. }
  785. }
  786. text {
  787. margin: 30px 0;
  788. font-size: 17px;
  789. font-family: PingFang SC;
  790. font-weight: bold;
  791. color: #ffffff;
  792. }
  793. .roder-content {
  794. margin-top: 80rpx;
  795. display: flex;
  796. justify-content: space-around;
  797. .left {
  798. width: 168px;
  799. height: 40px;
  800. line-height: 40px;
  801. border: 1px solid #ffffff;
  802. border-radius: 5px;
  803. text-align: center;
  804. font-size: 15px;
  805. font-family: PingFang SC;
  806. font-weight: bold;
  807. color: #ffffff;
  808. background: #dc262b;
  809. }
  810. .current {
  811. color: #dc262b;
  812. background: #ffffff;
  813. }
  814. }
  815. }
  816. .swiper-box {
  817. background: red;
  818. }
  819. .list-scroll-content {
  820. height: 100%;
  821. }
  822. .uni-swiper-item {
  823. height: auto;
  824. }
  825. .navbar {
  826. display: flex;
  827. height: 40px;
  828. padding: 0 5px;
  829. background: #fff;
  830. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  831. position: relative;
  832. z-index: 10;
  833. .nav-item {
  834. flex: 1;
  835. display: flex;
  836. justify-content: center;
  837. align-items: center;
  838. height: 100%;
  839. font-size: 15px;
  840. color: $font-color-dark;
  841. position: relative;
  842. .dian {
  843. position: absolute;
  844. top: 20rpx;
  845. right: 10rpx;
  846. width: 8rpx;
  847. height: 8rpx;
  848. border-radius: 50%;
  849. background-color: $base-color;
  850. }
  851. &.current {
  852. color: $base-color;
  853. &:after {
  854. content: '';
  855. position: absolute;
  856. left: 50%;
  857. bottom: 0;
  858. transform: translateX(-50%);
  859. width: 44px;
  860. height: 0;
  861. border-bottom: 2px solid $base-color;
  862. }
  863. }
  864. }
  865. }
  866. .order-item {
  867. display: flex;
  868. flex-direction: column;
  869. background: #fff;
  870. margin-top: 16rpx;
  871. .i-top {
  872. display: flex;
  873. align-items: center;
  874. height: 80rpx;
  875. font-size: $font-base;
  876. color: $font-color-dark;
  877. position: relative;
  878. padding: 0 30rpx;
  879. .time {
  880. flex: 1;
  881. }
  882. .state {
  883. color: $base-color;
  884. }
  885. .del-btn {
  886. padding: 10rpx 0 10rpx 36rpx;
  887. font-size: $font-lg;
  888. color: $font-color-light;
  889. position: relative;
  890. &:after {
  891. content: '';
  892. width: 0;
  893. height: 30rpx;
  894. border-left: 1px solid $border-color-dark;
  895. position: absolute;
  896. left: 20rpx;
  897. top: 50%;
  898. transform: translateY(-50%);
  899. }
  900. }
  901. }
  902. /* 多条商品 */
  903. .goods-box {
  904. height: 160rpx;
  905. padding: 20rpx 0;
  906. white-space: nowrap;
  907. .goods-item {
  908. width: 120rpx;
  909. height: 120rpx;
  910. display: inline-block;
  911. margin-right: 24rpx;
  912. }
  913. .goods-img {
  914. display: block;
  915. width: 100%;
  916. height: 100%;
  917. }
  918. }
  919. /* 单条商品 */
  920. .goods-box-single {
  921. display: flex;
  922. padding: 20rpx 30rpx;
  923. background: #f7f7f7;
  924. .goods-img {
  925. display: block;
  926. width: 120rpx;
  927. height: 120rpx;
  928. }
  929. .right {
  930. flex: 1;
  931. display: flex;
  932. flex-direction: column;
  933. padding: 0 0 0 24rpx;
  934. overflow: hidden;
  935. .row {
  936. margin-top: 10rpx;
  937. }
  938. .row_title {
  939. padding: 5rpx 10rpx;
  940. background-color: #dddddd;
  941. border-radius: 10rpx;
  942. font-size: 22rpx;
  943. color: #ffffff;
  944. }
  945. .title {
  946. font-size: $font-base + 2rpx;
  947. color: $font-color-dark;
  948. line-height: 1;
  949. width: 80%;
  950. }
  951. .attr-box {
  952. display: flex;
  953. justify-content: flex-end;
  954. font-size: $font-sm + 2rpx;
  955. color: $font-color-light;
  956. }
  957. .price {
  958. display: inline;
  959. font-size: $font-base + 2rpx;
  960. color: $font-color-dark;
  961. &:before {
  962. content: '¥';
  963. font-size: $font-sm;
  964. }
  965. }
  966. }
  967. }
  968. .buy-box {
  969. padding: 10rpx 22rpx;
  970. background-color: #ffffff;
  971. .buy-info {
  972. display: flex;
  973. align-items: center;
  974. margin-top: 20rpx;
  975. .font {
  976. font-size: 32rpx;
  977. font-family: PingFang SC;
  978. font-weight: 500;
  979. color: #333333;
  980. }
  981. .avter {
  982. margin-left: 10rpx;
  983. width: 46rpx;
  984. height: 46rpx;
  985. border-radius: 50%;
  986. }
  987. .buy-name {
  988. margin-left: 10rpx;
  989. font-size: 32rpx;
  990. font-family: PingFang SC;
  991. font-weight: bold;
  992. color: #333333;
  993. }
  994. .phone {
  995. margin-left: 12rpx;
  996. font-size: 24rpx;
  997. font-family: PingFang SC;
  998. font-weight: 500;
  999. color: #999999;
  1000. }
  1001. }
  1002. }
  1003. .upimg {
  1004. padding-left: 20rpx;
  1005. padding-top: 10rpx;
  1006. padding-bottom: 10rpx;
  1007. display: flex;
  1008. .up-tit {
  1009. display: inline-block;
  1010. font-size: 26rpx;
  1011. font-family: PingFang SC;
  1012. font-weight: 500;
  1013. color: #6d7c88;
  1014. }
  1015. .img-wrap {
  1016. width: 153rpx;
  1017. height: 152rpx;
  1018. border-radius: 20rpx;
  1019. image {
  1020. border-radius: 20rpx;
  1021. width: 153rpx;
  1022. height: 152rpx;
  1023. background-color: #ccc;
  1024. }
  1025. }
  1026. }
  1027. .price-box {
  1028. display: flex;
  1029. justify-content: flex-end;
  1030. align-items: baseline;
  1031. padding: 20rpx 30rpx;
  1032. font-size: $font-sm + 2rpx;
  1033. color: $font-color-light;
  1034. .num {
  1035. margin: 0 8rpx;
  1036. color: $font-color-dark;
  1037. }
  1038. .price {
  1039. font-size: $font-lg;
  1040. color: $font-color-dark;
  1041. &:before {
  1042. content: '¥';
  1043. font-size: $font-sm;
  1044. margin: 0 2rpx 0 8rpx;
  1045. }
  1046. }
  1047. }
  1048. .action-box {
  1049. padding: 0 30rpx;
  1050. display: flex;
  1051. justify-content: flex-end;
  1052. align-items: center;
  1053. height: 100rpx;
  1054. position: relative;
  1055. }
  1056. .refuse {
  1057. margin: 0;
  1058. padding: 0;
  1059. width: 160rpx;
  1060. height: 60rpx;
  1061. border: 2rpx solid #ebebeb;
  1062. border-radius: 28rpx;
  1063. text-align: center;
  1064. line-height: 60rpx;
  1065. font-size: 26rpx;
  1066. font-family: PingFang SC;
  1067. font-weight: 500;
  1068. color: #999999;
  1069. &:after {
  1070. border-radius: 100px;
  1071. }
  1072. &.recom {
  1073. color: #999999;
  1074. &:after {
  1075. border-color: #999999;
  1076. }
  1077. }
  1078. }
  1079. .action-btn {
  1080. width: 160rpx;
  1081. height: 60rpx;
  1082. margin: 0;
  1083. margin-left: 24rpx;
  1084. padding: 0;
  1085. text-align: center;
  1086. line-height: 60rpx;
  1087. font-size: $font-sm + 2rpx;
  1088. color: $font-color-dark;
  1089. background: #fff;
  1090. border-radius: 100px;
  1091. border: 2rpx solid #fd3b39;
  1092. border-radius: 28px;
  1093. &:after {
  1094. border-radius: 100px;
  1095. }
  1096. &.recom {
  1097. color: $base-color;
  1098. &:after {
  1099. border-color: $base-color;
  1100. }
  1101. }
  1102. &.evaluate {
  1103. color: $color-yellow;
  1104. &:after {
  1105. border-color: $color-yellow;
  1106. }
  1107. }
  1108. }
  1109. }
  1110. /* load-more */
  1111. .uni-load-more {
  1112. display: flex;
  1113. flex-direction: row;
  1114. height: 80rpx;
  1115. align-items: center;
  1116. justify-content: center;
  1117. }
  1118. .uni-load-more__text {
  1119. font-size: 28rpx;
  1120. color: #999;
  1121. }
  1122. .uni-load-more__img {
  1123. height: 24px;
  1124. width: 24px;
  1125. margin-right: 10px;
  1126. }
  1127. .uni-load-more__img>view {
  1128. position: absolute;
  1129. }
  1130. .uni-load-more__img>view view {
  1131. width: 6px;
  1132. height: 2px;
  1133. border-top-left-radius: 1px;
  1134. border-bottom-left-radius: 1px;
  1135. background: #999;
  1136. position: absolute;
  1137. opacity: 0.2;
  1138. transform-origin: 50%;
  1139. animation: load 1.56s ease infinite;
  1140. }
  1141. .uni-load-more__img>view view:nth-child(1) {
  1142. transform: rotate(90deg);
  1143. top: 2px;
  1144. left: 9px;
  1145. }
  1146. .uni-load-more__img>view view:nth-child(2) {
  1147. transform: rotate(180deg);
  1148. top: 11px;
  1149. right: 0;
  1150. }
  1151. .uni-load-more__img>view view:nth-child(3) {
  1152. transform: rotate(270deg);
  1153. bottom: 2px;
  1154. left: 9px;
  1155. }
  1156. .uni-load-more__img>view view:nth-child(4) {
  1157. top: 11px;
  1158. left: 0;
  1159. }
  1160. .load1,
  1161. .load2,
  1162. .load3 {
  1163. height: 24px;
  1164. width: 24px;
  1165. }
  1166. .load2 {
  1167. transform: rotate(30deg);
  1168. }
  1169. .load3 {
  1170. transform: rotate(60deg);
  1171. }
  1172. .load1 view:nth-child(1) {
  1173. animation-delay: 0s;
  1174. }
  1175. .load2 view:nth-child(1) {
  1176. animation-delay: 0.13s;
  1177. }
  1178. .load3 view:nth-child(1) {
  1179. animation-delay: 0.26s;
  1180. }
  1181. .load1 view:nth-child(2) {
  1182. animation-delay: 0.39s;
  1183. }
  1184. .load2 view:nth-child(2) {
  1185. animation-delay: 0.52s;
  1186. }
  1187. .load3 view:nth-child(2) {
  1188. animation-delay: 0.65s;
  1189. }
  1190. .load1 view:nth-child(3) {
  1191. animation-delay: 0.78s;
  1192. }
  1193. .load2 view:nth-child(3) {
  1194. animation-delay: 0.91s;
  1195. }
  1196. .load3 view:nth-child(3) {
  1197. animation-delay: 1.04s;
  1198. }
  1199. .load1 view:nth-child(4) {
  1200. animation-delay: 1.17s;
  1201. }
  1202. .load2 view:nth-child(4) {
  1203. animation-delay: 1.3s;
  1204. }
  1205. .load3 view:nth-child(4) {
  1206. animation-delay: 1.43s;
  1207. }
  1208. @-webkit-keyframes load {
  1209. 0% {
  1210. opacity: 1;
  1211. }
  1212. 100% {
  1213. opacity: 0.2;
  1214. }
  1215. }
  1216. .swiper-box-one {
  1217. height: calc(100% - 175px);
  1218. }
  1219. .psw-wrapper {
  1220. width: 548rpx;
  1221. height: 548rpx;
  1222. background-color: #FFFFFF;
  1223. border-radius: 15rpx 15rpx;
  1224. .psw-title {
  1225. width: 100%;
  1226. font-size: 35rpx;
  1227. padding: 43rpx 0 40rpx;
  1228. text-align: center;
  1229. font-weight: 800;
  1230. }
  1231. .psw-content {
  1232. width: 100%;
  1233. font-size: 32rpx;
  1234. text-align: center;
  1235. }
  1236. .psw-price {
  1237. font-weight: bold;
  1238. font-size: 68rpx;
  1239. text-align: center;
  1240. padding-top: 10rpx;
  1241. }
  1242. .psw-jg {
  1243. height: 1px;
  1244. width: 500rpx;
  1245. background-color: #eee;
  1246. margin: auto;
  1247. }
  1248. .psw-paytype {
  1249. justify-content: space-between;
  1250. padding: 10rpx 25rpx 30rpx;
  1251. font-size: 26rpx;
  1252. }
  1253. .psw-ipt {
  1254. display: block;
  1255. background-color: #dce3ed;
  1256. height: 90rpx;
  1257. width: 464rpx;
  1258. padding-left: 30rpx;
  1259. margin: 0 auto;
  1260. font-size: 80rpx;
  1261. }
  1262. .psw-btn text {
  1263. display: inline-block;
  1264. text-align: center;
  1265. width: 50%;
  1266. padding-top: 29rpx;
  1267. font-size: 35rpx;
  1268. }
  1269. .psw-qd {
  1270. color: #5771DF;
  1271. }
  1272. }
  1273. </style>