123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629 |
- <!-- 货源 -->
- <template>
- <view class="content">
- <view class="fixed1"></view>
- <view v-if="!isSearch">
- <view class="fixed">
- <view class='title flex flex-center'>
- <view>订单</view>
- <u-icon class="search" name="search" color="" size="28" @click="search"></u-icon>
- </view>
- <u-tabs :list="tabList" @click="clickTab" lineColor='#2772FB' :current='tabIndex' :activeStyle="{
- color: '#2772FB',
- fontWeight: 'bold',
- transform: 'scale(1.05)'
- }"></u-tabs>
- </view>
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
- class="mescroll">
- <view :id="'good'+good.id" class="good-list" v-for="good in goods" :key="good.id"
- @click="toDetail(good.id)">
- <view style="padding: 0 35rpx 20rpx 35rpx;">
- <view class="flex flex-space-between row1">
- <view class="item1">
- {{good.orderNo}} {{good.goodsName}}
- </view>
- <view class="item2">
- {{good.orderStatus}}
- </view>
- </view>
- <view class="flex row2">
- <view class="left flex flex-space-between">
- <view class="ssx">{{$helper.getProvinceAbbreviation(good.sendPrivate)}}</view>
- <view class="level2-title">{{good.sendCity}} {{good.sendArea}}</view>
- <view>
- <image class="jt-icon" src="@/static/images/goodSource/jt.png" mode='widthFix'>
- </image>
- </view>
- <view class="ssx">
- {{$helper.getProvinceAbbreviation(good.unloadPrivate)}}
- </view>
- <view class="level2-title">{{good.unloadCity}} {{good.unloadArea}}</view>
- </view>
- </view>
- <view class="flex row3">
- <view class="left">
- <image class="hz" src="@/static/images/news/hz.png"></image>
- </view>
- <view class="right">
- <view class="flex fontsize-26 row">
- <view>{{good.compName}}</view>
- <view class="sline"></view>
- <view>{{good.cargoOwner}}</view>
- </view>
- <view class="flex align-center">
- <view class="fontsize-26 ">运距 {{good.distance}}km</view>
- </view>
- </view>
- </view>
- <view class="row4 flex flex-end align-center">
- <view class="time">{{good.updateDate}}</view>
- <view class="car">{{good.freight}}{{good.illingMethod==0?'元/吨':'元/车'}}</view>
- </view>
- <view class="row5 flex flex-end">
- <view class="stop active" @click.stop="stop(good)" v-if="good.orderStatus=='待货主确认'||good.orderStatus=='未装车'">终止</view>
- <view class="start normal" @click.stop="confirmLoading(good)" v-if="good.orderStatus=='未装车'||good.orderStatus=='货主驳回装车信息'||good.orderStatus=='平台驳回装车信息'">确认装车</view>
- <view class="start normal" v-if="good.orderStatus!='未装车'&&good.orderStatus!='待货主确认'">联系客服</view>
- <view class="start normal" @click.stop="confirmUnLoading(good)" v-if="good.orderStatus=='运输中'||good.orderStatus=='货主驳回卸车信息'||good.orderStatus=='平台驳回卸车信息'">确认卸车</view>
- <!-- <view class="start">评价</view>
- -->
- <view class="start normal" @click.stop="closed(good)" v-if="good.orderStatus=='结算中'">完结</view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- <view v-else class="search-view">
- <view class="flex">
- <u-icon name="arrow-left" color="" size="20" class="back-icon" @click="back()"></u-icon>
- <u-search placeholder="可按编号、货主、收发地查找" placeholderColor="#AFB3BF" :actionStyle="textColor"
- bgColor="#F5F6FA" v-model="searchKeyWord" actionText='取消' @custom="cancel" @search="getSearch">
- </u-search>
- </view>
- <view class="near-search">
- <view class="flex flex-space-between">
- <view class="near-search-text">最近搜索</view>
- <u-icon name="trash-fill" color="#AFB3BF" size="20" class="back-icon" @click="del"></u-icon>
- </view>
- <view class="">
- <view v-for="(item,index) in useSearchList" :key="index" class="item-style inline-block">
- {{item}}
- </view>
- </view>
- </view>
- </view>
- <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :confirmText='confirmText'
- :closeOnClickOverlay='true' :showCancelButton='true' @confirm="confirmClick" @close="cancelClick"
- @cancel="cancelClick" class="modal">
- <u-radio-group v-model="radiovalue1" placement="" v-if='isShowTerminationReason' class='row'>
- <u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1" :key="index"
- :label="item.name" :name="item.name" @change="radioChange">
- </u-radio>
- </u-radio-group>
- <u--textarea class="row" v-model="value2" placeholder="终止原因描述" count maxlength='50'
- v-if='isShowTerminationReason'>
- </u--textarea>
- </u-modal>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import {
- apiGoods
- } from "@/api/mock.js"
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- // isShowStopBtn: false,
- // isConfirmLoadingBtn:false,
- // isShowCustomerServiceBtn:false,
- // isConfirmUnLoadingBtn:false,
- // isClosedBtn:false,
- searchKeyWord: '',
- useSearchList: [],
- mescroll: null,
- isShowTerminationReason: false,
- id: '',
- value2: '',
- radiolist1: [{
- name: '已与货主协商',
- disabled: false
- },
- {
- name: '货主原因终止',
- disabled: false
- },
- {
- name: '司机个人原因终止',
- disabled: false
- }, {
- name: '其他',
- disabled: false
- }
- ],
- radiovalue1: '已与货主协商',
- confirmText: '终止',
- alertTitle: '确定终止订单?',
- alertContent: "",
- isShowAlert: false,
- textColor: {
- "color": "#AFB3BF"
- },
- isSearch: false,
- startPlace: '齐齐哈尔齐齐哈尔',
- endPlace: '全国',
- goods: [], // 数据列表
- src: 'https://cdn.uviewui.com/uview/album/1.jpg',
- height: "", // 需要固定swiper的高度
- tabList: [{
- name: '全部'
- }, {
- name: '未发运'
- }, {
- name: '运输中'
- }, {
- name: '待收货'
- }, {
- name: '待结算'
- },
- {
- name: '已完结'
- },
- // {
- // name: '评价'
- // },
- ],
- tabIndex: 0,
- scrollTop: 0
- }
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
- },
- onTabItemTap(e) {
- // tab 点击时执行,此处直接接收单击事件
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- },
- created() {
- //#ifdef APP-PLUS
- // this.getLngLat();
- //#endif
- },
- onLoad() {
- // let _isHave = this.$utils.getRoles('aaa')
- // console.log(_isHave)
- },
- onShow() {
- this.upCallback({
- size: 10,
- num: 1
- })
- },
- onPageScroll(res) {
- this.scrollTop = res.scrollTop
- console.log("页面滚动了", res.scrollTop)
- if (this.scrollTop > 1200) {
- uni.setTabBarItem({
- index: 1,
- text: '返回顶部',
- iconPath: 'static/images/common/top@2x.png',
- selectedIconPath: 'static/images/common/top@2x.png'
- })
- } else {
- uni.setTabBarItem({
- index: 1,
- text: '订单',
- iconPath: 'static/images/common/dingdan@2x(1).png',
- selectedIconPath: 'static/images/common/dingdan@2x.png'
- })
- }
- },
- methods: {
- // 完结
- closed(item) {
- let that = this
- this.$request.baseRequest('post', '/orderInfo/api/editEnd', {
- id: item.id,
- }).then(res => {
- if (res.code == 200) {
- this.$refs.uToast.show({
- type: 'success',
- message: "提交成功",
- complete() {
- that.upCallback({
- size: 10,
- num: 1
- })
- }
- })
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- confirmLoading(item) {
- uni.$u.route('/pages/order/confirmLoading', item);
- },
- confirmUnLoading(item) {
- uni.$u.route('/pages/order/confirmUnloading', item);
- },
- back() {
- uni.navigateBack(-1)
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- radioChange(n) {
- console.log('radioChange', n);
- },
- stop(item) {
- // 货主接单
- if (item.orderStatusKey == 1) {
- this.isShowTerminationReason = false
- } else {
- this.isShowTerminationReason = true
- }
- this.id = item.id
- this.isShowAlert = true
- },
- init() {
- },
- del() {
- this.isShowAlert = true
- },
- confirmClick() {
- console.log('终止')
- if (this.radiovalue1 == '其他' && !this.value2) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请填写终止原因描述!",
- })
- return
- }
- let _terminationReason = ''
- if (this.radiovalue1 == '已与货主协商') {
- _terminationReason = 1
- } else if (this.radiovalue1 == '货主原因终止') {
- _terminationReason = 2
- } else if (this.radiovalue1 == '司机个人原因终止') {
- _terminationReason = 3
- } else if (this.radiovalue1 == '其他') {
- _terminationReason = 4
- }
- this.$request.baseRequest('post', '/orderInfo/api/end', {
- id: this.id,
- terminator: 1,
- terminationReason: _terminationReason,
- terminationReasonDescription: this.value2
- }).then(res => {
- console.log(res)
- this.isShowAlert = false
- this.mescroll.resetUpScroll()
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- cancelClick() {
- this.isShowAlert = false
- },
- getSearch(e) {
- // = uni.getStorageSync('useSearchList')
- this.useSearchList.unshift(e)
- uni.setStorageSync("useSearchList", this.useSearchList)
- console.log("点击搜索", e)
- this.upCallback({
- size: 10,
- num: 1
- })
- },
- cancel() {
- this.isSearch = false
- },
- toDetail(id) {
- uni.$u.route('/pages/order/orderDetails', {
- id: id,
- });
- },
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- // 此处可以继续请求其他接口
- // if(page.num == 1){
- // // 请求其他接口...
- // }
- // 如果希望先请求其他接口,再触发upCallback,可参考以下写法
- // if(!this.isInitxx){
- // apiGetxx().then(res=>{
- // this.isInitxx = true
- // this.mescroll.resetUpScroll() // 重新触发upCallback
- // }).catch(()=>{
- // this.mescroll.endErr()
- // })
- // return // 此处return,先获取xx
- // }
- // 订单状态12345
- this.$request.baseRequest('get', '/orderInfo/selectOrderInfo', {
- commonId: this.userInfo.id,
- searchKeyWord: this.searchKeyWord,
- searchType: this.searchType,
- pageSize: page.size,
- currentPage: page.num
- }).then(res => {
- this.isSearch = false
- if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
- this.goods = this.goods.concat(res.data.records); //追加新数据
- this.mescroll.endBySize(res.data.records.length, res.data.total);
-
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- clickTab(val) {
- console.log(val)
- this.searchType = val.index
- this.upCallback({
- size: 10,
- num: 1
- })
- },
- search() {
- this.isSearch = true
- //获取缓存搜索数据
- this.useSearchList = uni.getStorageSync('useSearchList')
- if (!this.useSearchList) this.useSearchList = [];
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .banner {
- width: 100%;
- position: relative;
- }
- .fixed,
- .fixed1 {
- background: white;
- position: fixed;
- top: var(--status-bar-height);
- z-index: 999;
- width: 100%;
- }
- .fixed {
- .title {
- background: white;
- position: relative;
- font-size: 36rpx;
- font-weight: 500;
- color: rgba(0, 0, 0, 0.85);
- .search {
- position: absolute;
- right: 20rpx;
- }
- }
- }
- .fixed1 {
- top: 0;
- height: var(--status-bar-height);
- background: white;
- }
- .banner-img {
- width: 100%;
- }
- .head {
- position: absolute;
- width: calc(100% - 108rpx);
- bottom: 0;
- background: white;
- margin: 0 20rpx;
- border-radius: 20rpx;
- .item1,
- .item3 {
- width: 40%;
- .text {
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- }
- }
- .item1 .text {
- text-align: left;
- }
- .item3 .text {
- text-align: right;
- }
- }
- .change-btn {
- width: 86rpx;
- height: 86rpx;
- }
- .good-list {
- background-color: white;
- margin: 20rpx;
- padding: 20rpx 0rpx 0 0;
- border-radius: 20rpx;
- .row1 {
- font-size: 26rpx;
- .item1 {
- color: #333333;
- }
- .item2 {
- color: #FE6300;
- }
- }
- .row2 {
- margin: 30rpx 0;
- }
- .row3 {
- background: #F5F6FA;
- padding: 20rpx;
- border-radius: 10rpx;
- color: #333333;
- .hz {
- width: 74rpx;
- height: 74rpx;
- margin-right: 30rpx;
- }
- }
- .row4 {
- margin: 20rpx 0;
- .time {
- font-size: 26rpx;
- color: #999999;
- margin-right: 20rpx;
- }
- .car {
- font-size: 28rpx;
- color: #000000;
- }
- }
- .row5 {
- margin: 20rpx 0;
- font-size: 28rpx;
- .stop {
- border-radius: 33px;
- border: 1px solid #FE6300;
- padding: 13rpx 31rpx;
- margin-right: 20rpx;
- color: #FE6300;
- }
- .normal {
- border: 1px solid #CDCDCD;
- border-radius: 33px;
- padding: 13rpx 31rpx;
- }
- }
- }
- .jt-icon {
- position: relative;
- top: 6rpx;
- width: 60rpx;
- margin: 0 20rpx;
- }
- .row {
- margin: 10rpx 0;
- align-items: center;
- }
- // .item-bottom {
- // background: #F0F5FF;
- // padding: 0 30rpx;
- // .name {
- // font-size: 26rpx;
- // font-weight: 700;
- // color: #000000;
- // margin-left: 30rpx;
- // }
- // .hp {
- // margin: 30rpx;
- // }
- // .number-color {
- // margin: 0 10rpx;
- // }
- // .qd {
- // background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
- // border-radius: 13px;
- // font-size: 29rpx;
- // font-weight: 400;
- // color: #FFFFFF;
- // padding: 10rpx 35rpx;
- // }
- // }
- .dw {
- align-items: center;
- }
- .mescroll {
- margin-top: calc(var(--status-bar-height) + 140rpx);
- }
- .sline {
- height: 28rpx;
- width: 1px;
- background: black;
- margin: 0 20rpx;
- }
- .search-view {
- margin-top: var(--status-bar-height);
- background: white;
- padding: 0 20rpx;
- }
- .back-icon {
- margin-right: 20rpx;
- }
- .near-search-text {
- margin: 20rpx 0;
- }
- .item-style {
- background: #F5F6FA;
- padding: 11rpx 24rpx;
- margin-right: 20rpx;
- border-radius: 10px;
- font-size: 26rpx;
- color: #333333;
- }
- /deep/.u-modal__content {
- flex-direction: column;
- }
- </style>
|