123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644 |
- <template>
- <view class="content">
- <view class="top">
- <u-navbar title=" " @leftClick="leftClick" height="44px" bgColor="rgb(255,255,255)" :placeholder="true">
- <view class="u-nav-slot" slot="center">
- <u-search placeholder="搜索我的订单" v-model="keyword" :showAction="false" @search="search"></u-search>
- </view>
- </u-navbar>
- <view class="tabs hflex acenter jbetween">
- <block v-for="(item,index) in tabs" :key="index">
- <view class="tab_item" :class="tab_active == item.index?'tab_active':''" @click="changeTab(item.index)">{{item.name}}</view>
- </block>
- </view>
- </view>
- <view class="box">
- <block v-for="(item,index) in pageList" :key="index">
- <view class="box_item">
- <view class="hflex acenter jbetween cell">
- <view class="hflex acenter" @click="toShop(item.id)">
- <view class="title">{{item.admin_name}}</view>
- <u-icon color="#B5B5B5" name="arrow-right" size="10"></u-icon>
- </view>
- <!-- <view class="text-blue">{{status}}</view> -->
- <view class="text-blue text-white" v-if="item.status == 0">已取消</view>
- <view class="text-blue" v-else-if="item.status == 1">预订单</view>
- <view class="text-blue" v-else-if="item.status == 2">待支付</view>
- <view class="text-blue" v-else-if="item.status == 3">支付中</view>
- <view class="text-blue" v-else-if="item.status == 4">待发货</view>
- <view class="text-blue" v-else-if="item.status == 5">待收货</view>
- <view class="text-blue" v-else-if="item.status == 6">已完成</view>
- <!-- <view class="text-blue" v-else-if="item.refund_status == 2">已取消</view>
- <view class="text-blue" v-else-if="item.refund_status == 1 ">已取消</view> -->
- <view class="text-blue" v-else-if="item.status == 7">待发货</view>
- <view class="text-blue" v-if="item.status == 8">已取消</view>
- </view>
- <view @click="toOrderDetail(item.id)">
- <view class="hflex acenter" v-if="item.goods_item.length == 1">
- <view>
- <image :src="item.goods_item[0].goods_cover" mode="aspectFill" class="img"></image>
- </view>
- <view class="img_right">
- <view class="hflex acenter jbetween">
- <view class="name text_hide">{{item.goods_item[0].goods_name}}</view>
- <view class="price">¥{{item.goods_item[0].price_selling}}</view>
- </view>
- <view class="hflex jbetween" style="padding-top: 12rpx;">
- <view class="norm text_hide">{{item.goods_item[0].goods_spec}}</view>
- <view class="vflex">
- <view class="num">X{{item.goods_item[0].stock_sales}}</view>
- <view class="text_red" v-if="item.refund_status == 2">退款成功</view>
- <view class="text_red" v-if="item.refund_status == 3">退款关闭</view>
- </view>
- </view>
- </view>
- </view>
- <view class="scroll_img" v-else>
- <scroll-view scroll-x="true" style="white-space: nowrap;" class="imgs hflex">
- <block v-for="(item2,index2) in item.goods_item" :key="index2">
- <view class="imgs_item">
- <image :src="item2.goods_cover" class="img"></image>
- </view>
- </block>
- </scroll-view>
- <view class="img_leng">共{{item.goods_item.length}}件</view>
- </view>
- </view>
- <view class="hflex acenter jend cell" v-if="item.payment_status == 2">
- <view class="price">实付款:¥{{item.payment_amount}}</view>
- </view>
- <view class="hflex acenter jend cell">
- <block v-if="item.status == 2">
- <view class="btn1" @click="cancelShow(item.id)">取消订单</view>
- <view class="btn1 btn2" @click="pay(index)">立即支付</view>
- </block>
- <block v-if="item.status == 4">
- <view class="btn1" @click="toApply(item.id)">申请退款</view>
- <view class="btn1 btn2" @click="remind(item.id)">提醒发货</view>
- </block>
- <block v-if="item.status == 5">
- <view class="btn1 btn2" @click="take(item.id)">确认收货</view>
- </block>
- <block v-if="item.status == 6 || item.refund_status == 2">
- <!-- <view class="btn1">发表评价</view> -->
- <view class="btn1 btn2" @click="toBuy(index)">再次购买</view>
- </block>
- <block v-if="item.refund_status == 1 && item.status != 6">
- <!-- <view class="btn1">发表评价</view> -->
- <view class="btn1" @click="remind(item.id)">提醒发货</view>
- <view class="btn1 btn2" @click="cancel(item.id)">撤销申请</view>
- </block>
- </view>
- </view>
- </block>
- </view>
- <u-popup :show="cancel_show" :round="20" :closeable="true" mode="bottom" @close="close">
- <view class="popu">
- <view class="popu_title">订单取消原因</view>
- <view class="text_style2">请选择取消订单的原因(必选)</view>
- <u-radio-group v-model="cancelReason" placement="column">
- <block v-for="(item, index) in cancelList" :key="index" >
- <u-radio :name="item.name" @change="radioChange" :customStyle="{padding: '28rpx 0'}" :label="item.name"></u-radio>
- </block>
- </u-radio-group>
- <view class="btn_group hflex acenter jbetween">
- <view class="cancel_btn" @click="close">我再想想</view>
- <view class="sure_btn" @click="cancelOrder">取消订单</view>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import $api from '@/static/js/api.js'
- var that = ''
- export default {
- data() {
- return {
- keyword: '',
- tabs: [
- {
- name: '全部',
- index: 1
- },
- {
- name: '待付款',
- index: 2
- },
- {
- name: '待发货',
- index: 3
- },
- {
- name: '待收货',
- index: 4
- },
- {
- name: '已完成',
- index: 6
- }
- ],
- tab_active: 1,
- pageList: [
- ],
- id: '',
- cancel_show: false,
- cancelList: [
- {
- name: '商品无货'
- },
- {
- name: '发货时间问题'
- },
- {
- name: '不想要了'
- },
- {
- name: '商品错选/多选'
- },
- {
- name: '地址信息填写错误'
- },
- {
- name: '其他原因'
- }
- ],
- cancelReason: '',
- page:1,
- limit: 10,
- total:1.,
- // status: '',
- }
- },
- onLoad(options) {
- that = this
- that.tab_active = Number(options.id)
- that.getList()
- },
- onPullDownRefresh() {
- that.page = 1
- that.getList()
- },
- methods: {
- // 返回
- leftClick() {
- console.log('返回');
- $api.jump(-1)
- },
- // 获取我的订单
- getList() {
- $api.req({
- url: '/data/api.Order/order_list',
- method: 'POST',
- data: {
- order_name: that.keyword?that.keyword: '',
- status: that.tab_active,
- page: that.page
- }
- }, function(res) {
- if(res.code == 1) {
- for(var i=0;i<res.data.list.length;i++) {
- for(var j=0;j<res.data.list[i].goods_item.length;j++) {
- res.data.list[i].goods_item[j].goods_spec = $api.resetspec(res.data.list[i].goods_item[j].goods_spec)
- }
- }
- if(that.page == 1) {
- that.pageList = res.data.list
- } else {
- that.pageList = that.pageList.concat(res.data.list)
- }
- that.total = res.data.page.total
- that.limit = res.data.page.limit
- }
- uni.stopPullDownRefresh();
- })
- },
- changeTab(index) {
- /* console.log(index);
- if(index == 4) {
- that.tab_active = 5
- } else {
- that.tab_active = index
- } */
- that.tab_active = index
- that.page = 1
- that.pageList = []
- that.getList()
- },
- // 店铺
- toShop(id) {
- $api.jump('/page_shop/pages/good/shop?id=' + id)
- },
- toOrderDetail(id) {
- $api.jump('/page_shop/pages/order/orderdetail?id=' + id)
- },
- // 申请退款
- toApply(id) {
- $api.jump('/page_shop/pages/order/apply?id=' + id)
- },
- toBuy(index) {
- var item_id = that.pageList[index].goods_item[0].item_id
- var url = '/page_shop/pages/good/submit2?data=' + JSON.stringify(that.pageList[index]) + '&item_id=' + item_id
- $api.jump(url)
- // $api.jump('/page_shop/pages/good/detail?id=' + that.pageList[index].id)
- },
-
- cancel(id) {
- $api.req({
- url: '/data/api.Order/cancel_refund',
- method: 'POST',
- data: {
- order_id: id
- }
- }, function(res) {
- if(res.code == 1) {
- that.page = 1
- that.getList()
- }
- })
- },
- search(e) {
- that.page = 1
- that.getList()
- },
- cancelShow(id) {
- that.id = id
- that.cancel_show = true
- },
- pay(index) {
- var openid = uni.getStorageSync('openid1')
- if(!openid) {
- $api.info("登录验证有误,请重新登录")
- return
- }
- $api.req({
- url: '/data/api.auth.Center/channel',
- method: 'POST',
- data: {
- type: 2,
- from: 1
- }
- }, function(res) {
- if(res.code == 1) {
- var pay_code = res.data[0].code
- $api.req({
- url: '/data/api.Order/order_pay',
- method: 'POST',
- data: {
- pay_code: pay_code,
- pay_no: that.pageList[index].payment_trade,
- type: 'wechat'
- }
- }, function(res) {
- if(res.code == 1) {
- wx.requestPayment({
- timeStamp: res.data.pay.timeStamp,
- nonceStr: res.data.pay.nonceStr,
- package: res.data.pay.package,
- signType: 'MD5',
- paySign: res.data.pay.paySign,
- success (res) {
- $api.info("支付成功")
- that.getList()
- },
- fail (res) { }
- })
- }
- })
- }
- })
- },
- close() {
- that.cancel_show = false
- },
- // 选择取消原因
- radioChange(e) {
- that.cancelReason = e
- },
- // 确认取消
- cancelOrder() {
- if(that.cancelReason == '') {
- $api.info('请选择取消订单的原因')
- } else {
- $api.req({
- url: '/data/api.Order/cancel_order',
- method: 'POST',
- data: {
- order_id: that.id,
- cancel_remark: that.cancelReason
- }
- }, function(res) {
- if(res.code == 1) {
- $api.info(res.info)
- that.close()
- that.page = 1
- that.getList()
- }
- })
- }
- },
- take(id) {
- $api.req({
- url: '/data/api.Order/order_end',
- method: 'POST',
- data: {
- order_id: id
- }
- }, function(res) {
- if(res.code == 1) {
- $api.info(res.info)
- that.getList()
- }
- })
- },
- remind(id) {
- $api.req({
- url: '/data/api.Order/remind',
- method: 'POST',
- data: {
- order_id: id
- }
- }, function(res) {
- if(res.code == 1) {
- $api.info(res.info)
- }
- })
- },
- onReachBottom() {
- if (Number(that.page) * Number(that.limit) >= Number(that.total)) {
- $api.info("没有更多了")
- } else {
- that.page++
- that.getList()
- }
-
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .content {
- background: #F3F3F3;
- .top {
- box-sizing: border-box;
- // padding: 30rpx;
- // height: 540rpx;
- .u-nav-slot {
- position: absolute;
- top: 8rpx;
- left: 134rpx;
- }
- .tabs {
- background-color: #fff;
- width: 100%;
- box-sizing: border-box;
- padding: 20rpx 30rpx;
- .tab_item {
- font-size: 32rpx;
- font-weight: 400;
- color: #333333;
- line-height: 44rpx;
- }
- .tab_active {
- font-weight: 500;
- color: #222222;
- position: relative;
- }
- .tab_active::after {
- content: "";
- position: absolute;
- bottom: -14rpx;
- left: 15%;
- width: 50rpx;
- height: 6rpx;
- background: #506DFF;
- border-radius: 4rpx;
- }
- }
- }
- .box {
- width: 100%;
- box-sizing: border-box;
- padding: 0 30rpx;
- .box_item {
- background: #FFFFFF;
- border-radius: 20rpx;
- width: 100%;
- margin-top: 20rpx;
- box-sizing: border-box;
- padding: 0 20rpx;
- .cell {
- padding: 20rpx 0;
- }
- .title {
- font-size: 30rpx;
- font-weight: 500;
- color: #333333;
- line-height: 42rpx;
- }
- .text-blue {
- font-size: 26rpx;
- font-weight: 400;
- color: #506DFF;
- line-height: 36rpx;
- }
- .text-white {
- color: #333333;
- }
- .img {
- width: 160rpx;
- height: 160rpx;
- border-radius: 16rpx;
-
- }
- .img_right {
- margin-left: 16rpx;
- width: calc(100% - 176rpx);
- .name {
- width: 392rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #222222;
- line-height: 40rpx;
- }
-
- .norm {
- max-width: 300rpx;
- width: max-content;
- // height: 84rpx;
- background: #F5F5F5;
- border-radius: 4rpx;
- font-size: 22rpx;
- font-weight: 400;
- color: #888888;
- line-height: 32rpx;
- box-sizing: border-box;
- padding: 12rpx;
- // text-overflow: ellipsis;
- // overflow: hidden;
- // display: -webkit-box;
- // -webkit-box-orient: vertical;
- // box-orient: vertical;
- // line-clamp: 2;
- // -webkit-line-clamp: 2;
- }
- .num {
- font-size: 24rpx;
- font-weight: 500;
- color: #888888;
- line-height: 28rpx;
- }
- .text_red {
- font-size: 26rpx;
- font-weight: 400;
- color: #FF2626;
- line-height: 36rpx;
- padding-top: 18rpx;
- }
-
- }
- .scroll_img {
- position: relative;
- .imgs {
- width: 100%;
- height: 170rpx;
- overflow: hidden;
- white-space: nowrap;
- .imgs_item {
- width: 160rpx;
- height: 160rpx;
- border-radius: 16rpx;
- margin-right: 20rpx;
- display: inline-block;
- }
-
- }
- .img_leng {
- position: absolute;
- right: 0;
- top: 0;
- width: 130rpx;
- height: 160rpx;
- border-radius: 12rpx;
- font-size: 24rpx;
- font-weight: 500;
- color: #222222;
- line-height: 160rpx;
- text-align: center;
- background: linear-gradient(270deg, #FFFFFF 0%, rgba(255,255,255,0.78) 100%);
- }
- }
-
- .price {
- font-size: 30rpx;
- font-weight: 400;
- color: #222222;
- line-height: 24rpx;
- }
- .btn1 {
- width: 180rpx;
- height: 68rpx;
- border-radius: 36rpx;
- border: 1px solid #D0D0D0;
- text-align: center;
- font-size: 28rpx;
- font-weight: 400;
- color: #222222;
- line-height: 68rpx;
- }
- .btn2 {
- border: 1px solid #506DFF;
- color: #506DFF;
- margin-left: 32rpx;
- }
- }
- }
- .box:nth-last-child(1) {
- margin-bottom: 30rpx;
- }
- .popu {
- width: 100%;
- background: #FFFFFF;
- border-radius: 40rpx 40rpx 0px 0px;
- box-sizing: border-box;
- padding: 0 30rpx;
- .popu_title {
- width: 100%;
- text-align: center;
- padding: 48rpx 0 44rpx;
- font-size: 36rpx;
- font-weight: 500;
- color: #222222;
- line-height: 50rpx;
- }
- .popu_price {
- font-size: 36rpx;
- font-weight: 400;
- color: #FF2626;
- line-height: 44rpx;
- padding: 0 0 36rpx;
- }
- .type {
- font-size: 30rpx;
- font-weight: 400;
- color: #222222;
- line-height: 42rpx;
- }
- .way {
- width: 100%;
- margin: 28rpx 0 60rpx;
- background: #F4F4F4;
- border-radius: 12px;
- box-sizing: border-box;
- padding: 36rpx 20rpx;
- .pay_icon {
- width: 48rpx;
- height: 48rpx;
- margin-right: 20rpx;
- }
- }
- .btn_group {
- width: 100%;
- margin: 56rpx 0;
- .cancel_btn {
- width: 330rpx;
- height: 84rpx;
- background: #F4F6FF;
- border-radius: 42rpx;
- text-align: center;
- font-size: 32rpx;
- font-weight: 400;
- color: #506DFF;
- line-height: 84rpx;
- }
- .sure_btn {
- width: 330rpx;
- height: 84rpx;
- background: #506DFF;
- border-radius: 42rpx;
- text-align: center;
- font-size: 32rpx;
- font-weight: 400;
- color: #FFFFFF;
- line-height: 84rpx;
- }
- .sure_btn2 {
- width: 100%;
- height: 84rpx;
- background: #506DFF;
- border-radius: 42rpx;
- text-align: center;
- font-size: 32rpx;
- font-weight: 400;
- color: #FFFFFF;
- line-height: 84rpx;
- }
- }
- .u-radio-group {
- flex: unset;
- }
- }
- }
- </style>
|