order-manage.vue 34 KB

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