order-pending.vue 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097
  1. <template>
  2. <view class="order_manage" :class="showModal?'no_scroll':''">
  3. <view class="order_list" v-if="orderList">
  4. <view class="list_con" @click="skipDel(item.order_no)" v-for="(item, idx) in orderList" :key="idx">
  5. <view class="flexB">
  6. <text>订单号:{{ item.order_no }}</text>
  7. <text v-if="item.is_help == 1" class="ident">代下单</text>
  8. </view>
  9. <view class="goods_con">
  10. <view v-for="(temp,key,index) in item.goods" :key="index">
  11. <view class="flexB">
  12. <view class="flexS">
  13. <image :src="temp.img" class="goods_img"></image>
  14. <view>
  15. <view style="font-size:28rpx;font-weight: bold;">
  16. {{ temp.name }}
  17. </view>
  18. <view class="one_year" style="width: 120rpx;">3条装</view>
  19. </view>
  20. </view>
  21. <view class="price">
  22. <view style="color:#999;" v-if="temp.sku">X
  23. {{temp.sku.reduce((t, e) => t + Number(e.num), 0) ||0}}
  24. </view>
  25. <view style="margin-top:26rpx;" v-if="temp.sku">¥{{temp.sku[0].price}}</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="flexE">
  30. <text v-if="item.goods" class="gray">共{{totalNum(item.goods)}}套,</text>
  31. <text class="gray">合计:</text>
  32. <text class="total">
  33. <text>¥</text>
  34. <text v-if="item.goods">{{totalMoney(item.goods)}}</text>
  35. </text>
  36. </view>
  37. </view>
  38. <view class="close_order" v-if="item.status == 0 && item.countdown">订单关闭倒计时: {{ item.countdown }},请尽快支付。
  39. </view>
  40. <view class="close_order" v-if="item.apply_cancel == 3 && item.status == 1">
  41. 已驳回客户发出的取消订单申请,请正常发货。
  42. </view>
  43. <view :class="item.user ? 'flexB' : 'flexE'" class="goods_opera">
  44. <view v-if="item.user">客户:{{ item.user.nickname | getName(item.status==1?5:9) }}</view>
  45. <view v-if="item.status == 0" class="flexE">
  46. <view class="base_btn" v-if="item.is_help == 1" @click.stop="payNow(item)">
  47. 立即付款</view>
  48. <view class="base_btn" @click.stop="callPhone(item.user.phone)"
  49. v-if="item.user && item.is_help == 0">联系客户</view>
  50. <view class="more_opera" @click.stop="moreOpera(idx)">更多</view>
  51. <view class="dialog" v-if="item.showMore">
  52. <view @click.stop="choose(2, item.id, idx)">取消订单</view>
  53. </view>
  54. </view>
  55. <view class="flexS" v-if="item.status == 1">
  56. <view class="audit_btn" @click.stop="skipAudit(item)" v-if="item.apply_cancel == 1">待审核</view>
  57. <view class="cancel_btn" @click.stop="cancelOrder(item.id, idx)" v-if="item.apply_cancel!=1">
  58. 取消订单</view>
  59. <view class="base_btn" @click.stop="shipments(item)" v-if="item.apply_cancel != 1">立即发货</view>
  60. </view>
  61. <view class="flexS" v-if="item.status == 2">
  62. <view class="base_btn" v-if="item.self_receive == 1 && item.user"
  63. @click.stop="callPhone(item.user.phone)">联系客户</view>
  64. <view class="base_btn" @click.stop="lookLogs(item)" v-else>查看物流</view>
  65. <view class="more_opera" @click.stop="moreOpera(idx)">更多</view>
  66. <view class="dialog" v-if="item.showMore">
  67. <view @click.stop="choose(6, item.order_no, idx)">确认收货</view>
  68. </view>
  69. </view>
  70. <view class="flexS" v-if="item.status == 3">
  71. <view class="base_btn" @click.stop="skipEval">查看评价</view>
  72. <view class="more_opera" @click.stop="moreOpera(idx)">更多</view>
  73. <view class="dialog" v-if="item.showMore">
  74. <view @click.stop="choose(4, item.order_no)"
  75. v-if="item.is_refund != 1 && item.is_refund != 3">申请退货</view>
  76. <view @click.stop="choose(5, item.order_no)" v-if="item.is_refund != 0">退货详情</view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="noData" v-if="orderList.length == 0">
  83. <image src="../../../static/imgs/default/no_order.png"></image>
  84. <view>暂无订单~</view>
  85. </view>
  86. <view class="share_show" v-if="shareShow">
  87. <view class="share_con flexCC">
  88. <text class="iconfont iconguanbi" @click="shareShow = false"></text>
  89. <view class="canvas">
  90. <canvas canvas-id="canvas" style="width: 100%;height:100%;" id="canvas"><img :src="poster"
  91. class="poster_img" mode="widthFix" @click="preview" /></canvas>
  92. </view>
  93. <view class="save_img">点击图片-长按-发送给朋友</view>
  94. </view>
  95. </view>
  96. <view class="qrimg">
  97. <tki-qrcode ref="qrcode" :val="code.val" :size="code.size" :icon="code.icon" :iconSize="code.iconsize"
  98. :onval="code.onval" :loadMake="code.loadMake" :showLoading="code.showLoading"
  99. :loadingText="code.loadingText" @result="drawPoster" />
  100. </view>
  101. <view class="pay_pop flexCC" v-if="payWay">
  102. <view class="pay_con">
  103. <image src="../../../static/imgs/shop/hint.png" class="hint_icon"></image>
  104. <view class="pay_intr flexCC" v-if="payInfo.user">
  105. <text>客户:{{ payInfo.user.nickname }}</text>
  106. <view>{{ payInfo.user.phone }}</view>
  107. </view>
  108. <view class="pay_btn flexC">
  109. <view @click="showPop=true,payWay=false
  110. ">我代为支付</view>
  111. <image src="../../../static/imgs/shop/recommend.png" class="recommend"></image>
  112. <view @click="shareNow(payInfo)">分享给客户支付</view>
  113. </view>
  114. </view>
  115. <text class="iconfont iconguanbi" @click="payWay = false"></text>
  116. </view>
  117. <hint-pop :showPop="showPop" @pay="payMent(payInfo.order_no),showPop=false"
  118. @share="shareNow(payInfo),showPop=false" @close="showPop=false">
  119. </hint-pop>
  120. <show-modal :showPop="showModal" @cancel="skip(0)" @confirm="skip(1)"></show-modal>
  121. </view>
  122. </template>
  123. <script>
  124. /*
  125. *getOrderList 获取订单列表
  126. * orderQuery 查询订单
  127. *
  128. */
  129. import {
  130. getNoFinishOrder,
  131. payMent,
  132. cancelOrder,
  133. cancelAuth,
  134. cancelRefund,
  135. getOrderNum,
  136. receiveOrder,
  137. scanCodeInfo,
  138. getNoSendOrder
  139. } from '@/apis/shop.js';
  140. // import {
  141. // getName
  142. // } from '../../filters/index.js';
  143. import hintPop from '@/components/hint-pop.vue'
  144. import showModal from '@/components/show-modal.vue'
  145. export default {
  146. data() {
  147. return {
  148. remark: '', //备注信息
  149. searchName: '',
  150. orderList: '', //订单列表
  151. total: '', //总条数
  152. params: {
  153. page_size: 6, //每页显示条数
  154. page_index: 1, //当前显示页数
  155. },
  156. isPay: true, //是否可以支付
  157. user_id: '', //用户id
  158. shareShow: false,
  159. model: '',
  160. canvasWidth: '',
  161. canvasHeight: '',
  162. code: {
  163. val: '',
  164. size: 200,
  165. icon: '',
  166. iconsize: 25,
  167. onval: true,
  168. loadMake: '',
  169. showLoading: true,
  170. loadingText: '二维码生成中...'
  171. },
  172. shareGoods: {}, //分享海报上的图片
  173. poster: '', //海报图片
  174. payWay: false, //点击立即付款时显示选择弹窗
  175. payInfo: '', //选择付款或分享的信息
  176. orderTime: '', //倒计时
  177. orderNum: '', //角标数量
  178. store: '',
  179. goods_img: '', //分享的图片
  180. showPop: false, //显示提醒弹窗
  181. showModal: false, //显示合并弹窗
  182. orderDetail: '' //单个订单详情
  183. };
  184. },
  185. components: {
  186. hintPop,
  187. showModal
  188. },
  189. filters: {
  190. //总件数
  191. total(data) {
  192. let total = 0
  193. for (let k in data) {
  194. total += data[k].sku.reduce((t, e) => t + Number(e.num), 0)
  195. }
  196. return total;
  197. },
  198. //总金额
  199. totalMoney(data) {
  200. let totalMoney = 0
  201. for (let k in data) {
  202. totalMoney += data[k].sku.reduce((t, e) => t + Number(e.num) * e.price, 0)
  203. }
  204. return totalMoney;
  205. }
  206. },
  207. /*
  208. * order_no 代表从首页搜索进来
  209. */
  210. onLoad() {
  211. uni.getSystemInfo({
  212. success: res => {
  213. this.model = res.model;
  214. this.canvasWidth = res.windowWidth / 375;
  215. this.canvasHeight = res.windowHeight;
  216. }
  217. });
  218. },
  219. onShow() {
  220. this.store = uni.getStorageSync('store');
  221. this.params.page_index = 1;
  222. this.getOrder();
  223. },
  224. onReachBottom() {
  225. this.getMoreOrder();
  226. },
  227. methods: {
  228. //总件数
  229. totalNum(data) {
  230. let total = 0
  231. for (let k in data) {
  232. total += data[k].sku.reduce((t, e) => t + Number(e.num), 0)
  233. }
  234. return total;
  235. },
  236. //总金额
  237. totalMoney(data) {
  238. let totalMoney = 0
  239. for (let k in data) {
  240. totalMoney += data[k].sku.reduce((t, e) => t + Number(e.num) * e.price, 0)
  241. }
  242. return totalMoney;
  243. },
  244. preview() {
  245. uni.previewImage({
  246. current: this.poster,
  247. urls: [this.poster]
  248. });
  249. },
  250. //立即付款按钮
  251. payNow(item) {
  252. this.payWay = true;
  253. this.payInfo = item
  254. },
  255. //获取角标数量
  256. getNum() {
  257. getOrderNum({
  258. user_id: this.user_id
  259. }).then(res => {
  260. if (res.code == 200) {
  261. this.orderNum = res.data;
  262. } else {
  263. uni.showModal({
  264. content: res.data || '获取角标失败',
  265. showCancel: false
  266. })
  267. }
  268. });
  269. },
  270. //倒计时
  271. coutdown(date) {
  272. const add0 = num => (num < 10 ? '0' + num : num);
  273. const now = Math.floor(Date.now() / 1000);
  274. let sec = Math.floor(Number(date) - now);
  275. if (sec > 0) {
  276. const day = Math.floor(sec / 86400);
  277. const hour = Math.floor((sec % 86400) / 3600);
  278. const minite = Math.floor((sec - 86400 * day - hour * 3600) / 60);
  279. const second = Math.floor(sec - 86400 * day - hour * 3600 - minite * 60);
  280. return `${add0(minite)}:${add0(second)}`;
  281. } else {
  282. this.timer = null;
  283. return false;
  284. }
  285. },
  286. getCount() {
  287. let list = this.orderList;
  288. list.map(i => {
  289. if (i.status == 0) {
  290. let creat_at = i.created_at.replace(/-/g, '/');
  291. let end = new Date(creat_at).getTime() / 1000 + 1 * 60 * 60;
  292. let now = Math.floor(Date.now() / 1000);
  293. let diff = end - now;
  294. if (diff > 0) {
  295. this.timer = setInterval(() => {
  296. this.$set(i, 'countdown', this.coutdown(end));
  297. }, 1000);
  298. } else {
  299. clearInterval(this.timer);
  300. }
  301. }
  302. });
  303. },
  304. //点击更多
  305. moreOpera(idx) {
  306. this.cur = 0;
  307. let list = this.orderList;
  308. list.map((i, index) => {
  309. if (idx == index) {
  310. i.showMore = !i.showMore;
  311. } else {
  312. this.$set(i, 'showMore', false);
  313. }
  314. });
  315. },
  316. //更多里面的选择
  317. choose(tabType, item, idx) {
  318. // this.cur = tabType;
  319. switch (tabType) {
  320. case 1: //立即分享
  321. this.shareNow(item, idx);
  322. break;
  323. case 2: //取消订单
  324. this.cancelOrder(item, idx);
  325. break;
  326. // case 3:
  327. // //联系客户
  328. // this.callPhone(item, idx);
  329. // break;
  330. case 4: //申请退货
  331. this.applyReturn(item);
  332. break;
  333. case 5: //退货详情
  334. this.refundDetail(item);
  335. break;
  336. case 6: //确认收货
  337. this.confirmReceipt(item, idx);
  338. break;
  339. default:
  340. break;
  341. }
  342. },
  343. //确认收货
  344. confirmReceipt(order_no, idx) {
  345. this.orderList[idx].showMore = false;
  346. uni.showModal({
  347. content: '你确定用户已经收到货了吗?',
  348. success: res => {
  349. if (res.confirm) {
  350. uni.showLoading({
  351. title: '确认中...'
  352. })
  353. receiveOrder({
  354. order_no
  355. }).then(res => {
  356. if (res.code == 200) {
  357. uni.showModal({
  358. content: '帮客户确认收货成功',
  359. showCancel: false,
  360. success: res => {
  361. this.params.status = 4;
  362. this.params.page_index = 1;
  363. this.getOrder();
  364. this.getNum();
  365. }
  366. })
  367. } else {
  368. uni.showModal({
  369. content: res.msg || '确认收货失败',
  370. showCancel: false
  371. });
  372. }
  373. uni.hideLoading()
  374. }).catch(err => {
  375. uni.hideLoading()
  376. })
  377. }
  378. }
  379. });
  380. },
  381. //申请退货
  382. applyReturn(order_no) {
  383. uni.navigateTo({
  384. url: '../apply-return/apply-return?order_no=' + order_no
  385. });
  386. },
  387. //立即分享按钮
  388. shareNow(item) {
  389. this.payWay = false;
  390. this.code.val =
  391. `${this.$config.share_url}#pages/scan-order/scan-order?order_no=${item.order_no}`;
  392. let goods = item.goods;
  393. let good = Object.values(goods);
  394. let img = good[0].img.replaceAll('http', 'https');
  395. uni.getImageInfo({
  396. src: img,
  397. success: res => {
  398. this.goods_img = res.path
  399. }
  400. })
  401. this.shareGoods = {
  402. // img: good[0].img.replaceAll('http', 'https'),
  403. price: this.totalMoney(goods),
  404. num: this.totalNum(goods),
  405. name: good.length > 1 ? good[0].main_attr + '...等' : good[0].main_attr
  406. };
  407. this.shareShow = true;
  408. this.$refs.qrcode._makeCode();
  409. },
  410. blobToDataURI(blob, callback) {
  411. var reader = new FileReader();
  412. reader.readAsDataURL(blob);
  413. reader.onload = function(e) {
  414. callback(e.target.result);
  415. };
  416. },
  417. //绘制海报
  418. drawPoster(codeImg) {
  419. let _this = this;
  420. uni.showLoading({
  421. title: '图片加载中...'
  422. });
  423. let goods = _this.shareGoods;
  424. uni.getImageInfo({
  425. src: 'https://api.wd.cliu.cc/good_poster.png',
  426. success: res => {
  427. uni.showLoading({
  428. title: '图片生成中...',
  429. })
  430. let ctx = uni.createCanvasContext('canvas');
  431. let store = uni.getStorageSync('store');
  432. store.name = store.name.length > 7 ? store.name.slice(0, 7) + '...的店铺' : store.name +
  433. '的店铺';
  434. let rpx = _this.canvasWidth;
  435. //背景图
  436. ctx.drawImage(res.path, 0, 0, 270 * rpx, 480 * rpx);
  437. //店铺名称
  438. ctx.font = 'normal bold 14px Microsoft YaHei';
  439. ctx.textAlign = 'center';
  440. ctx.fillText(store.name, uni.upx2px(270), uni.upx2px(210));
  441. //商品图
  442. ctx.drawImage(this.goods_img, uni.upx2px(110), uni.upx2px(270), uni.upx2px(130), uni
  443. .upx2px(
  444. 103));
  445. //商品款式
  446. ctx.font = 'normal bold 14px Microsoft YaHei';
  447. ctx.fillText(goods.name, goods.name.length > 3 ? uni.upx2px(320) : uni.upx2px(290), uni
  448. .upx2px(300));
  449. //商品数量
  450. ctx.font = 'normal normal 12px Microsoft YaHei';
  451. ctx.setFillStyle('#999999');
  452. ctx.fillText(`${goods.num}套`, uni.upx2px(282), uni.upx2px(340));
  453. //商品价格
  454. ctx.font = 'normal bold 12px Microsoft YaHei';
  455. ctx.setFillStyle('#FB231F');
  456. ctx.fillText(`¥`, uni.upx2px(340), uni.upx2px(365));
  457. ctx.font = 'normal bold 16px Microsoft YaHei';
  458. ctx.setFillStyle('#FB231F');
  459. ctx.fillText(goods.price, uni.upx2px(400), uni.upx2px(365));
  460. //二维码
  461. ctx.drawImage(codeImg, uni.upx2px(110), uni.upx2px(420), uni.upx2px(320), uni.upx2px(
  462. 320));
  463. //扫一扫下单,安全有保障
  464. ctx.font = 'noraml bold 14px 微软雅黑';
  465. ctx.textAlign = 'center';
  466. ctx.setFillStyle('#060001');
  467. ctx.fillText('微信-扫一扫-支付', uni.upx2px(270), uni.upx2px(790));
  468. setTimeout(res => {
  469. ctx.draw(false, () => {
  470. uni.canvasToTempFilePath({
  471. width: 270 * rpx,
  472. height: 480 * rpx,
  473. canvasId: 'canvas',
  474. success: res => {
  475. uni.hideLoading();
  476. if (this.model == 'iPhone') {
  477. this.poster = this.dataURLtoFile(res
  478. .tempFilePath).name;
  479. } else {
  480. let url = res.tempFilePath.replace(
  481. /\. +/g, '');
  482. this.poster = url.replace(/[\r\n]/g,
  483. '');
  484. }
  485. },
  486. fail: () => {
  487. uni.hideLoading();
  488. }
  489. });
  490. });
  491. }, 500);
  492. }
  493. });
  494. },
  495. //0 不一起发货 1一起发货
  496. skip(type) {
  497. this.showModal = false;
  498. if (type === 0) {
  499. uni.navigateTo({
  500. url: '../../pagesA/pages/delivery-method/delivery-method?order_no=' +
  501. this.orderDetail.order_no + '&user_id=' +
  502. this.orderDetail.user_id
  503. });
  504. return false;
  505. }
  506. uni.navigateTo({
  507. url: '../../pagesA/pages/merge-order/merge-order?order_no=' + this.orderDetail.order_no
  508. })
  509. },
  510. //跳转发货方式
  511. shipments(item) {
  512. const {
  513. order_no,
  514. user_id
  515. } = item;
  516. uni.showLoading({
  517. title: '加载中...'
  518. })
  519. getNoSendOrder({ //如果当天有同一人订单,一起发货
  520. order_no
  521. }).then(res => {
  522. if (res.code == 200) {
  523. let list = res.data;
  524. let len = list.length
  525. if (len < 1) {
  526. uni.showModal({
  527. content: '订单状态有误,请刷新页面重试',
  528. showCancel: false
  529. })
  530. return false
  531. }
  532. if (len === 1) {
  533. uni.navigateTo({
  534. url: '../delivery-method/delivery-method?order_no=' +
  535. order_no + '&user_id=' +
  536. user_id
  537. });
  538. return false;
  539. }
  540. this.showModal = true
  541. this.orderDetail = item;
  542. } else {
  543. uni.showModal({
  544. content: res.data,
  545. showCancel: false
  546. })
  547. }
  548. uni.hideLoading()
  549. }).catch(err => {
  550. uni.hideLoading()
  551. })
  552. },
  553. //直接扫码发货
  554. scanCode(item) {
  555. uni.navigateTo({
  556. url: '../send-code/send-code?order_no=' + item.order_no
  557. })
  558. },
  559. //跳转到退货详情
  560. refundDetail(order_no, idx) {
  561. uni.navigateTo({
  562. url: '../../../pages/refund_detail/refund_detail?order_no=' + order_no
  563. });
  564. },
  565. //跳转到待审核
  566. skipAudit(item) {
  567. uni.navigateTo({
  568. url: '../../../pages/cancel-audit/cancel-audit?order_no=' + item.order_no + '&id=' + item
  569. .order_cancel.id
  570. });
  571. },
  572. /*联系客户*/
  573. callPhone(phone) {
  574. if (!phone) {
  575. uni.showToast({
  576. title: '暂无联系方式',
  577. icon: 'none'
  578. });
  579. return false;
  580. }
  581. uni.makePhoneCall({
  582. phoneNumber: phone
  583. });
  584. },
  585. /*取消订单*/
  586. cancelOrder(order_id, idx) {
  587. this.orderList[idx].showMore = false;
  588. uni.showModal({
  589. content: '确定要取消该订单么?',
  590. success: res => {
  591. if (res.confirm) {
  592. uni.showLoading({
  593. title: '取消中...'
  594. })
  595. cancelOrder({
  596. order_id
  597. }).then(res => {
  598. if (res.code == 200) {
  599. uni.showModal({
  600. content: '取消订单成功',
  601. showCancel: false
  602. });
  603. let list = this.orderList;
  604. list.map((i, idx) => {
  605. i.id == order_id ? list.splice(idx, 1) : '';
  606. });
  607. this.getNum();
  608. } else {
  609. uni.showModal({
  610. content: res.data || '取消订单失败',
  611. showCancel: false
  612. });
  613. }
  614. uni.hideLoading()
  615. }).catch(err => {
  616. uni.hideLoading()
  617. })
  618. }
  619. }
  620. });
  621. },
  622. goTop() {
  623. // 一键回到顶部
  624. if (uni.pageScrollTo) {
  625. uni.pageScrollTo({
  626. scrollTop: 0
  627. });
  628. }
  629. },
  630. /*获取订单列表
  631. *page_index 当前页面
  632. *page_size 每页条数
  633. *status 状态 0待付款 1待发货 2待收货 3已完成
  634. */
  635. getOrder(isMore) {
  636. uni.showLoading({
  637. title: '加载中...'
  638. });
  639. getNoFinishOrder(this.params)
  640. .then(res => {
  641. if (res.code == 200) {
  642. this.total = Math.ceil(res.data.total / this.params.page_size);
  643. this.orderList = isMore ? this.orderList.concat(res.data.list) : res.data.list;
  644. this.orderList.map(i => {
  645. this.$set(i, 'showMore', false);
  646. });
  647. if (status == 0 || status == 'all') {
  648. this.getCount();
  649. }
  650. } else {
  651. uni.showModal({
  652. content: res.data,
  653. showCancel: false
  654. });
  655. }
  656. uni.hideLoading();
  657. })
  658. .catch(err => {
  659. uni.hideLoading();
  660. });
  661. },
  662. //上拉加载更多
  663. getMoreOrder() {
  664. if (this.params.page_index >= this.total) {
  665. uni.showToast({
  666. title: '没有更多啦~',
  667. icon: 'none'
  668. });
  669. return false;
  670. }
  671. this.params.page_index++;
  672. this.getOrder(true);
  673. },
  674. /*查看物流*/
  675. lookLogs(item) {
  676. let good = Object.values(item.goods)
  677. let img = good[0].img.replaceAll('http', 'https');
  678. uni.navigateTo({
  679. url: '../../../pages/logistics-detail/logistics-detail?order_no=' + item.order_no + '&img=' +
  680. img
  681. });
  682. },
  683. /*查看评价*/
  684. skipEval() {
  685. uni.navigateTo({
  686. url: '../../../pages/evaluate/evaluate'
  687. });
  688. },
  689. /*订单详情
  690. * order_no 当前订单的订单号
  691. */
  692. skipDel(order_no) {
  693. uni.navigateTo({
  694. url: '../../../pages/order-info/order-info?order_no=' + order_no
  695. });
  696. },
  697. /*物流发货*/
  698. sendGoods(order_no) {
  699. uni.navigateTo({
  700. url: '../../../pages/send-goods/send-goods?order_no=' + order_no
  701. });
  702. },
  703. /*立即付款*/
  704. async payMent(order_no) {
  705. this.payWay = false;
  706. if (!this.isPay) {
  707. uni.showModal({
  708. content: '请稍后重试~',
  709. showCancel: false
  710. });
  711. return false;
  712. }
  713. this.isPay = false;
  714. uni.showLoading({
  715. title: '加载中...'
  716. })
  717. payMent({
  718. order_no
  719. })
  720. .then(res => {
  721. if (res.error_code === 200) {
  722. let data = res.data;
  723. uni.requestPayment({
  724. timeStamp: data.timestamp,
  725. nonceStr: data.nonceStr,
  726. package: data.package,
  727. signType: data.signType,
  728. paySign: data.paySign,
  729. success: res => {
  730. this.params.page_index = 1;
  731. this.getOrder();
  732. },
  733. fail: err => {
  734. uni.showModal({
  735. content: '支付失败',
  736. showCancel: false
  737. })
  738. }
  739. })
  740. } else {
  741. uni.showModal({
  742. content: res.msg || '支付失败',
  743. showCancel: false
  744. })
  745. }
  746. uni.hideLoading();
  747. })
  748. .catch(err => {
  749. this.isPay = true;
  750. uni.hideLoading();
  751. })
  752. .finally(() => {
  753. setTimeout(() => {
  754. this.isPay = true;
  755. }, 3000);
  756. uni.hideLoading();
  757. });
  758. }
  759. }
  760. };
  761. </script>
  762. <style>
  763. page {
  764. min-height: 100%;
  765. width: 100%;
  766. background-color: #f9f9fb;
  767. }
  768. </style>
  769. <style lang="scss" scoped>
  770. .no_scroll {
  771. postion: relative;
  772. height: 100vh;
  773. overflow-y: hidden;
  774. }
  775. .order_manage {
  776. postion: relative;
  777. padding-bottom: 180rpx;
  778. .order_list {
  779. margin: 30rpx 0 120rpx;
  780. .list_con {
  781. width: 690rpx;
  782. margin: 30rpx auto 0;
  783. background-color: #fff;
  784. font-size: 28rpx;
  785. border-radius: 24rpx;
  786. position: relative;
  787. .goods_con {
  788. border-top: 1rpx solid #e9e9e9;
  789. border-bottom: 1rpx solid #e9e9e9;
  790. .goods_img {
  791. width: 188rpx;
  792. height: 144rpx;
  793. margin-right: 20rpx;
  794. border-radius: 8rpx;
  795. flex-shrink: 0;
  796. }
  797. >view {
  798. margin-top: 15rpx;
  799. }
  800. }
  801. .goods_opera {
  802. .more_opera {
  803. font-size: 36rpx;
  804. color: #999;
  805. font-weight: bold;
  806. margin-left: 15rpx;
  807. }
  808. .dialog {
  809. position: absolute;
  810. background-color: #fff;
  811. margin: 20rpx auto;
  812. bottom: 82rpx;
  813. right: 20rpx;
  814. width: 220rpx;
  815. text-align: center;
  816. border-radius: 8rpx;
  817. box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16);
  818. &:after {
  819. content: '';
  820. position: absolute;
  821. width: 0;
  822. height: 0;
  823. border: 10rpx solid transparent;
  824. border-top-color: #fff;
  825. top: 100%;
  826. left: 50%;
  827. margin-left: 72rpx;
  828. }
  829. >view {
  830. height: 88rpx;
  831. line-height: 88rpx;
  832. font-size: 32rpx;
  833. }
  834. >view:not(:last-child) {
  835. border-bottom: 2rpx solid #eeeeee;
  836. }
  837. }
  838. }
  839. >view {
  840. padding: 20rpx 20rpx;
  841. box-sizing: border-box;
  842. }
  843. >view:first-child {
  844. padding: 25rpx 10rpx;
  845. }
  846. .refund_img {
  847. width: 202rpx;
  848. height: 170rpx;
  849. position: absolute;
  850. top: 15rpx;
  851. right: 25rpx;
  852. }
  853. .close_order {
  854. width: 630rpx;
  855. background: #ffeac7;
  856. color: $base-color;
  857. font-size: 28rpx;
  858. font-weight: bold;
  859. margin: 15rpx auto 0;
  860. border-radius: 8rpx;
  861. padding: 8rpx 0 8rpx 30rpx;
  862. }
  863. .cancel_img {
  864. width: 195rpx;
  865. height: 125rpx;
  866. position: absolute;
  867. top: 0;
  868. right: 30rpx;
  869. }
  870. .opear_btn {
  871. width: 192rpx;
  872. height: 68rpx;
  873. background: $base-line-bg;
  874. opacity: 1;
  875. border-radius: 34rpx;
  876. color: #fff;
  877. font-size: 28rpx;
  878. margin-left: 20rpx;
  879. }
  880. .price {
  881. display: flex;
  882. flex-direction: column;
  883. align-items: flex-end;
  884. }
  885. .ident {
  886. background: rgba(65, 133, 245, 0.1);
  887. color: #4185f5;
  888. padding: 5rpx 15rpx;
  889. border-radius: 28rpx 8rpx 28rpx 8rpx;
  890. flex-shrink: 0;
  891. }
  892. }
  893. }
  894. }
  895. .share_show {
  896. width: 100%;
  897. height: 100vh;
  898. position: fixed;
  899. top: 0;
  900. left: 0;
  901. background-color: rgba(0, 0, 0, 0.7);
  902. z-index: 999;
  903. .share_con {
  904. width: 80%;
  905. margin: 0 auto;
  906. height: 100%;
  907. z-index: 999999;
  908. .canvas {
  909. width: 540rpx;
  910. height: 960rpx;
  911. position: relative;
  912. #canvas {
  913. width: 540rpx;
  914. height: 960rpx;
  915. position: absolute;
  916. top: 0;
  917. left: 0;
  918. }
  919. .poster_img {
  920. -webkit-touch-callout: default;
  921. width: 100%;
  922. height: 100%;
  923. display: block;
  924. }
  925. img[src=''],
  926. img:not([src]) {
  927. opacity: 0;
  928. }
  929. // image {
  930. // width: 100%;
  931. // height: 100%;
  932. // border-radius: 24rpx;
  933. // }
  934. }
  935. .save_img {
  936. color: #fff;
  937. width: 100%;
  938. text-align: center;
  939. font-size: 40rpx;
  940. margin-top: 20rpx;
  941. }
  942. .iconfont {
  943. position: absolute;
  944. top: 4vh;
  945. right: 25rpx;
  946. color: #dedede;
  947. font-size: 60rpx;
  948. z-index: 999;
  949. }
  950. }
  951. .sub_btn {
  952. margin-top: 76rpx;
  953. }
  954. }
  955. .qrimg {
  956. opacity: 0;
  957. }
  958. .pay_pop {
  959. width: 100vw;
  960. height: 100vh;
  961. background: rgba(0, 0, 0, 0.8);
  962. position: fixed;
  963. top: 0;
  964. left: 0;
  965. z-index: 99999;
  966. .pay_con {
  967. position: relative;
  968. width: 620rpx;
  969. text-align: center;
  970. margin: 0 auto;
  971. min-height: 384rpx;
  972. background: #fff;
  973. border-radius: 8rpx;
  974. display: flex;
  975. flex-direction: column;
  976. align-items: center;
  977. .pay_title {
  978. font-size: 32rpx;
  979. font-weight: bold;
  980. margin-top: 85rpx;
  981. }
  982. .pay_intr {
  983. font-size: 30rpx;
  984. font-weight: bold;
  985. margin: 100rpx 0 50rpx;
  986. min-height: 100rpx;
  987. view {
  988. color: #999;
  989. margin-top: 15rpx;
  990. }
  991. }
  992. .hint_icon {
  993. width: 183rpx;
  994. height: 135rpx;
  995. position: absolute;
  996. top: -67rpx;
  997. margin-left: 18rpx;
  998. }
  999. .pay_btn {
  1000. position: relative;
  1001. width: 560rpx;
  1002. height: 88rpx;
  1003. view {
  1004. width: 360rpx;
  1005. height: 88rpx;
  1006. line-height: 88rpx;
  1007. color: #fff;
  1008. text-align: center;
  1009. font-size: 32rpx;
  1010. }
  1011. view:first-child {
  1012. width: 200rpx;
  1013. height: 84rpx;
  1014. background: #FFF4F3;
  1015. border: 2rpx solid $base-color;
  1016. border-radius: 44rpx 0 0 44rpx;
  1017. color: $base-color;
  1018. }
  1019. view:last-child {
  1020. background: $base-line-bg;
  1021. border-radius: 0 44rpx 44rpx 0;
  1022. text-align: left;
  1023. padding-left: 24rpx;
  1024. box-sizing: border-box;
  1025. }
  1026. .recommend {
  1027. width: 76rpx;
  1028. height: 48rpx;
  1029. position: absolute;
  1030. top: 0rpx;
  1031. right: 29rpx;
  1032. }
  1033. }
  1034. }
  1035. .iconfont {
  1036. margin-top: 30rpx;
  1037. color: #fff;
  1038. font-size: 60rpx;
  1039. }
  1040. }
  1041. </style>