初始化代码
This commit is contained in:
996
uniapp/uni-app/land/pages/order/detail.vue
Normal file
996
uniapp/uni-app/land/pages/order/detail.vue
Normal file
@@ -0,0 +1,996 @@
|
||||
<template>
|
||||
<view class="land-order-detail" v-if="detail.id">
|
||||
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
|
||||
:backgroundColor="scrollTop < 20 ?``:primaryColor" :leftIcon="options.notice?'iconshouye':'icon-left'"
|
||||
title="土地详情">
|
||||
</uni-nav-bar>
|
||||
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
|
||||
<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png">
|
||||
</image>
|
||||
<view class="pl-lg pr-lg c-base" style="height: 120rpx;">
|
||||
<view class="pt-md f-sm-title text-bold ellipsis">
|
||||
{{detail.pay_type<2 ?statusType[detail.pay_type] : detail.goods_name}}
|
||||
</view>
|
||||
<view class="f-caption" v-if="detail.pay_type == 1">请在<min-countdown :targetTime="over_time_text"
|
||||
color="#fff" @callback="countEnd">
|
||||
</min-countdown>内完成支付,逾期未支付将自动取消</view>
|
||||
<view class="f-caption" v-if="detail.pay_type > 1">订单编号:{{detail.order_code}}</view>
|
||||
</view>
|
||||
<view class="order-status-info flex-warp ml-lg mr-lg pt-lg pb-lg fill-base rel radius-24">
|
||||
<view class="status-item flex-center flex-column" v-for="(item,index) in statusList" :key="index">
|
||||
<image mode="aspectFill" lazy-load class="status-img radius"
|
||||
:src="`/static/image/farm/${item.img_name}-fill.png`">
|
||||
</image>
|
||||
<view class="f-icontext c-caption mt-sm" :style="{color:primaryColor}">{{item.title}}</view>
|
||||
</view>
|
||||
<view class="status-line abs"></view>
|
||||
</view>
|
||||
<!-- <view class="order-video-info rel">
|
||||
<image mode="aspectFill" lazy-load class="video-img" src=""></image>
|
||||
<view class="video-bg flex-center abs"><i class="iconfont icon-shipin c-base"></i></view>
|
||||
</view>
|
||||
-->
|
||||
<view class="order-count-info fill-base mt-md" v-if="detail.machine_info.data.length > 0">
|
||||
<view class="flex-between pt-lg pl-lg pr-lg">
|
||||
<view class="flex-y-baseline f-paragraph c-caption">
|
||||
<view class="c-title text-bold mr-sm">实时数据</view>
|
||||
<!-- <view>更新于:2021.09.10 16:24</view> -->
|
||||
</view>
|
||||
<!-- <i class="iconfont icon-shuaxin"></i> -->
|
||||
</view>
|
||||
<!-- <view class="pd-lg flex-center b-1px-b">
|
||||
<view class="count-item flex-center flex-column">
|
||||
<view class="f-paragraph c-title">28.7℃</view>
|
||||
<view class="f-caption c-caption">热敏温度</view>
|
||||
</view>
|
||||
<view class="count-item flex-center flex-column b-1px-l b-1px-r">
|
||||
<view class="f-paragraph c-title">28.7℃</view>
|
||||
<view class="f-caption c-caption">噪声监测</view>
|
||||
</view>
|
||||
<view class="count-item flex-center flex-column">
|
||||
<view class="f-paragraph c-title">28.7℃</view>
|
||||
<view class="f-caption c-caption">移动监测</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="pt-lg pl-lg pr-lg pb-md f-paragraph c-desc">
|
||||
<view class="flex-y-baseline">
|
||||
<view class="mr-md">无线温湿度</view>
|
||||
<view>土壤电导率三合一</view>
|
||||
</view>
|
||||
|
||||
<veiw class="flex-warp pb-md">
|
||||
<view class="machine-item flex-warp f-desc c-caption mt-md"
|
||||
v-for="(item,index) in detail.machine_info.data" :key="index">
|
||||
<view class="num">{{`(${index*1+1})`}}</view>
|
||||
<view class="text">{{item.text}}</view>
|
||||
<view>{{item.value.length == 0 ? '无' : item.value}}</view>
|
||||
</view>
|
||||
</veiw>
|
||||
<!-- <view class="flex-center pt-md"><i class="iconfont icon-down-bold" style="font-size: 28rpx;"></i></view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-md"></view>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex" :activeColor="primaryColor"
|
||||
:width="100/tabList.length + '%'" height="100rpx"></tab>
|
||||
<view class="b-1px-t"></view>
|
||||
|
||||
<block v-if="activeIndex == 0">
|
||||
<view
|
||||
class="order-text-info mt-md ml-md mr-md pl-lg pr-lg fill-base f-paragraph c-title box-shadow radius-24">
|
||||
<view class="flex-warp pt-lg pb-lg b-1px-b">
|
||||
<view class="text c-desc">农场名称</view>
|
||||
<view class="flex-1 text-right">{{detail.farmer_info.title}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg pb-lg b-1px-b">
|
||||
<view class="text c-desc">土地名称</view>
|
||||
<view class="flex-1 text-right">{{detail.goods_name}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-b">
|
||||
<view class="text c-desc">服务类型</view>
|
||||
<view>{{detail.massif_title}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-b">
|
||||
<view class="text c-desc">租赁周期</view>
|
||||
<view>{{`${detail.cycle}天`}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-b">
|
||||
<view class="text c-desc">起止时间</view>
|
||||
<view>{{detail.time_text}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t">
|
||||
<view class="text c-desc">订单编号</view>
|
||||
<view class="flex-warp">
|
||||
<view class="max-350 ellipsis">{{detail.order_code}}</view>
|
||||
<view @tap="$util.goUrl( {url:`${detail.order_code}`,openType:'copy'})"
|
||||
class="copy-btn flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t" v-if="detail.transaction_id">
|
||||
<view class="text c-desc">付款单号</view>
|
||||
<view class="flex-warp">
|
||||
<view class="max-350 ellipsis">{{detail.transaction_id}}</view>
|
||||
<view @tap="$util.goUrl( {url:`${detail.transaction_id}`,openType:'copy'})"
|
||||
class="copy-btn flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t">
|
||||
<view class="text c-desc">下单时间</view>
|
||||
<view>{{detail.create_time}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t" v-if="detail.pay_time">
|
||||
<view class="text c-desc">支付时间</view>
|
||||
<view>{{detail.pay_time}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t">
|
||||
<view class="text c-desc">土地价格</view>
|
||||
<view class="c-warning">¥{{detail.land_price}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t">
|
||||
<view class="text c-desc">服务价格</view>
|
||||
<view class="c-warning">¥{{detail.total_massif_price}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t" v-if="detail.seed.length > 0">
|
||||
<view class="text c-desc">种子价格</view>
|
||||
<view class="c-warning">¥{{detail.seed_price}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t">
|
||||
<view class="text c-desc">实付金额</view>
|
||||
<view class="c-warning">¥{{detail.pay_price}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t">
|
||||
<view class="text c-desc">支付方式</view>
|
||||
<view>{{payType[detail.pay_model]}}</view>
|
||||
</view>
|
||||
<!-- <view class="flex-between pt-lg pb-lg">
|
||||
<view class="text c-desc">合同</view>
|
||||
<view :style="{color:primaryColor}">下载合同</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="mt-md ml-md mr-md pl-lg pr-lg fill-base f-paragraph c-title box-shadow radius-24"
|
||||
v-if="detail.seed.length > 0">
|
||||
<view class="pt-lg pb-lg f-title text-bold b-1px-b">种子管理</view>
|
||||
<view class="pt-lg pb-lg">
|
||||
<view class="order-seed-item flex-center" :class="[{'mt-md':index!=0}]"
|
||||
v-for="(item,index) in detail.seed" :key="index">
|
||||
<image mode="aspectFill" lazy-load class="seed-img radius-10" :src="item.imgs"></image>
|
||||
<view class="flex-1 ml-lg c-title">
|
||||
<view class="flex-between">
|
||||
<view class="f-paragraph max-380 ellipsis">{{item.title}}</view>
|
||||
<view class="f-caption">{{item.area}}㎡</view>
|
||||
</view>
|
||||
<view class="flex-between f-caption c-caption">
|
||||
<view class="c-warning">¥{{item.seed_price}}</view>
|
||||
<view>x{{item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="order-text-info mt-md ml-md mr-md pl-lg pr-lg fill-base f-paragraph c-title box-shadow radius-24">
|
||||
<view class="pt-lg pb-lg f-title text-bold b-1px-b">租赁人信息</view>
|
||||
<view class="flex-center pt-lg">
|
||||
<view class="text c-desc">姓名</view>
|
||||
<view class="flex-1">{{detail.rent_user_name}}</view>
|
||||
</view>
|
||||
<view @tap.stop="$util.goUrl({url:detail.rent_mobile,openType:'call'})" class="flex-center pt-lg pb-lg">
|
||||
<view class="text c-desc">电话</view>
|
||||
<view class="flex-1" :style="{color:primaryColor}">{{detail.rent_mobile}}</view>
|
||||
</view>
|
||||
<view class="pb-lg" v-if="detail.text">
|
||||
<view class="text c-desc">备注</view>
|
||||
<view class="f-paragraph c-title">
|
||||
<view class="mt-sm">
|
||||
<text decode="emsp" style="word-break:break-all;">{{detail.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="activeIndex == 1">
|
||||
<view
|
||||
class="order-text-info fill-base mt-md ml-md mr-md pl-lg pr-lg f-paragraph c-title box-shadow radius-24"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between pt-lg pb-lg b-1px-b">
|
||||
<view class="f-title text-bold">第{{item.times}}次{{item.send_type == 1 ?'自提':'配送'}}</view>
|
||||
<view class="f-paragraph"
|
||||
:style="{color:item.pay_type == 2? subColor: item.pay_type == 3? primaryColor: ''}">
|
||||
{{sendPayType[item.send_type][item.pay_type]}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg">
|
||||
<view class="text c-desc">{{item.send_type == 1 ?'自提时间':'送货时间'}}</view>
|
||||
<view class="flex-1">{{item.time_text}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg">
|
||||
<view class="text c-desc">配送方式</view>
|
||||
<view class="flex-1">{{sendType[item.send_type]}}</view>
|
||||
</view>
|
||||
<view @tap.stop="toMap(index)" class="flex-warp pt-lg">
|
||||
<view class="text c-desc">{{item.send_type==1?'自提地址':'收货地址'}}</view>
|
||||
<view class="flex-1">{{item.send_type ==1 ? detail.farmer_info.address : item.address}}</view>
|
||||
</view>
|
||||
<view @tap.stop="toTel(index)" class="flex-warp pt-lg">
|
||||
<view class="text c-desc">{{item.send_type==1?'自提人':'收货人'}}</view>
|
||||
<view class="flex-1">
|
||||
{{`${item.user_name} ${item.mobile}`}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg">
|
||||
<view class="text c-desc">订单编号</view>
|
||||
<view class="flex-1">{{item.order_code}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg" v-if="item.send_type == 2 && item.transaction_id">
|
||||
<view class="text c-desc">付款单号</view>
|
||||
<view class="flex-1">{{item.transaction_id}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg" v-if="item.pay_type > 2 && item.send_type == 2">
|
||||
<view class="text c-desc">发货时间</view>
|
||||
<view class="flex-1">{{item.send_time}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg" v-if="item.pay_type == 7">
|
||||
<view class="text c-desc">{{item.send_type == 1 ? '取货时间':'收货时间'}}</view>
|
||||
<view class="flex-1">{{item.receiving_time}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg" v-if="item.send_type == 2">
|
||||
<view class="text c-desc">配送费</view>
|
||||
<view class="flex-1 c-warning">¥{{item.pay_price}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg" v-if="item.text">
|
||||
<view class="text c-desc">备注</view>
|
||||
<view class="flex-1">
|
||||
<text decode="emsp" style="word-break:break-all;">{{item.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-lg"></view>
|
||||
<!-- 用户端 -->
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t"
|
||||
v-if="!options.farmer && (item.pay_type == 2 || (item.send_type==2&&item.pay_type == 3))">
|
||||
<view></view>
|
||||
<view @tap.stop="toChangeOrder(index, item.send_type == 1 ? 'cancel_send_item':'refund_send_item')"
|
||||
class="send-btn flex-center f-caption radius-4"
|
||||
:style="{color:primaryColor,border:`1rpx solid ${primaryColor}`}" v-if="item.pay_type == 2">
|
||||
{{item.send_type ==1 ? '取消自提':'取消配送'}}
|
||||
</view>
|
||||
<view @tap.stop="toChangeOrder(index, 'end_item')" class="send-btn flex-center f-caption radius-4"
|
||||
:style="{color:primaryColor,border:`1rpx solid ${primaryColor}`}"
|
||||
v-if="item.send_type ==2 && item.pay_type ==3">
|
||||
确认收货
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading"
|
||||
v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
</block>
|
||||
|
||||
<block v-if="!options.farmer">
|
||||
<view class="space-max-footer"
|
||||
v-if="(activeIndex == 0 && (detail.pay_type == 1 || (detail.pay_type > 1 && !detail.have_eva))) || activeIndex == 1 ">
|
||||
</view>
|
||||
<view class="space-footer" v-else></view>
|
||||
<fix-bottom-button @cancel="toChangeOrder(-1,'cancel_item')" @confirm="toPay"
|
||||
:text="[{type:'cancel',text:'取消订单'},{type:'confirm',text:'去支付'}]"
|
||||
v-if="activeIndex == 0 && detail.pay_type == 1">
|
||||
</fix-bottom-button>
|
||||
|
||||
<fix-bottom-button @confirm="toEvaluate" :text="[{type:'confirm',text:'去评价'}]"
|
||||
v-if="activeIndex == 0 && detail.pay_type > 1 && !detail.have_eva">
|
||||
</fix-bottom-button>
|
||||
|
||||
<fix-bottom-button @cancel="toSend(1)" @confirm="toSend(2)"
|
||||
:text="[{type:'cancel',text:'去农场自提'},{type:'confirm',text:'我要配送'}]"
|
||||
v-if="activeIndex == 1 && detail.pay_type > 1">
|
||||
</fix-bottom-button>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="space-max-footer"></view>
|
||||
<fix-bottom-button @confirm="$util.goUrl({url:detail.address_info.mobile,openType:'call'})"
|
||||
:text="[{type:'confirm',text:'联系买家'}]">
|
||||
</fix-bottom-button>
|
||||
</block>
|
||||
|
||||
<!-- 用户端 取消订单/取消自提/取消配送/确认收货 -->
|
||||
<common-popup @confirm="confirmChangeOrder" ref="cancel_item" type="CANCEL_ORDER" :info="popupInfo">
|
||||
</common-popup>
|
||||
|
||||
<common-popup @confirm="confirmChangeOrder" ref="cancel_send_item" title="取消自提" desc="请确认是否取消自提,取消后将无法恢复"
|
||||
text="确认取消" :info="popupInfo">
|
||||
</common-popup>
|
||||
<common-popup @confirm="confirmChangeOrder" ref="refund_send_item" title="取消配送" desc="请确认是否取消配送,取消后将返还配送费"
|
||||
text="确认取消" :info="popupInfo">
|
||||
</common-popup>
|
||||
<common-popup @confirm="confirmChangeOrder" ref="end_item" type="END_ORDER" :info="popupInfo">
|
||||
</common-popup>
|
||||
|
||||
|
||||
<uni-popup ref="send_item" type="center" :custom="true">
|
||||
<view class="popup-send flex-center flex-column pd-lg fill-base radius-34">
|
||||
<view class="flex-center f-lg-title c-title text-bold">{{send_type === 1 ? '去农场自提' :'我要配送'}}
|
||||
</view>
|
||||
<view class="order-text-info f-paragraph c-title pd-lg">
|
||||
<view class="flex-between pt-lg pb-lg b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="mini-text">{{send_type==1?'自提地址':'收货地址'}}</view>
|
||||
</view>
|
||||
<view @tap.stop="toChooseAddr" class="flex-1 flex-between">
|
||||
<view :class="[{'c-placeholder':send_type == 2 && !address_info.id}]">
|
||||
{{send_type == 1 ? address_info.address : address_info.id ? `${address_info.address}${address_info.address_info}` : '请选择地址'}}
|
||||
</view>
|
||||
<i class="iconfont" :class="[{'icon-dingwei':send_type==1},{'icon-right':send_type==2}]"
|
||||
style="font-size: 28rpx;"></i>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="mini-text">{{timeTitle[detail.send_type]}}</view>
|
||||
</view>
|
||||
<view @tap.stop="$util.goUrl({url:`/mine/pages/choose-time`})" class="flex-1 flex-between">
|
||||
<view :class="[{'c-placeholder':!send_info.time.id},{'c-title':send_info.time.id}]">
|
||||
{{send_info.time.id ? `${send_info.time.date} ${send_info.time.time_text}` : `请选择${timeTitle[detail.send_type]}`}}
|
||||
</view>
|
||||
<i class="iconfont icon-right" style="font-size: 28rpx;"></i>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg" :class="[{'b-1px-b': detail.send_type == 1}]">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="mini-text">{{sendTitle[detail.send_tmpl_type]}}</view>
|
||||
</view>
|
||||
<view class="flex-1 flex-between">
|
||||
<input v-model="send_num" type="text" class="flex-1 f-paragraph" maxlength="20"
|
||||
placeholder-class="c-placeholder"
|
||||
:placeholder="`请输入${sendTitle[detail.send_tmpl_type]}`" />
|
||||
<view class="f-caption c-title ml-sm">{{detail.send_tmpl_type==1?detail.unit:'kg'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="send_type == 1">
|
||||
<view class="flex-between pt-lg pb-lg b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="mini-text">姓名</view>
|
||||
</view>
|
||||
<input v-model="user_name" type="text" class="flex-1 f-paragraph" maxlength="20"
|
||||
placeholder-class="c-placeholder" placeholder="请输入姓名" />
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="mini-text">手机号</view>
|
||||
</view>
|
||||
<input v-model="mobile" type="text" class="flex-1 f-paragraph"
|
||||
placeholder-class="c-placeholder" placeholder="请输入手机号" />
|
||||
<button open-type="getPhoneNumber" @getphonenumber="toAuthPhone"
|
||||
class="clear-btn auth-phone-btn flex-center" :style="{color:primaryColor}">立即授权</button>
|
||||
</view>
|
||||
</block>
|
||||
<textarea v-model="text" class="textarea-item pd-lg mt-md f-paragraph c-title radius-16"
|
||||
maxlength="200" placeholder-class="c-placeholder" placeholder="请输入备注信息"></textarea>
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<view @tap="$refs.send_item.close()" class="popup-btn flex-center f-paragraph c-desc radius mr-lg">
|
||||
取消
|
||||
</view>
|
||||
<view @tap="toSendOrder" class="popup-btn flex-center f-paragraph c-base radius"
|
||||
:style="{background:primaryColor}">
|
||||
{{send_type==1?'确认自提':'立即支付'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
options: {},
|
||||
detail: {},
|
||||
sourceInd: 0,
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
1: '待支付',
|
||||
2: '租赁中',
|
||||
7: '已完成',
|
||||
},
|
||||
payType: {
|
||||
1: '微信支付',
|
||||
2: '余额支付',
|
||||
3: '支付宝支付'
|
||||
},
|
||||
sendType: {
|
||||
1: '自提',
|
||||
2: '快递'
|
||||
},
|
||||
sendPayType: {
|
||||
1: {
|
||||
'-1': '已取消',
|
||||
2: '待提货',
|
||||
3: '已提货',
|
||||
7: '已完成'
|
||||
},
|
||||
2: {
|
||||
'-1': '已取消',
|
||||
2: '待配送',
|
||||
3: '配送中',
|
||||
7: '已完成'
|
||||
}
|
||||
},
|
||||
sendTitle: {
|
||||
1: '配送数量',
|
||||
2: '配送重量'
|
||||
},
|
||||
timeTitle: {
|
||||
1: '自提时间',
|
||||
2: '送货时间'
|
||||
},
|
||||
statusList: [{
|
||||
id: 1,
|
||||
title: '下单',
|
||||
img_name: 'order'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '已播种',
|
||||
img_name: 'sow'
|
||||
}, {
|
||||
id: 3,
|
||||
title: '生长中',
|
||||
img_name: 'grow'
|
||||
}, {
|
||||
id: 4,
|
||||
title: '已完成',
|
||||
img_name: 'done'
|
||||
}],
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 0,
|
||||
title: '土地信息'
|
||||
}, {
|
||||
id: 1,
|
||||
title: '配送信息',
|
||||
number: 0
|
||||
}],
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
lockTap: false,
|
||||
send_type: 1,
|
||||
address_info: {
|
||||
id: 0,
|
||||
address: ''
|
||||
},
|
||||
send_info: {
|
||||
time_index: '',
|
||||
time: {
|
||||
date: '',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
}
|
||||
},
|
||||
send_num: '',
|
||||
user_name: '',
|
||||
mobile: '',
|
||||
text: ''
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
let {
|
||||
tab = 0,
|
||||
farmer = 0,
|
||||
notice = 0
|
||||
} = options
|
||||
options.farmer = farmer
|
||||
options.notice = notice
|
||||
this.options = options
|
||||
this.activeIndex = tab
|
||||
this.updateOrderItem({
|
||||
key: 'haveOperItem',
|
||||
val: false
|
||||
})
|
||||
this.initIndex()
|
||||
},
|
||||
onUnload() {
|
||||
if (!this.haveOperItem) return
|
||||
this.$util.back()
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.activeIndex < 2) return
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
haveOperItem: state => state.order.haveOperItem,
|
||||
over_time_text() {
|
||||
return new Date().getTime() + this.detail.over_time * 1000
|
||||
}
|
||||
}),
|
||||
methods: {
|
||||
...mapActions(['getConfigInfo', 'getAuthPhone']),
|
||||
...mapMutations(['updateOrderItem']),
|
||||
async initIndex() {
|
||||
let {
|
||||
id
|
||||
} = this.options
|
||||
let data = await this.$api.land.orderInfo({
|
||||
id
|
||||
})
|
||||
let {
|
||||
type: send_tmpl_type
|
||||
} = data.send_tmpl
|
||||
data.send_tmpl_type = send_tmpl_type
|
||||
this.detail = data
|
||||
let {
|
||||
activeIndex
|
||||
} = this
|
||||
this.handerTabChange(activeIndex)
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
},
|
||||
countEnd() {
|
||||
this.$util.log("倒计时完了")
|
||||
setTimeout(() => {
|
||||
this.initRefresh()
|
||||
this.$util.back()
|
||||
}, 1000)
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
if (index < 1) return
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
activeIndex
|
||||
} = this
|
||||
let {
|
||||
id
|
||||
} = this.options
|
||||
param.land_order_id = id
|
||||
let newList = await this.$api.land.userSendOrderList(param);
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.$util.hideAll()
|
||||
},
|
||||
// 取消订单/取消自提/取消配送/确认取货/确认收货/立即发货
|
||||
async toChangeOrder(index, key) {
|
||||
let {
|
||||
id,
|
||||
order_code,
|
||||
goods_cover = '',
|
||||
} = index == -1 ? this.detail : this.list.data[index]
|
||||
this.popupInfo = {
|
||||
id,
|
||||
name: `订单编号:${order_code}`,
|
||||
image: goods_cover,
|
||||
index,
|
||||
refs_key: key,
|
||||
}
|
||||
this.$refs[key].open()
|
||||
},
|
||||
async confirmChangeOrder() {
|
||||
let {
|
||||
id,
|
||||
index,
|
||||
refs_key
|
||||
} = this.popupInfo
|
||||
if (this.lockTap) return;
|
||||
this.lockTap = true;
|
||||
this.$util.showLoading()
|
||||
let methodModel = {
|
||||
'cancel_item': {
|
||||
method: 'cancelOrder',
|
||||
msg: '取消成功',
|
||||
pay_type: -1
|
||||
},
|
||||
'cancel_send_item': {
|
||||
method: 'sendOrderRefund',
|
||||
msg: '取消成功',
|
||||
pay_type: -1
|
||||
},
|
||||
'refund_send_item': {
|
||||
method: 'sendOrderRefund',
|
||||
msg: '取消成功',
|
||||
pay_type: -1
|
||||
},
|
||||
'end_item': {
|
||||
method: 'sendOrderReceiving',
|
||||
msg: '收货成功',
|
||||
pay_type: 7
|
||||
}
|
||||
}
|
||||
let {
|
||||
method,
|
||||
msg,
|
||||
pay_type
|
||||
} = methodModel[refs_key]
|
||||
try {
|
||||
await this.$api.land[method]({
|
||||
id
|
||||
})
|
||||
this.$util.hideAll()
|
||||
if (refs_key == 'cancel_item') {
|
||||
this.detail.pay_type = pay_type
|
||||
} else {
|
||||
this.list.data[index].pay_type = pay_type
|
||||
}
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
})
|
||||
if (['end_item', 'cancel_send_item', 'refund_send_item'].includes(refs_key)) {
|
||||
this.initRefresh()
|
||||
}
|
||||
this.lockTap = false
|
||||
this.$refs[refs_key].close()
|
||||
setTimeout(() => {
|
||||
this.$util.back()
|
||||
}, 1000)
|
||||
} catch (e) {
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
this.$util.hideAll()
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
// 去支付
|
||||
async toPay(index) {
|
||||
if (this.lockTap) return;
|
||||
this.lockTap = true;
|
||||
this.$util.showLoading()
|
||||
let {
|
||||
id,
|
||||
pay_model
|
||||
} = this.detail
|
||||
try {
|
||||
let {
|
||||
pay_list
|
||||
} = await this.$api.land.landRePayOrder({
|
||||
id
|
||||
})
|
||||
this.$util.hideAll()
|
||||
if (pay_list) {
|
||||
if (pay_model == 3) {
|
||||
pay_list = {
|
||||
orderInfo: pay_list,
|
||||
provider: 'alipay'
|
||||
}
|
||||
}
|
||||
try {
|
||||
await this.$util.pay(pay_list)
|
||||
this.lockTap = false;
|
||||
this.list.data[index].pay_type = 2
|
||||
this.$util.back()
|
||||
} catch (e) {
|
||||
this.lockTap = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
this.$util.hideAll()
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
async toTel(index) {
|
||||
if (!this.options.farmer) return
|
||||
let {
|
||||
mobile: url
|
||||
} = this.list.data[index]
|
||||
this.$util.goUrl({
|
||||
url,
|
||||
openType: 'call'
|
||||
})
|
||||
},
|
||||
async toMap(index) {
|
||||
let {
|
||||
farmer_info
|
||||
} = this.detail
|
||||
let send_type = index == -1 ? 1 : this.list.data[index].send_type
|
||||
let {
|
||||
lat,
|
||||
lng,
|
||||
address
|
||||
} = send_type == 1 ? farmer_info : this.list.data[index]
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
await uni.getLocation({
|
||||
type: 'gcj02',
|
||||
})
|
||||
await uni.openLocation({
|
||||
latitude: lat * 1,
|
||||
longitude: lng * 1,
|
||||
name: address,
|
||||
scale: 28
|
||||
})
|
||||
},
|
||||
toSend(send_type) {
|
||||
let address_info = this.$util.deepCopy(this.detail.address_info)
|
||||
let farmer_addr = this.$util.deepCopy(this.detail.farmer_info.address)
|
||||
this.address_info = send_type == 1 ? {
|
||||
id: 0,
|
||||
address: farmer_addr
|
||||
} : address_info
|
||||
this.send_info = {
|
||||
time_index: '',
|
||||
time: {
|
||||
date: '',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
}
|
||||
}
|
||||
if (send_type == 1) {
|
||||
let {
|
||||
user_name,
|
||||
mobile
|
||||
} = address_info
|
||||
this.user_name = user_name
|
||||
this.mobile = mobile
|
||||
}
|
||||
this.text = ''
|
||||
this.send_type = send_type
|
||||
this.$refs.send_item.open()
|
||||
},
|
||||
toChooseAddr() {
|
||||
let {
|
||||
send_type,
|
||||
} = this
|
||||
if (send_type == 1) {
|
||||
this.toMap(-1)
|
||||
return
|
||||
}
|
||||
this.$util.goUrl({
|
||||
url: `/mine/pages/address/list?check=3`
|
||||
})
|
||||
},
|
||||
// 授权手机号
|
||||
async toAuthPhone(e) {
|
||||
let phone = await this.getAuthPhone({
|
||||
e,
|
||||
})
|
||||
if (!phone) return
|
||||
this.$nextTick(() => {
|
||||
this.mobile = phone
|
||||
})
|
||||
},
|
||||
// 自提/配送
|
||||
async toSendOrder() {
|
||||
let {
|
||||
send_type,
|
||||
sendTitle,
|
||||
timeTitle,
|
||||
send_num,
|
||||
user_name,
|
||||
mobile,
|
||||
text
|
||||
} = this
|
||||
let {
|
||||
id: order_id,
|
||||
send_tmpl_type
|
||||
} = this.detail
|
||||
let {
|
||||
id: address_id
|
||||
} = this.address_info
|
||||
if (!address_id && send_type == 2) {
|
||||
this.$util.showToast({
|
||||
title: `请选择收货地址`
|
||||
})
|
||||
return
|
||||
}
|
||||
let {
|
||||
date = '',
|
||||
start_time = '',
|
||||
end_time = ''
|
||||
} = this.send_info.time
|
||||
if (!date) {
|
||||
this.$util.showToast({
|
||||
title: `请选择${timeTitle[send_type]}`
|
||||
})
|
||||
return
|
||||
}
|
||||
start_time = this.$util.DateToUnix(`${date} ${start_time}`)
|
||||
end_time = this.$util.DateToUnix(`${date} ${end_time}`)
|
||||
|
||||
let reg = send_tmpl_type == 1 ? /^[1-9]+[0-9]*]*$/ :
|
||||
/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/
|
||||
if (send_type == 2 && (!send_num || !reg.test(send_num))) {
|
||||
this.$util.showToast({
|
||||
title: !send_num ? `请输入${sendTitle[send_tmpl_type]}` : send_tmpl_type == 1 ?
|
||||
`请输入正确的配送数量` : `请输入正确的配送重量,最多2位小数`
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let param = {
|
||||
order_id,
|
||||
send_type,
|
||||
send_num,
|
||||
address_id,
|
||||
start_time,
|
||||
end_time,
|
||||
text
|
||||
}
|
||||
if (send_type == 1) {
|
||||
user_name = user_name ? user_name.replace(/(^\s*)|(\s*$)/g, "") : ''
|
||||
if (!user_name || !mobile || !/^(1[0-9]{10})$/.test(mobile)) {
|
||||
this.$util.showToast({
|
||||
title: !user_name ? `请输入姓名` : !mobile ? `请输入手机号` : `${mobile} 手机号无效`
|
||||
})
|
||||
return
|
||||
}
|
||||
param.user_name = user_name
|
||||
param.mobile = mobile
|
||||
}
|
||||
this.$util.showLoading()
|
||||
if (send_type == 1) {
|
||||
param.pay_model = 2
|
||||
await this.$api.land.sendOrderApply(param)
|
||||
this.$util.hideAll()
|
||||
this.$util.showToast({
|
||||
title: `提交成功`
|
||||
})
|
||||
this.$refs.send_item.close()
|
||||
setTimeout(() => {
|
||||
this.initIndex()
|
||||
}, 1000)
|
||||
return
|
||||
}
|
||||
|
||||
let {
|
||||
send_price: pay_price
|
||||
} = await this.$api.land.sendOrderPayInfo(param)
|
||||
this.$util.hideAll()
|
||||
let orderInfo = Object.assign({}, param, {
|
||||
pay_price,
|
||||
page_type: 'land_send'
|
||||
});
|
||||
this.updateOrderItem({
|
||||
key: 'orderInfo',
|
||||
val: orderInfo
|
||||
})
|
||||
this.$refs.send_item.close()
|
||||
let url = `/mine/pages/pay`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
},
|
||||
// 去评价
|
||||
toEvaluate() {
|
||||
let {
|
||||
id
|
||||
} = this.detail
|
||||
let url = `/mine/pages/evaluate/edit?id=${id}&type=land`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.land-order-detail {
|
||||
|
||||
.order-video-info {
|
||||
width: 750rpx;
|
||||
height: 380rpx;
|
||||
margin-top: 26rpx;
|
||||
|
||||
.video-img {
|
||||
width: 750rpx;
|
||||
height: 380rpx;
|
||||
}
|
||||
|
||||
.video-bg {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 750rpx;
|
||||
height: 380rpx;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
|
||||
.iconfont {
|
||||
font-size: 70rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-count-info {
|
||||
.count-item {
|
||||
width: 33.33%;
|
||||
}
|
||||
|
||||
.machine-item {
|
||||
width: 50%;
|
||||
|
||||
.num {
|
||||
width: 50rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
width: 150rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-seed-item {
|
||||
.seed-img {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
width: 180rpx;
|
||||
height: 56rpx;
|
||||
transform: rotateZ(360deg)
|
||||
}
|
||||
|
||||
.popup-send {
|
||||
width: 686rpx;
|
||||
|
||||
.textarea-item {
|
||||
width: 506rpx;
|
||||
height: 200rpx;
|
||||
border: 1rpx solid #eee;
|
||||
transform: rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user