123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783 |
- <template>
- <mobile-frame>
- <view class="main">
- <view class="one">
- <input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
- </view>
- <view class="two">
- <tabs :tabs="tabs" @tabsChange="tabsChange">
- <view class="tabsList">
- <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
- <view class="list-scroll-view">
- <view class="list_1" v-if="tabs.active=='-0'">
- 全部订单
- </view>
- <view class="list_2" v-for="(item,index) in list" :key="index" v-else-if="tabs.active=='0'" @tap="toInfo(item)">
- <view class="status">
- {{item.status=='0'?'待付款':item.status=='1'?'已支付':item.status=='-1'?'取消订单':item.status=='2'?'发货中':item.status=='-2'?'已退款':item.status=='3'?'已收货':item.status=='-3'?'申请售后':item.status=='-4'?'正在售后中':item.status=='-5'?'售后已结束':'未识别'}}
- </view>
- <view class="goods" v-for="(tag,indexs) in item.goods" :key="indexs">
- <view class="goods_1">
- <view class="shopname">
- <text class="iconfont icon-shangdian"></text>
- <text>{{tag.shop_name}}</text>
- </view>
- </view>
- <view class="goods_2">
- <view class="market" v-for="(tags,indexss) in tag.goods" :key="indexss">
- <view class="url">
- <image class="image" :src="tags.goods.file&&tags.goods.file.length>0?tags.goods.file[0].url:''" mode=""></image>
- </view>
- <view class="goodsname">
- {{tags.goods.name}}
- <view class="specs">
- {{tags.name}}
- </view>
- </view>
- <view class="goodsother">
- <view v-if="item.type=='0'" class="price">
- ¥{{tags.sell_money}}
- </view>
- <view v-else class="price">
- ¥{{tags.group_config.money}}
- </view>
- <view class="num">
- ×{{tags.buy_num}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="other">
- <text>共{{item.total_detail.freight_total}}件商品</text>
- <text>总价¥{{item.total_detail.goods_total}}</text>
- </view>
- <view class="btn">
- <button v-if="item.status=='0'" type="default" size="mini" @tap.stop="toCancel(item)">取消订单</button>
- <button class="toPay" v-if="item.status=='0'" type="default" size="mini" @tap.stop="toPay(item)">付款</button>
- <button v-if="item.status=='2'" type="default" size="mini" @tap.stop="toConfirm(item)">确认收货</button>
- <button v-if="item.status!='0'" type="default" size="mini" @tap.stop="toAfter(item)">申请售后</button>
- <button v-if="item.status=='3'&&!item.rate" type="default" size="mini" @tap.stop="toAppraise(item)">立即评价</button>
- <button v-if="item.status=='3'&&item.rate" type="default" size="mini" @tap.stop="toAppraise(item)">追加评价</button>
- </view>
- </view>
- <view class="list_2 list_3" v-for="(item,index) in list" :key="index" @tap="toInfo(item)" v-else>
- <view class="list_3_1">
- <view class="goods_1">
- <view class="shopname">
- <text class="iconfont icon-shangdian"></text>
- <text>{{item.shop.name}}</text>
- </view>
- </view>
- <view class="status">
- {{item.status=='0'?'待付款':item.status=='1'?'已支付':item.status=='-1'?'取消订单':item.status=='2'?'发货中':item.status=='-2'?'已退款':item.status=='3'?'已收货':item.status=='-3'?'申请售后':item.status=='-4'?'正在售后中':item.status=='-5'?'售后已结束':'未识别'}}
- </view>
- </view>
- <view class="goods" v-for="(tag,indexs) in item.goods" :key="indexs">
- <view class="goods_2">
- <view class="market">
- <view class="url">
- <image class="image" :src="tag.url" mode=""></image>
- </view>
- <view class="goodsname">
- {{tag.goods.name}}
- <view class="specs">
- {{tag.name}}
- </view>
- </view>
- <view class="goodsother">
- <view v-if="item.type=='0'" class="price">
- ¥{{tag.sell_money}}
- </view>
- <view v-else class="price">
- ¥{{tag.group_config.money}}
- </view>
- <view class="num">
- ×{{tag.buy_num}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="other">
- <text>共{{item.buy_num_total||0}}件商品</text>
- <text>总价¥{{item.real_pay}}</text>
- </view>
- <view class="btn">
- <button v-if="item.status=='2'||item.status=='3'" type="default" size="mini" @tap.stop="toLogi(item)">查看物流</button>
- <button v-if="item.status=='0'" type="default" size="mini" @tap.stop="toCancel(item)">取消订单</button>
- <button class="toPay" v-if="item.status=='0'" type="default" size="mini" @tap.stop="toPay(item)">付款</button>
- <button v-if="item.status=='2'" type="default" size="mini" @tap.stop="toConfirm(item)">确认收货</button>
- <button v-if="item.status!='0'" type="default" size="mini" @tap.stop="toAfter(item)">申请售后</button>
- <button v-if="item.status=='3'&&!item.rate" type="default" size="mini" @tap.stop="toAppraise(item)">立即评价</button>
- <button v-if="item.status=='3'&&item.rate" type="default" size="mini" @tap.stop="toAppraise(item)">追加评价</button>
- </view>
- </view>
- <view class="is_bottom" v-if="is_bottom">
- <text>{{config.bottom_title}}</text>
- </view>
- </view>
- </scroll-view>
- </view>
- </tabs>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- import tabs from '@/components/tabs/index.vue';
- export default {
- components: {
- tabs
- },
- data() {
- return {
- // 系统设置
- config: {},
- user: {},
- status: '',
- searchInfo: {},
- tabs: {
- active: '0',
- menu: [ //菜单列表
- // {
- // title: '全部订单',
- // active: '-0'
- // },
- {
- title: '待付款',
- active: '0'
- },
- {
- title: '待发货',
- active: '1'
- },
- {
- title: '待收货',
- active: '2'
- },
- {
- title: '已收货',
- active: '3'
- },
- {
- title: '取消订单',
- active: '-1'
- }
- ]
- },
- list: [],
- total: 0,
- skip: 0,
- limit: 6,
- page: 0,
- // 数据是否触底
- is_bottom: false,
- scrollTop: 0,
- };
- },
- onLoad: function(e) {
- const that = this;
- that.$set(that, `status`, e.status);
- that.searchConfig();
- // 监听用户是否登录
- that.watchLogin();
- },
- onPullDownRefresh: async function() {
- const that = this;
- that.clearPage();
- await that.search();
- uni.stopPullDownRefresh();
- },
- methods: {
- // 查询基本设置
- searchConfig() {
- const that = this;
- uni.getStorage({
- key: 'config',
- success: function(res) {
- if (res.data) that.$set(that, `config`, res.data)
- },
- fail: function(err) {
- console.log(err);
- }
- })
- },
- // 监听用户是否登录
- watchLogin() {
- const that = this;
- uni.getStorage({
- key: 'token',
- success: function(res) {
- let user = that.$jwt(res.data);
- if (user) that.$set(that, `user`, user);
- that.$set(that.tabs, `active`, that.status);
- that.search();
- },
- fail: function(err) {
- uni.navigateTo({
- url: `/pages/login/index`
- })
- }
- });
- },
- // 查询列表
- async search() {
- const that = this;
- let user = that.user;
- let status = that.status;
- if (status == '-0') {
- } else if (status == '0') {
- const res = await that.$api(`/order`, 'GET', {
- status: '0',
- customer: user._id
- });
- if (res.errcode == '0') {
- let list = [...that.list, ...res.data];
- that.$set(that, `list`, list)
- that.$set(that, `total`, res.total)
- } else {
- uni.showToast({
- title: res.errmsg,
- });
- }
- } else {
- const res = await that.$api(`/orderDetail`, 'GET', {
- status: that.status,
- customer: user._id
- });
- if (res.errcode == '0') {
- let list = [...that.list, ...res.data];
- that.$set(that, `list`, list)
- that.$set(that, `total`, res.total)
- } else {
- uni.showToast({
- title: res.errmsg,
- });
- }
- }
- },
- // 分页
- toPage(e) {
- const that = this;
- let list = that.list;
- let limit = that.limit;
- if (that.total > list.length) {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- let page = that.page + 1;
- that.$set(that, `page`, page)
- let skip = page * limit;
- that.$set(that, `skip`, skip)
- that.search();
- uni.hideLoading();
- } else that.$set(that, `is_bottom`, true)
- },
- toScroll(e) {
- const that = this;
- let up = that.scrollTop;
- that.$set(that, `scrollTop`, e.detail.scrollTop);
- let num = Math.sign(up - e.detail.scrollTop);
- if (num == 1) that.$set(that, `is_bottom`, false);
- },
- // 输入框
- toInput(e) {
- const that = this;
- that.$set(that.searchInfo, `name`, e.detail.value)
- },
- // 订单详细
- toInfo(item) {
- uni.navigateTo({
- url: `/pagesMy/order/info?id=${item._id}&status=${item.status}`
- })
- },
- // 取消订单
- toCancel(e) {
- const that = this;
- uni.showModal({
- title: '提示',
- content: '确定取消订单吗?',
- success: async function(res) {
- if (res.confirm) {
- const arr = await that.$api(`/order/cancel`, 'POST', {
- order_id: e._id
- });
- if (arr.errcode == '0') {
- uni.showToast({
- title: '取消订单成功',
- icon: 'none'
- })
- that.clearPage();
- that.search();
- } else {
- uni.showToast({
- title: arr.errmsg,
- icon: 'none'
- })
- }
- }
- }
- });
- },
- // 付款
- toPay(e) {
- const that = this;
- uni.getStorage({
- key: 'system',
- success: async function(res) {
- // 微信小程序支付
- if (res.data.uniPlatform == "mp-weixin") {
- uni.showLoading({
- title: '加载中'
- })
- const res = await that.$api('/pay/toPayOrder', 'POST', {
- order_id: e,
- type: '0'
- })
- uni.requestPayment({
- "provider": "wxpay",
- ...res.data,
- success(res) {
- uni.showToast({
- title: '支付成功',
- icon: 'none'
- })
- uni.hideLoading();
- that.clearPage();
- that.search();
- },
- fail(e) {
- uni.showToast({
- title: `支付失败`,
- icon: 'none'
- })
- uni.hideLoading();
- that.clearPage();
- that.search();
- }
- })
- } else if (res.data.uniPlatform == "app") {
- // app支付
- uni.requestPayment({
- provider: 'alipay',
- orderInfo: 'orderInfo', //微信、支付宝订单数据 【注意微信的订单信息,键值应该全部是小写,不能采用驼峰命名】
- success: function(res) {
- console.log('success:' + JSON.stringify(res));
- },
- fail: function(err) {
- console.log('fail:' + JSON.stringify(err));
- }
- });
- } else {
- uni.showToast({
- title: `平台不支持支付`,
- icon: 'none'
- })
- }
- },
- fail: function(err) {}
- })
- },
- // 确认收货
- toConfirm(e) {
- const that = this;
- uni.showModal({
- title: '提示',
- content: '确定确认收货吗?',
- success: async function(res) {
- if (res.confirm) {
- const arr = await that.$api(`/orderDetail/${e._id}`, 'POST', {
- status: '3'
- });
- if (arr.errcode == '0') {
- uni.showToast({
- title: '确认收货成功',
- icon: 'none'
- })
- that.clearPage();
- that.search();
- } else {
- uni.showToast({
- title: arr.errmsg,
- icon: 'none'
- })
- }
- }
- }
- });
- },
- // 申请售后 申请退款
- toAfter(e) {
- if (e.status == '3') {
- uni.navigateTo({
- url: `/pagesMy/order/service?id=${e._id}`
- })
- } else {
- uni.navigateTo({
- url: `/pagesMy/order/noService?id=${e._id}`
- })
- }
- },
- // 查看物流
- toLogi(e) {
- uni.navigateTo({
- url: `/pagesMy/logistics/index?id=${e._id}`
- })
- },
- // 立即评价
- toAppraise(e) {
- if (e.rate) {
- uni.navigateTo({
- url: `/pagesMy/order/appraise?id=${e._id}&rate_id=${e.rate}`
- })
- } else {
- uni.navigateTo({
- url: `/pagesMy/order/appraise?id=${e._id}`
- })
- }
- },
- // 选择选项卡
- tabsChange(e) {
- const that = this;
- that.$set(that.tabs, `active`, e.active)
- that.$set(that, `status`, e.active);
- that.clearPage();
- that.search()
- },
- // 清空列表
- clearPage() {
- const that = this;
- that.$set(that, `list`, [])
- that.$set(that, `skip`, 0)
- that.$set(that, `limit`, 6)
- that.$set(that, `page`, 0)
- }
- },
- }
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- padding: 2vw;
- input {
- padding: 2vw;
- background-color: var(--f1Color);
- font-size: var(--font14Size);
- border-radius: 5px;
- }
- }
- .two {
- position: relative;
- flex-grow: 1;
- background-color: var(--f9Color);
- .tabsList {
- position: relative;
- width: 100vw;
- height: 82vh;
- .list_2 {
- background-color: #fff;
- margin: 0 2vw 2vw 2vw;
- padding: 2vw;
- .status {
- color: var(--ff0Color);
- text-align: right;
- margin: 0 0 1vw 0;
- }
- .goods {
- margin: 0 0 1vw 0;
- padding: 2vw;
- border-bottom: 1px solid #f5f5f5;
- .goods_1 {
- margin: 0 0 2vw 0;
- .shopname {
- text:last-child {
- padding: 0 0 0 2vw;
- }
- }
- }
- .goods_2 {
- margin: 0 0 1vw 0;
- .market {
- display: flex;
- .url {
- width: 20vw;
- .image {
- width: 100%;
- height: 20vw;
- border-radius: 5px;
- }
- }
- .goodsname {
- display: flex;
- flex-direction: column;
- width: 60vw;
- padding: 0 2vw;
- .specs {
- color: var(--f85Color);
- font-size: var(--font12Size);
- }
- }
- .goodsother {
- width: 15vw;
- text-align: right;
- }
- }
- }
- }
- .other {
- margin: 0 0 2vw 0;
- text-align: right;
- text {
- font-size: 14px;
- padding: 0 0 0 2vw;
- }
- }
- .btn {
- text-align: right;
- margin: 2vw 0 0 0;
- border-top: 1px solid #f1fff1;
- button {
- margin: 2vw 0 0 2vw;
- }
- .toPay {
- border: 1px solid #ff0000;
- color: #ff0000;
- }
- }
- }
- .list_3 {
- .list_3_1 {
- display: flex;
- justify-content: space-between;
- }
- }
- // .list {
- // background-color: #fff;
- // margin: 0 2vw 2vw 2vw;
- // padding: 2vw;
- // .list_1 {
- // margin: 0 0 1vw 0;
- // display: flex;
- // flex-direction: row;
- // justify-content: space-between;
- // }
- // .list_2 {
- // margin: 0 0 1vw 0;
- // display: flex;
- // .l {
- // width: 20vw;
- // .image {
- // width: 100%;
- // height: 20vw;
- // border-radius: 5px;
- // }
- // }
- // .c {
- // width: 60vw;
- // padding: 0 2vw;
- // }
- // .r {
- // width: 15vw;
- // text-align: right;
- // }
- // }
- // .other {
- // margin: 0 0 2vw 0;
- // text-align: right;
- // text {
- // font-size: 14px;
- // padding: 0 0 0 2vw;
- // }
- // }
- // .btn {
- // text-align: right;
- // margin: 2vw 0 0 0;
- // border-top: 1px solid #f1fff1;
- // button {
- // margin: 2vw 0 0 2vw;
- // }
- // }
- // }
- }
- }
- }
- // .two {
- // position: relative;
- // flex-grow: 1;
- // background-color: var(--f9Color);
- // .two_1 {
- // background-color: var(--fffColor);
- // padding: 2vw;
- // display: flex;
- // flex-direction: row;
- // }
- // .two_2 {
- // display: flex;
- // flex-direction: column;
- // .list {
- // width: 100vw;
- // margin: 2vw 0 0 0;
- // background-color: var(--mainColor);
- // .list_1 {
- // display: flex;
- // flex-direction: row;
- // justify-content: space-between;
- // padding: 2vw;
- // .name {
- // font-size: var(--font14Size);
- // text {
- // margin: 0 1vw 0 0;
- // }
- // }
- // .status {
- // font-size: var(--font14Size);
- // color: var(--ff0Color);
- // }
- // }
- // .list_2 {
- // display: flex;
- // flex-direction: row;
- // justify-content: space-between;
- // padding: 2vw;
- // background-color: var(--f8Color);
- // .image {
- // width: 20vw;
- // height: 20vw;
- // margin: 0 2vw 0 0;
- // }
- // .other {
- // display: flex;
- // flex-direction: column;
- // flex-grow: 1;
- // .name {
- // font-size: var(--font14Size);
- // font-weight: bold;
- // margin: 0 0 2vw 0;
- // }
- // .other_1 {
- // font-size: var(--font12Size);
- // color: var(--f85Color);
- // }
- // }
- // .money {
- // font-size: var(--font12Size);
- // .num {
- // text-align: right;
- // }
- // }
- // }
- // .list_3 {
- // display: flex;
- // justify-content: flex-end;
- // padding: 2vw;
- // border-bottom: 0.5vw solid var(--f9Color);
- // font-size: var(--font12Size);
- // text {
- // margin: 0 1vw;
- // }
- // }
- // .list_4 {
- // padding: 2vw;
- // text-align: right;
- // button {
- // margin: 0 1vw 0 2vw;
- // }
- // }
- // }
- // }
- // }
- // }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- }
- }
- .is_bottom {
- text-align: center;
- text {
- padding: 2vw 0;
- display: inline-block;
- color: #858585;
- font-size: 14px;
- }
- }
- </style>
|