1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405 |
- <template>
- <view class="order_manage" :class="showModal?'no_scroll':''">
- <view class="order_top">
- <view class="inp flexB">
- <view class="search_inp flexB">
- <text class="iconfont iconsearch"></text>
- <input placeholder="请输入订单号/手机号/昵称" v-model="params.order_no"
- placeholder-style="color:#999;font-size:28rpx;" />
- <text class="iconfont icondelete" @click="(params.order_no = ''), getOrder()"></text>
- </view>
- <view class="search_btn" @click="search">查询</view>
- </view>
- <view class="tabs flexB">
- <view class="tab_item" @click="cutTab(0)" :class="params.status == 0 ? 'tab_active' : ''">
- <view class="tab_status">全部</view>
- </view>
- <view class="tab_item" @click="cutTab(1)" :class="params.status == 1 ? 'tab_active' : ''">
- <text class="tab_status">待付款</text>
- <text class="tab_num" v-if="orderNum.noPay > 0 && !params.order_no"
- :class="orderNum.noPay > 99 ? 'more_num' : ''">{{ orderNum.noPay | moreNum }}</text>
- </view>
- <view class="tab_item" @click="cutTab(2)" :class="params.status == 2 ? 'tab_active' : ''">
- <text class="tab_status">待发货</text>
- <text class="tab_num" v-if="orderNum.noSend > 0 && !params.order_no"
- :class="orderNum.noSend > 99 ? 'more_num' : ''">{{ orderNum.noSend | moreNum }}</text>
- </view>
- <view class="tab_item" @click="cutTab(3)" :class="params.status == 3 ? 'tab_active' : ''">
- <text class="tab_status">待收货</text>
- <text class="tab_num" v-if="orderNum.noReceive > 0 && !params.order_no"
- :class="orderNum.noReceive > 99 ? 'more_num' : ''">
- {{ orderNum.noReceive | moreNum }}
- </text>
- </view>
- <view class="tab_item" @click="cutTab(4)" :class="params.status == 4 ? 'tab_active' : ''">
- <text class="tab_status">已完成</text>
- <text class="tab_num" v-if="orderNum.Finish > 0 && !params.order_no"
- :class="orderNum.Finish > 99 ? 'more_num' : ''">{{ orderNum.Finish | moreNum }}</text>
- </view>
- </view>
- </view>
- <view class="order_list" v-if="orderList">
- <view class="list_con" @click="skipDel(item.order_no)" v-for="(item, idx) in orderList" :key="idx">
- <image src="../../static/imgs/shop/all_refund.png" class="refund_img" v-if="item.is_refund == 3">
- </image>
- <image src="../../static/imgs/shop/part_refund.png" class="refund_img" v-if="item.is_refund == 2">
- </image>
- <image src="../../static/imgs/shop/audit_refund.png" class="refund_img" v-if="item.is_refund == 1">
- </image>
- <view class="flexB">
- <text>订单号:{{ item.order_no }}</text>
- <text v-if="item.is_help == 1" class="ident">代下单</text>
- </view>
- <view class="goods_con">
- <view v-for="(temp,key,index) in item.goods" :key="index">
- <view class="flexB">
- <view class="flexS">
- <image :src="temp.img" class="goods_img"></image>
- <view>
- <view style="font-size:28rpx;font-weight: bold;">
- {{ temp.name }}
- </view>
- <view class="one_year" style="width: 120rpx;">3条装</view>
- </view>
- </view>
- <view class="price">
- <view style="color:#999;" v-if="temp.sku">X
- {{temp.sku.reduce((t, e) => t + Number(e.num), 0) ||0}}
- </view>
- <view style="margin-top:26rpx;" v-if="temp.sku">¥{{temp.sku[0].price}}</view>
- </view>
- </view>
- </view>
- <view class="flexE">
- <text v-if="item.goods" class="gray">共{{totalNum(item.goods)}}套,</text>
- <text class="gray">合计:</text>
- <text class="total">
- <text>¥</text>
- <text v-if="item.goods">{{totalMoney(item.goods)}}</text>
- </text>
- </view>
- </view>
- <view class="close_order" v-if="item.status == 0 && item.countdown">订单关闭倒计时: {{ item.countdown }},请尽快支付。
- </view>
- <view class="close_order" v-if="item.apply_cancel == 3 && item.status == 1">
- 已驳回客户发出的取消订单申请,请正常发货。
- </view>
- <view :class="item.user ? 'flexB' : 'flexE'" class="goods_opera">
- <view v-if="item.user">客户:{{ item.user.nickname | getName(item.status==1?5:9) }}</view>
- <view v-if="item.status == 0" class="flexE">
- <view class="base_btn" v-if="item.is_help == 1" @click.stop="payNow(item)">
- 立即付款</view>
- <view class="base_btn" @click.stop="callPhone(item.user.phone)"
- v-if="item.user && item.is_help == 0">联系客户</view>
- <view class="more_opera" @click.stop="moreOpera(idx)">更多</view>
- <view class="dialog" v-if="item.showMore">
- <view @click.stop="choose(2, item.id, idx)">取消订单</view>
- </view>
- </view>
- <view class="flexS" v-if="item.status == 1">
- <view class="audit_btn" @click.stop="skipAudit(item)" v-if="item.apply_cancel == 1">待审核</view>
- <view class="cancel_btn" @click.stop="cancelOrder(item.id, idx)" v-if="item.apply_cancel!=1">
- 取消订单</view>
- <view class="base_btn" @click.stop="shipments(item)" v-if="item.apply_cancel != 1">立即发货</view>
- <!-- <view class="base_btn" @click.stop="scanCode(item)" v-if="item.apply_cancel != 1">扫码发货</view> -->
- </view>
- <view class="flexS" v-if="item.status == 2">
- <view class="base_btn" v-if="item.self_receive == 1 && item.user"
- @click.stop="callPhone(item.user.phone)">联系客户</view>
- <view class="base_btn" @click.stop="lookLogs(item)" v-else>查看物流</view>
- <view class="more_opera" @click.stop="moreOpera(idx)">更多</view>
- <view class="dialog" v-if="item.showMore">
- <view @click.stop="choose(6, item.order_no, idx)">确认收货</view>
- </view>
- </view>
- <view class="flexS" v-if="item.status == 3">
- <view class="base_btn" @click.stop="skipEval">查看评价</view>
- <view class="more_opera" @click.stop="moreOpera(idx)">更多</view>
- <view class="dialog" v-if="item.showMore">
- <view @click.stop="choose(4, item.order_no)"
- v-if="item.is_refund != 1 && item.is_refund != 3">申请退货</view>
- <view @click.stop="choose(5, item.order_no)" v-if="item.is_refund != 0">退货详情</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="noData" v-if="orderList.length == 0">
- <image src="../../static/imgs/default/no_order-min.png"></image>
- <view>暂无订单~</view>
- </view>
- <view class="share_show" v-if="shareShow">
- <view class="share_con flexCC">
- <text class="iconfont iconguanbi" @click="shareShow = false"></text>
- <view class="canvas">
- <canvas canvas-id="canvas" style="width: 100%;height:100%;" id="canvas"><img :src="poster"
- class="poster_img" mode="widthFix" @click="preview" /></canvas>
- </view>
- <view class="save_img">点击图片-长按-发送给朋友</view>
- </view>
- </view>
- <view class="qrimg">
- <tki-qrcode ref="qrcode" :val="code.val" :size="code.size" :icon="code.icon" :iconSize="code.iconsize"
- :onval="code.onval" :loadMake="code.loadMake" :showLoading="code.showLoading"
- :loadingText="code.loadingText" @result="drawPoster" />
- </view>
- <view class="pay_pop flexCC" v-if="payWay">
- <view class="pay_con">
- <image src="../../static/imgs/shop/hint.png" class="hint_icon"></image>
- <view class="pay_intr flexCC" v-if="payInfo.user">
- <text>客户:{{ payInfo.user.nickname }}</text>
- <view>{{ payInfo.user.phone }}</view>
- </view>
- <view class="pay_btn flexC">
- <view @click="showPop=true,payWay=false
- ">我代为支付</view>
- <image src="../../static/imgs/shop/recommend.png" class="recommend"></image>
- <view @click="shareNow(payInfo)">分享给客户支付</view>
- </view>
- </view>
- <text class="iconfont iconguanbi" @click="payWay = false"></text>
- </view>
- <hint-pop :showPop="showPop" @pay="payMent(payInfo.order_no),showPop=false"
- @share="shareNow(payInfo),showPop=false" @close="showPop=false">
- </hint-pop>
- <show-modal :showPop="showModal" @cancel="skip(0)" @confirm="skip(1)"></show-modal>
- </view>
- </template>
- <script>
- /*
- *getOrderList 获取订单列表
- * orderQuery 查询订单
- *
- */
- import {
- getOrderList,
- pickUp,
- payMent,
- orderQuery,
- getUserOrder,
- cancelOrder,
- cancelAuth,
- cancelRefund,
- getOrderNum,
- receiveOrder,
- scanCodeInfo,
- getNoSendOrder
- } from '@/apis/shop.js';
- import {
- getName
- } from '../../filters/index.js';
- import hintPop from '../../components/hint-pop.vue'
- import showModal from '../../components/show-modal.vue'
- export default {
- data() {
- return {
- remark: '', //备注信息
- searchName: '',
- orderList: '', //订单列表
- total: '', //总条数
- params: {
- page_size: 6, //每页显示条数
- page_index: 1, //当前显示页数
- status: 0, //0 全部 1待付款 2待发货 3待收货 4已完成
- order_no: ''
- },
- isPay: true, //是否可以支付
- user_id: '', //用户id
- shareShow: false,
- model: '',
- canvasWidth: '',
- canvasHeight: '',
- code: {
- val: '',
- size: 200,
- icon: '',
- iconsize: 25,
- onval: true,
- loadMake: '',
- showLoading: true,
- loadingText: '二维码生成中...'
- },
- shareGoods: {}, //分享海报上的图片
- poster: '', //海报图片
- payWay: false, //点击立即付款时显示选择弹窗
- payInfo: '', //选择付款或分享的信息
- orderTime: '', //倒计时
- orderNum: '', //角标数量
- store: '',
- goods_img: '', //分享的图片
- showPop: false, //显示提醒弹窗
- showModal: false, //显示合并弹窗
- orderDetail: '', //单个订单详情
- timer: null
- };
- },
- components: {
- hintPop,
- showModal
- },
- filters: {
- moreNum(val) {
- if (!val) return 0;
- return val > 99 ? '99+' : val;
- },
- //总件数
- total(data) {
- let total = 0
- for (let k in data) {
- total += data[k].sku.reduce((t, e) => t + Number(e.num), 0)
- }
- return total;
- },
- //总金额
- totalMoney(data) {
- let totalMoney = 0
- for (let k in data) {
- totalMoney += data[k].sku.reduce((t, e) => t + Number(e.num) * e.price, 0)
- }
- return totalMoney;
- }
- },
- /*
- * order_no 代表从首页搜索进来
- */
- onLoad({
- status,
- user_id,
- nickname,
- order_no
- }) {
- this.params.order_no = order_no == undefined || order_no == 'undefined' ? '' : order_no;
- this.params.status = status ? status : 0;
- //如果有user_id和nickname代表是从用户管理点击用户进入的订单管理
- this.user_id = user_id ? user_id : '';
- let title = '';
- if (nickname) {
- title = `${nickname}的订单`;
- } else {
- title = '订单管理';
- }
- uni.setNavigationBarTitle({
- title
- });
- uni.getSystemInfo({
- success: res => {
- this.model = res.model;
- this.canvasWidth = res.windowWidth / 375;
- this.canvasHeight = res.windowHeight;
- }
- });
- },
- onShow() {
- this.store = uni.getStorageSync('store');
- this.params.page_index = 1;
- this.getOrder();
- this.getNum();
- },
- onReachBottom() {
- this.getMoreOrder();
- },
- methods: {
- //总件数
- totalNum(data) {
- let total = 0
- for (let k in data) {
- total += data[k].sku.reduce((t, e) => t + Number(e.num), 0)
- }
- return total;
- },
- //总金额
- totalMoney(data) {
- let totalMoney = 0
- for (let k in data) {
- totalMoney += data[k].sku.reduce((t, e) => t + Number(e.num) * e.price, 0)
- }
- return totalMoney;
- },
- preview() {
- uni.previewImage({
- current: this.poster,
- urls: [this.poster]
- });
- },
- //立即付款按钮
- payNow(item) {
- uni.showModal({
- content: '付款功能暂停使用',
- showCancel: false
- })
- return
- this.payWay = true;
- this.payInfo = item
- },
- //获取角标数量
- getNum() {
- getOrderNum({
- user_id: this.user_id
- }).then(res => {
- if (res.code == 200) {
- this.orderNum = res.data;
- } else {
- uni.showModal({
- content: res.data || '获取角标失败',
- showCancel: false
- })
- }
- });
- },
- //倒计时
- coutdown(date) {
- const add0 = num => (num < 10 ? '0' + num : num);
- const now = Math.floor(Date.now() / 1000);
- let sec = Math.floor(Number(date) - now);
- if (sec > 0) {
- const day = Math.floor(sec / 86400);
- const hour = Math.floor((sec % 86400) / 3600);
- const minite = Math.floor((sec - 86400 * day - hour * 3600) / 60);
- const second = Math.floor(sec - 86400 * day - hour * 3600 - minite * 60);
- return `${add0(minite)}:${add0(second)}`;
- } else {
- this.timer = null;
- return false;
- }
- },
- getCount() {
- let list = this.orderList;
- list.map(i => {
- if (i.status == 0) {
- let creat_at = i.created_at.replace(/-/g, '/');
- let end = new Date(creat_at).getTime() / 1000 + 1 * 60 * 60;
- let now = Math.floor(Date.now() / 1000);
- let diff = end - now;
- if (diff > 0) {
- this.timer = setInterval(() => {
- this.$set(i, 'countdown', this.coutdown(end));
- }, 1000);
- } else {
- clearInterval(this.timer);
- }
- }
- });
- },
- //点击更多
- moreOpera(idx) {
- this.cur = 0;
- let list = this.orderList;
- list.map((i, index) => {
- if (idx == index) {
- i.showMore = !i.showMore;
- } else {
- this.$set(i, 'showMore', false);
- }
- });
- },
- //更多里面的选择
- choose(tabType, item, idx) {
- // this.cur = tabType;
- switch (tabType) {
- case 1: //立即分享
- this.shareNow(item, idx);
- break;
- case 2: //取消订单
- this.cancelOrder(item, idx);
- break;
- // case 3:
- // //联系客户
- // this.callPhone(item, idx);
- // break;
- case 4: //申请退货
- this.applyReturn(item);
- break;
- case 5: //退货详情
- this.refundDetail(item);
- break;
- case 6: //确认收货
- this.confirmReceipt(item, idx);
- break;
- default:
- break;
- }
- },
- //确认收货
- confirmReceipt(order_no, idx) {
- this.orderList[idx].showMore = false;
- uni.showModal({
- content: '你确定用户已经收到货了吗?',
- success: res => {
- if (res.confirm) {
- uni.showLoading({
- title: '确认中...'
- })
- receiveOrder({
- order_no
- }).then(res => {
- if (res.code == 200) {
- uni.showModal({
- content: '帮客户确认收货成功',
- showCancel: false,
- success: res => {
- this.params.status = 4;
- this.params.page_index = 1;
- this.getOrder();
- this.getNum();
- }
- })
- } else {
- uni.showModal({
- content: res.msg || '确认收货失败',
- showCancel: false
- });
- }
- uni.hideLoading()
- }).catch(err => {
- uni.hideLoading()
- })
- }
- }
- });
- },
- //申请退货
- applyReturn(order_no) {
- uni.navigateTo({
- url: '../apply-return/apply-return?order_no=' + order_no
- });
- },
- //立即分享按钮
- shareNow(item) {
- this.payWay = false;
- this.code.val =
- `${this.$config.share_url}#pages/scan-order/scan-order?order_no=${item.order_no}`;
- let goods = item.goods;
- let good = Object.values(goods);
- let img = good[0].img.replaceAll('http', 'https');
- uni.getImageInfo({
- src: img,
- success: res => {
- this.goods_img = res.path
- }
- })
- this.shareGoods = {
- // img: good[0].img.replaceAll('http', 'https'),
- price: this.totalMoney(goods),
- num: this.totalNum(goods),
- name: good.length > 1 ? good[0].main_attr + '...等' : good[0].main_attr
- };
- this.shareShow = true;
- this.$refs.qrcode._makeCode();
- },
- blobToDataURI(blob, callback) {
- var reader = new FileReader();
- reader.readAsDataURL(blob);
- reader.onload = function(e) {
- callback(e.target.result);
- };
- },
- //绘制海报
- drawPoster(codeImg) {
- let _this = this;
- uni.showLoading({
- title: '图片加载中...'
- });
- let goods = _this.shareGoods;
- uni.getImageInfo({
- src: 'https://api.wd.cliu.cc/good_poster.png',
- success: res => {
- uni.showLoading({
- title: '图片生成中...',
- })
- let ctx = uni.createCanvasContext('canvas');
- let store = uni.getStorageSync('store');
- store.name = store.name.length > 7 ? store.name.slice(0, 7) + '...的店铺' : store.name +
- '的店铺';
- let rpx = _this.canvasWidth;
- //背景图
- ctx.drawImage(res.path, 0, 0, 270 * rpx, 480 * rpx);
- //店铺名称
- ctx.font = 'normal bold 14px Microsoft YaHei';
- ctx.textAlign = 'center';
- ctx.fillText(store.name, uni.upx2px(270), uni.upx2px(210));
- //商品图
- ctx.drawImage(this.goods_img, uni.upx2px(110), uni.upx2px(270), uni.upx2px(130), uni
- .upx2px(
- 103));
- //商品款式
- ctx.font = 'normal bold 14px Microsoft YaHei';
- ctx.fillText(goods.name, goods.name.length > 3 ? uni.upx2px(320) : uni.upx2px(290), uni
- .upx2px(300));
- //商品数量
- ctx.font = 'normal normal 12px Microsoft YaHei';
- ctx.setFillStyle('#999999');
- ctx.fillText(`${goods.num}套`, uni.upx2px(282), uni.upx2px(340));
- //商品价格
- ctx.font = 'normal bold 12px Microsoft YaHei';
- ctx.setFillStyle('#FB231F');
- ctx.fillText(`¥`, uni.upx2px(340), uni.upx2px(365));
- ctx.font = 'normal bold 16px Microsoft YaHei';
- ctx.setFillStyle('#FB231F');
- ctx.fillText(goods.price, uni.upx2px(400), uni.upx2px(365));
- //二维码
- ctx.drawImage(codeImg, uni.upx2px(110), uni.upx2px(420), uni.upx2px(320), uni.upx2px(
- 320));
- //扫一扫下单,安全有保障
- ctx.font = 'noraml bold 14px 微软雅黑';
- ctx.textAlign = 'center';
- ctx.setFillStyle('#060001');
- ctx.fillText('微信-扫一扫-支付', uni.upx2px(270), uni.upx2px(790));
- setTimeout(res => {
- ctx.draw(false, () => {
- uni.canvasToTempFilePath({
- width: 270 * rpx,
- height: 480 * rpx,
- canvasId: 'canvas',
- success: res => {
- uni.hideLoading();
- if (this.model == 'iPhone') {
- this.poster = this.dataURLtoFile(res
- .tempFilePath).name;
- } else {
- let url = res.tempFilePath.replace(
- /\. +/g, '');
- this.poster = url.replace(/[\r\n]/g,
- '');
- }
- },
- fail: () => {
- uni.hideLoading();
- }
- });
- });
- }, 500);
- }
- });
- },
- //0 不一起发货 1一起发货
- skip(type) {
- this.showModal = false;
- if (type === 0) {
- uni.navigateTo({
- url: '../../pagesA/pages/delivery-method/delivery-method?order_no=' +
- this.orderDetail.order_no + '&user_id=' +
- this.orderDetail.user_id
- });
- return false;
- }
- uni.navigateTo({
- url: '../../pagesA/pages/merge-order/merge-order?order_no=' + this.orderDetail.order_no
- })
- },
- //跳转发货方式
- shipments(item) {
- const {
- order_no,
- user_id
- } = item;
- // uni.navigateTo({
- // url: '../../pagesA/pages/delivery-method/delivery-method?order_no=' +
- // order_no + '&user_id=' +
- // user_id
- // });
- // return false;
- uni.showLoading({
- title: '加载中...'
- })
- getNoSendOrder({
- order_no
- }).then(res => {
- if (res.code == 200) {
- let list = res.data;
- if (list.length === 1) {
- uni.navigateTo({
- url: '../../pagesA/pages/delivery-method/delivery-method?order_no=' +
- order_no + '&user_id=' +
- user_id
- });
- return false;
- }
- this.showModal = true
- this.orderDetail = item;
- } else {
- uni.showModal({
- content: res.data,
- showCancel: false
- })
- }
- uni.hideLoading()
- }).catch(err => {
- uni.hideLoading()
- })
- },
- //直接扫码发货
- scanCode(item) {
- uni.navigateTo({
- url: '../../pagesA/pages/send-code/send-code?order_no=' + item.order_no
- })
- // const {
- // order_no,
- // user_id
- // } = item;
- // uni.scanCode({
- // success: res => {
- // var index = res.result.lastIndexOf("\/");
- // let codeNum = res.result.substring(index + 1, res.result.length);
- // if (!codeNum) {
- // uni.showModal({
- // content: '扫码失败,请重试',
- // showCancel: false
- // })
- // return false;
- // }
- // if (codeNum) {
- // scanCodeInfo({
- // code: codeNum
- // }).then(res => {
- // if (res.code == 200) {
- // let info = {
- // code_info: res.data,
- // order_no,
- // total: this.totalNum(item.goods)
- // }
- // uni.navigateTo({
- // url: '../../pagesA/pages/send-code/send-code?info=' +
- // JSON
- // .stringify(info)
- // })
- // } else {
- // uni.showModal({
- // content: res.data || '扫码失败,请重试',
- // showCancel: false
- // })
- // }
- // })
- // }
- // },
- // fail: err => {
- // uni.showModal({
- // content: '扫码失败',
- // showCancel: false
- // })
- // }
- // });
- },
- //跳转到退货详情
- refundDetail(order_no, idx) {
- uni.navigateTo({
- url: '../refund_detail/refund_detail?order_no=' + order_no
- });
- },
- //跳转到待审核
- skipAudit(item) {
- uni.navigateTo({
- url: '../cancel-audit/cancel-audit?order_no=' + item.order_no + '&id=' + item.order_cancel.id
- });
- },
- /*联系客户*/
- callPhone(phone) {
- // this.orderList[idx].showMore = false;
- if (!phone) {
- uni.showToast({
- title: '暂无联系方式',
- icon: 'none'
- });
- return false;
- }
- uni.makePhoneCall({
- phoneNumber: phone
- });
- },
- /*取消订单*/
- cancelOrder(order_id, idx) {
- this.orderList[idx].showMore = false;
- uni.showModal({
- content: '确定要取消该订单么?',
- success: res => {
- if (res.confirm) {
- uni.showLoading({
- title: '取消中...'
- })
- cancelOrder({
- order_id
- }).then(res => {
- if (res.code == 200) {
- uni.showModal({
- content: '取消订单成功',
- showCancel: false
- });
- let list = this.orderList;
- list.map((i, idx) => {
- i.id == order_id ? list.splice(idx, 1) : '';
- });
- this.getNum();
- } else {
- uni.showModal({
- content: res.data || '取消订单失败',
- showCancel: false
- });
- }
- uni.hideLoading()
- }).catch(err => {
- uni.hideLoading()
- })
- }
- }
- });
- },
- goTop() {
- // 一键回到顶部
- if (uni.pageScrollTo) {
- uni.pageScrollTo({
- scrollTop: 0
- });
- }
- },
- /*获取订单列表
- *page_index 当前页面
- *page_size 每页条数
- *status 状态 0待付款 1待发货 2待收货 3已完成
- */
- getOrder(isMore, isSearch) {
- let status = this.params.status == 0 ? 'all' : this.params.status - 1;
- let {
- page_index,
- page_size,
- order_no
- } = this.params;
- let http = '';
- let data = '';
- uni.showLoading({
- title: '加载中...'
- });
- if (this.user_id) {
- http = getUserOrder;
- data = {
- status,
- page_index,
- page_size,
- user_id: this.user_id,
- order_no
- };
- } else {
- http = getOrderList;
- data = {
- status,
- page_index,
- page_size,
- order_no
- };
- }
- http(data)
- .then(res => {
- if (res.code == 200) {
- this.total = Math.ceil(res.data.total / this.params.page_size);
- this.orderList = isMore ? this.orderList.concat(res.data.list) : res.data.list;
- this.orderList.map(i => {
- this.$set(i, 'showMore', false);
- });
- if (status == 0 || status == 'all') {
- this.getCount();
- }
- if (isSearch && res.data.list.length > 0) {
- this.params.status = res.data.list[0].status + 1;
- }
- } else {
- uni.showModal({
- content: res.data,
- showCancel: false
- });
- }
- uni.hideLoading();
- })
- .catch(err => {
- uni.hideLoading();
- });
- },
- //上拉加载更多
- getMoreOrder() {
- if (this.params.page_index >= this.total) {
- uni.showToast({
- title: '没有更多啦~',
- icon: 'none'
- });
- return false;
- }
- this.params.page_index++;
- this.getOrder(true);
- },
- /*tab 切换 0待付款 1待发货 2待收货 3已完成
- *
- */
- cutTab(tabType) {
- this.orderList = [];
- this.params.status = tabType;
- this.params.page_index = 1;
- this.params.order_no = '';
- this.goTop();
- this.getOrder();
- },
- /*查看物流*/
- lookLogs(item) {
- let good = Object.values(item.goods)
- let img = good[0].img.replaceAll('http', 'https');
- uni.navigateTo({
- url: '../logistics-detail/logistics-detail?order_no=' + item.order_no + '&img=' +
- img
- });
- },
- /*查看评价*/
- skipEval() {
- uni.navigateTo({
- url: '../evaluate/evaluate'
- });
- },
- /*订单详情
- * order_no 当前订单的订单号
- */
- skipDel(order_no) {
- uni.navigateTo({
- url: '../order-info/order-info?order_no=' + order_no
- });
- },
- /*物流发货*/
- sendGoods(order_no) {
- uni.navigateTo({
- url: '../send-goods/send-goods?order_no=' + order_no
- });
- },
- /*查询订单*/
- search() {
- if (!this.params.order_no) {
- uni.showModal({
- content: '请先输入订单号',
- showCancel: false
- });
- return false;
- }
- this.getOrder(false, true);
- },
- /*用户自提*/
- pickUp(order_no) {
- uni.showLoading({
- title: '提交中...'
- })
- pickUp({
- order_no
- }).then(res => {
- if (res.code == 200) {
- this.status = 3;
- this.getOrder();
- uni.showToast({
- title: '成功',
- duration: 3000
- });
- } else {
- uni.showModal({
- content: res.data || '失败',
- showCancel: false
- });
- }
- uni.hideLoading()
- }).catch(err => {
- uni.hideLoading();
- })
- },
- /*立即付款*/
- async payMent(order_no) {
- this.payWay = false;
- if (!this.isPay) {
- uni.showModal({
- content: '请稍后重试~',
- showCancel: false
- });
- return false;
- }
- this.isPay = false;
- uni.showLoading({
- title: '加载中...'
- })
- payMent({
- order_no
- })
- .then(res => {
- if (res.error_code === 200) {
- let data = res.data;
- uni.requestPayment({
- timeStamp: data.timestamp,
- nonceStr: data.nonceStr,
- package: data.package,
- signType: data.signType,
- paySign: data.paySign,
- success: res => {
- this.params.page_index = 1;
- this.params.status = 2;
- this.getOrder();
- },
- fail: err => {
- uni.showModal({
- content: '支付失败',
- showCancel: false
- })
- }
- })
- } else {
- uni.showModal({
- content: res.msg || '支付失败',
- showCancel: false
- })
- }
- uni.hideLoading();
- })
- .catch(err => {
- this.isPay = true;
- uni.hideLoading();
- })
- .finally(() => {
- setTimeout(() => {
- this.isPay = true;
- }, 3000);
- uni.hideLoading();
- });
- }
- }
- };
- </script>
- <style>
- page {
- min-height: 100%;
- width: 100%;
- background-color: #f9f9fb;
- }
- </style>
- <style lang="scss" scoped>
- .no_scroll {
- postion: relative;
- height: 100vh;
- overflow-y: hidden;
- }
- .order_manage {
- postion: relative;
- padding-bottom: 180rpx;
- .order_top {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- background: #fff;
- z-index: 99;
- .inp {
- width: 100%;
- height: 140rpx;
- padding: 0 30rpx;
- box-sizing: border-box;
- background-color: #fff;
- .search_inp {
- width: 540rpx;
- height: 80rpx;
- border: 2rpx solid #cccccc;
- border-radius: 44rpx;
- padding: 0 30rpx;
- box-sizing: border-box;
- input {
- width: 80%;
- height: 80rpx;
- line-height: 80rpx;
- color: #333;
- }
- .iconfont {
- color: #cccccc;
- font-size: 40rpx;
- }
- }
- .search_btn {
- width: 124rpx;
- height: 64rpx;
- text-align: center;
- line-height: 64rpx;
- background: $base-line-bg;
- font-size: 28rpx;
- color: #fff;
- border-radius: 44rpx;
- }
- }
- .tabs {
- width: 100%;
- // padding: 0 20rpx;
- height: 112rpx;
- .tab_active {
- .tab_status {
- color: $base-color;
- font-weight: bold;
- }
- .tab_status::after {
- content: '';
- display: block;
- position: absolute;
- bottom: -8rpx;
- left: 52rpx;
- width: 44rpx;
- height: 6rpx;
- border-radius: 48rpx;
- background: $base-line-bg;
- text-align: center;
- }
- }
- .tab_item {
- width: 20%;
- text-align: center;
- position: relative;
- .tab_status {
- font-size: 26rpx;
- }
- .tab_num {
- min-width: 36rpx;
- min-height: 36rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #fff;
- font-size: 24rpx;
- border-radius: 44rpx;
- background: $base-line-bg;
- position: absolute;
- top: -24rpx;
- right: 0rpx;
- }
- .more_num {
- width: 60rpx;
- height: 32rpx;
- position: absolute;
- right: -18rpx;
- }
- }
- }
- }
- .order_list {
- margin: 272rpx 0 120rpx;
- .list_con {
- width: 690rpx;
- margin: 30rpx auto 0;
- background-color: #fff;
- font-size: 28rpx;
- border-radius: 24rpx;
- position: relative;
- .goods_con {
- border-top: 1rpx solid #e9e9e9;
- border-bottom: 1rpx solid #e9e9e9;
- .goods_img {
- width: 188rpx;
- height: 144rpx;
- margin-right: 20rpx;
- border-radius: 8rpx;
- flex-shrink: 0;
- }
- >view {
- margin-top: 15rpx;
- }
- }
- .goods_opera {
- .more_opera {
- font-size: 36rpx;
- color: #999;
- font-weight: bold;
- margin-left: 15rpx;
- }
- .dialog {
- position: absolute;
- background-color: #fff;
- margin: 20rpx auto;
- bottom: 82rpx;
- right: 20rpx;
- width: 220rpx;
- text-align: center;
- border-radius: 8rpx;
- box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16);
- &:after {
- content: '';
- position: absolute;
- width: 0;
- height: 0;
- border: 10rpx solid transparent;
- border-top-color: #fff;
- top: 100%;
- left: 50%;
- margin-left: 72rpx;
- }
- >view {
- height: 88rpx;
- line-height: 88rpx;
- font-size: 32rpx;
- }
- >view:not(:last-child) {
- border-bottom: 2rpx solid #eeeeee;
- }
- }
- }
- >view {
- padding: 20rpx 20rpx;
- box-sizing: border-box;
- }
- >view:first-child {
- padding: 25rpx 10rpx;
- }
- .refund_img {
- width: 202rpx;
- height: 170rpx;
- position: absolute;
- top: 15rpx;
- right: 25rpx;
- }
- .close_order {
- width: 630rpx;
- background: #ffeac7;
- color: $base-color;
- font-size: 28rpx;
- font-weight: bold;
- margin: 15rpx auto 0;
- border-radius: 8rpx;
- padding: 8rpx 0 8rpx 30rpx;
- }
- .cancel_img {
- width: 195rpx;
- height: 125rpx;
- position: absolute;
- top: 0;
- right: 30rpx;
- }
- .opear_btn {
- width: 192rpx;
- height: 68rpx;
- background: $base-line-bg;
- opacity: 1;
- border-radius: 34rpx;
- color: #fff;
- font-size: 28rpx;
- margin-left: 20rpx;
- }
- .price {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- }
- .ident {
- background: rgba(65, 133, 245, 0.1);
- color: #4185f5;
- padding: 5rpx 15rpx;
- border-radius: 28rpx 8rpx 28rpx 8rpx;
- flex-shrink: 0;
- }
- }
- }
- }
- .share_show {
- width: 100%;
- height: 100vh;
- position: fixed;
- top: 0;
- left: 0;
- background-color: rgba(0, 0, 0, 0.7);
- z-index: 999;
- .share_con {
- width: 80%;
- margin: 0 auto;
- height: 100%;
- z-index: 999999;
- .canvas {
- width: 540rpx;
- height: 960rpx;
- position: relative;
- #canvas {
- width: 540rpx;
- height: 960rpx;
- position: absolute;
- top: 0;
- left: 0;
- }
- .poster_img {
- -webkit-touch-callout: default;
- width: 100%;
- height: 100%;
- display: block;
- }
- img[src=''],
- img:not([src]) {
- opacity: 0;
- }
- // image {
- // width: 100%;
- // height: 100%;
- // border-radius: 24rpx;
- // }
- }
- .save_img {
- color: #fff;
- width: 100%;
- text-align: center;
- font-size: 40rpx;
- margin-top: 20rpx;
- }
- .iconfont {
- position: absolute;
- top: 4vh;
- right: 25rpx;
- color: #dedede;
- font-size: 60rpx;
- z-index: 999;
- }
- }
- .sub_btn {
- margin-top: 76rpx;
- }
- }
- .qrimg {
- opacity: 0;
- }
- .pay_pop {
- width: 100vw;
- height: 100vh;
- background: rgba(0, 0, 0, 0.8);
- position: fixed;
- top: 0;
- left: 0;
- z-index: 99999;
- .pay_con {
- position: relative;
- width: 620rpx;
- text-align: center;
- margin: 0 auto;
- min-height: 384rpx;
- background: #fff;
- border-radius: 8rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- .pay_title {
- font-size: 32rpx;
- font-weight: bold;
- margin-top: 85rpx;
- }
- .pay_intr {
- font-size: 30rpx;
- font-weight: bold;
- margin: 100rpx 0 50rpx;
- min-height: 100rpx;
- view {
- color: #999;
- margin-top: 15rpx;
- }
- }
- .hint_icon {
- width: 183rpx;
- height: 135rpx;
- position: absolute;
- top: -67rpx;
- margin-left: 18rpx;
- }
- .pay_btn {
- position: relative;
- width: 560rpx;
- height: 88rpx;
- view {
- width: 360rpx;
- height: 88rpx;
- line-height: 88rpx;
- color: #fff;
- text-align: center;
- font-size: 32rpx;
- }
- view:first-child {
- width: 200rpx;
- height: 84rpx;
- background: #FFF4F3;
- border: 2rpx solid $base-color;
- border-radius: 44rpx 0 0 44rpx;
- color: $base-color;
- }
- view:last-child {
- background: $base-line-bg;
- border-radius: 0 44rpx 44rpx 0;
- text-align: left;
- padding-left: 24rpx;
- box-sizing: border-box;
- }
- .recommend {
- width: 76rpx;
- height: 48rpx;
- position: absolute;
- top: 0rpx;
- right: 29rpx;
- }
- }
- }
- .iconfont {
- margin-top: 30rpx;
- color: #fff;
- font-size: 60rpx;
- }
- }
- </style>
|