123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833 |
- <template>
- <view class="order">
- <view class="orderStatus">
- <view v-for="(item,index) in status" :class="checkedIndex === index ? 'active' : ''" :key="index"
- @click="statusTap(item.code,index)">{{item.info}}
- </view>
- </view>
- <!-- <view class="list"> -->
- <mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getList" @init="mescrollInit">
- <view class="item" v-for="(item,index) in list" :key="index">
- <view class="lTitle" @click="goDetails(item.cId)">
- <view style="font-weight: bold;">上门时间:{{item.dtCreateTime}}</view>
- <!-- <view class="status">{{item.nStatus === 0 ? "待接单" : item.nStatus === 1 ? "服务中": item.nStatus === 2 ? "待评价": item.nStatus === 3 ? "已完成": item.nStatus === -1 ? "待付款" : item.nStatus === -2 ? "已取消" :'已拒绝'}}</view>-->
- <view class="status">{{item.statusName}}</view>
- </view>
- <view class="cont" @click="goDetails(item.cId)">
- <view>客户:{{item.cNickName}}</view>
- <view>项目:{{item.cGoods[0].cTitle}}</view>
- </view>
- <!-- <view class="cont" @click="goDetails(item.cId)">
- <view>订单金额:</view>
- <view style="color: #333;font-weight: bold;">¥{{item.totalPrice}}</view>
- </view> -->
- <view class="cont" @click="goDetails(item.cId)">
- <view>下单时间:{{item.dtCreateTime}}</view>
- <!-- <view style="color: #333;font-weight: bold;">¥{{item.totalPrice}}</view> -->
- </view>
- <!-- <view class="btn" v-if="item.nStatus < 1"> -->
- <view class="btn">
- <view class="count_down">
- <span>¥</span>{{item.totalPrice}}
- <!-- 剩余<u-count-down :timestamp="item.remainingTime" @end="getList" v-if="item.dtCreateTime>0"></u-count-down> -->
- </view>
- <view class="button">
- <!-- <view class="btn" v-if="item.nStatus === 0"> -->
- <view class="" v-if="item.nStatus === 0">
- <text class="refuse" @click="refuse(item.cId)">拒绝接单</text>
- <text class="pay" @click="scheduling(item.cId)">接单</text>
- </view>
- <view v-if="item.nStatus === 1">
- <text class="pay" @click="depart(item.cId,item.orderNo)">出发</text>
- </view>
- <view v-if="item.nStatus === 6">
- <text class="pay" @click="arriveOderLocation(item.cId,item.orderNo)">到达</text>
- </view>
- <view v-if="item.nStatus === 2">
- <text class="pay" @click="enterService(item.cId,item.orderNo)">开始服务</text>
- </view>
- <view v-if="item.nStatus === 3">
- <text class="pay" @click="complete(item,item.cId,item.orderNo)">完成订单</text>
- </view>
- <!-- </view> -->
- <!-- <text class="cancel" @click="cancle(item.cId)" v-if="item.nStatus > -2 && item.nStatus < 1">取消订单</text>
- <text class="pay" @click="nowYuyue(item,item.cId,item.dTotalMoney,item.remainingTime)"
- v-if="item.nStatus == -1 && item.nStatus < 1 ">支付订单</text>
- <text class="pay" @click="goEvaluate(item)" v-if="item.nStatus == 4">去评价</text>
- <text class="pay" @click="deleteOrder(item.cId)" v-if="item.nStatus <= -2 || item.nStatus == 5">删除订单</text> -->
- </view>
- </view>
- <!-- <view class="btn" v-if="item.nStatus <= -2 || item.nStatus == 5">
- <text @click="deleteOrder(item.cId)">删除订单</text>
- </view> -->
- </view>
- <!-- <view class="item" v-for="(item,index) in list" :key="index">
- <view class="lTitle" @click="goDetails(item.cId)">
- <view style="font-weight: bold;">下单时间:{{item.dtCreateTime}}</view>
- <view class="status">{{item.statusName}}</view>
- </view>
- <view class="cont" @click="goDetails(item.cId)">
- <view>商家:{{item.js.cName}}</view>
- <view>项目:{{item.cGoods[0].cTitle}}</view>
- </view>
- <view class="cont" @click="goDetails(item.cId)">
- <view>订单金额:</view>
- <view style="color: #333;font-weight: bold;">¥{{item.totalPrice}}</view>
- </view>
- <view class="btn" v-if="item.nStatus === 0">
- <span @click="scheduling(item.cId)">接单</span>
- <span @click="refuse(item.cId)">拒绝接单</span>
- </view>
- <view class="btn" v-if="item.nStatus === 1">
- <span @click="depart(item.cId,item.orderNo)">出发</span>
- </view>
- <view class="btn" v-if="item.nStatus === 6">
- <span @click="arriveOderLocation(item.cId,item.orderNo)">到达</span>
- </view>
- <view class="btn" v-if="item.nStatus === 2">
- <span @click="enterService(item.cId,item.orderNo)">开始服务</span>
- </view>
- <view class="btn" v-if="item.nStatus === 3">
- <span @click="complete(item,item.cId,item.orderNo)">完成订单</span>
- </view>
- </view> -->
- <!-- </view> -->
- </mescroll-uni>
- <view class="refuse_popup" v-if="isRefuse">
- <view class="histroy">
- <view class="title">
- 请输入拒绝接单原因
- </view>
- <view class="content">
- <input type="text" maxlength="10" v-model="reasonRefusal" placeholder="请输入拒绝原因,最多10个字" />
- </view>
- <view class="btn_box">
- <view class="btn" @click="cancel">
- 取消
- </view>
- <view class="btn success" @click="refuseSubmit">
- 提交
- </view>
- </view>
- </view>
- </view>
- <view class="arrive" v-if="isArrive">
- <view class="photo_box">
- <view class="title">
- 到达地点
- </view>
- <view class="photo">
- <view class="small_title">
- 请拍摄到达地点主要建筑物
- </view>
- <view class="upload_box">
- <u-upload class="upload_popup" :action="uploadUrl" capture="camera" :file-list="arrivalPhoto"
- @on-success="photograph" @on-remove="remove" :header="header" :max-count="1" accept="image/*" :show-upload-list="false"/>
- </view>
- </view>
- <view class="btn_box">
- <view class="cancel" @click="isArrive = false">
- 取 消
- </view>
- <view class="btn" @click="arrive">
- 提 交
- </view>
- </view>
- </view>
- </view>
- <view class="arrive" v-if="isSchedule">
- <view class="photo_box">
- <view class="title">
- 结束原因
- </view>
- <view class="photo">
- <view class="small_title">
- 提前结束,请填写原因
- </view>
- <!-- <input type="text" placeholder="请输入提前结束原因" v-model="timeoutCause" /> -->
- <view class="textarea">
- <textarea placeholder="请输入提前结束原因" type="textarea" v-model="timeoutCause"
- style="width: 100%;height: 100%;font-size: 26rpx;" id="" cols="30" rows="10"></textarea>
- </view>
- </view>
- <view class="btn_box">
- <view class=" cancel" @click="isSchedule = false">
- 取 消
- </view>
- <view class="btn" @click="reasonSubmit">
- 提 交
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import {
- statusList,
- orderDeatails,
- getInfo,
- engineDetail,
- confirmOrder,
- takeOrder,
- arriveOderLocation,
- enterService,
- refuse,
- depart,
- imgUpload,
- reach,
- confirm
- } from '../../api/index.js'
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- isRefuse: false,
- reasonRefusal: '',
- refusecId: '',
- status: [],
- checkedIndex: 0,
- list: [],
- nStatus: 0,
- money: 0,
- dTotalMoney: 0,
- jsId: '',
- isArrive: false,
- arrivePhoto: '',
- fileList: [],
- // uploadUrl: 'https://test.baoxianzhanggui.com/nightFragrance/common/upload',
- uploadUrl:'https://city.baoxianzhanggui.com/nightFragrance/common/upload',
- arrivalPhoto: [],
- form: {},
- isSchedule: false,
- timeoutCause: '',
- cId: '',
- orderNo: ''
- }
- },
- methods: {
- refuse(cId) {
- this.isRefuse = true
- this.refusecId = cId
- },
- refuseSubmit() {
- var data = {
- cId: this.refusecId,
- reasonRefusal: this.reasonRefusal.trim()
- }
- if (data.reasonRefusal == '') {
- uni.showToast({
- title: '拒绝原因不能为空',
- icon: 'none'
- })
- return
- }
- refuse(data).then(res => {
- if (res.data.code == 200) {
- this.list = []
- uni.showToast({
- title: '已拒绝',
- icon: 'none'
- })
- // this.getList()
- this.mescroll.resetUpScroll()
- this.isRefuse = false,
- this.reasonRefusal = ''
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- })
- },
- cancel() {
- this.isRefuse = false
- this.reasonRefusal = ''
- },
- // 开始服务
- enterService(cId, orderNo) {
- var data = {
- cId: cId
- }
- enterService(data).then(res => {
- if (res.data.code == 200) {
- // this.list = []
- // this.getList()
- this.mescroll.resetUpScroll()
- uni.showToast({
- title: '服务中',
- })
- this.$router.go(0)
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- })
- },
- //出发
- depart(cId, orderNo) {
- console.log('+++++++')
- let that = this
- uni.getLocation({
- type: 'wgs84',
- isHighAccuracy: true,
- accuracy: 'best',
- success: (res) => {
- let data = {
- cId: cId,
- departLatitude: res.latitude,
- departLongitude: res.longitude
- }
- depart(data).then(res => {
- if (res.data.code == 200) {
- uni.showToast({
- title: '已出发',
- })
- that.$router.go(0)
- } else {
- uni.showToast({
- title: res.data.msg,
- })
- that.$router.go(0)
- }
- })
- },
- fail: (res) => {}
- });
- },
- // 到达
- arriveOderLocation(cId, orderNo) {
- this.isArrive = true
- this.form.cId = cId
- this.form.orderNo = orderNo
- let that = this
- uni.getLocation({
- type: 'wgs84',
- isHighAccuracy: true,
- accuracy: 'best',
- success: (res) => {
- that.form.arrivalLatitude = res.latitude
- that.form.arrivalLongitude = res.longitude
- },
- fail: (res) => {}
- });
- },
- //上传到达图片
- photograph(response) {
- this.form.arrivalPhoto = response.fileName
- },
- remove(index) {
- this.arrivalPhoto.splice(index, 1);
- },
- //提交到达拍照
- arrive() {
- if (!this.form.arrivalPhoto) {
- uni.showToast({
- title: '请上传到达照片',
- icon: 'none'
- })
- return
- } else {
- reach(this.form).then(res => {
- this.isArrive = false
- if (res.data.code == 200) {
- uni.showToast({
- title: '已到达',
- icon: 'none'
- })
- // this.getList()
- // this.mescroll.resetUpScroll()
- this.$router.go(0)
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- })
- }
- },
- //接单
- scheduling(cId) {
- var data = {
- cId: cId
- }
- takeOrder(data).then(res => {
- if (res.data.code == 200) {
- // this.list = []
- uni.showToast({
- title: '已接单',
- })
- // this.getList()
- this.$router.go(0)
- } else {
- uni.showToast({
- title: res.data.msg,
- icon: 'none'
- })
- }
- })
- },
- //完成订单
- complete(item, cId, orderNo) {
- this.cId = cId
- this.orderNo = orderNo
- const now = new Date(+new Date() + 8 * 3600 * 1000);
- const isoDateTime = now.toISOString(); // ISO 8601 格式
- let nowtime = new Date(isoDateTime.slice(0, 19))
- let starttime = new Date(item.startTime) //开始时间
- let differenceInMs = nowtime - starttime //剩余时间
- let differenceInMinutes = differenceInMs / (1000 * 60);
- if (differenceInMinutes > item.cGoods[0].nMinute) {
- var id = {
- cId: cId,
- orderNo: orderNo
- }
- let that = this
- uni.showModal({
- title: '提示',
- content: '确认服务完成?',
- success: function(res) {
- if (res.confirm) {
- confirmOrder(id).then(res => {
- if (res.data.code == 200) {
- // this.list =[]
- uni.showToast({
- title: '已完成',
- })
- // location.reload(true);
- that.$router.go(0)
- // this.getList()
- } else {
- uni.showToast({
- title: res.data.msg,
- })
- // location.reload(true);
- // that.$router.go(0)
- }
- })
- }
- }
- });
- } else {
- this.isSchedule = true
- }
- },
- //填写提前结束原因
- reasonSubmit() {
- let data = {}
- data.cId = this.cId
- data.orderNo = this.orderNo
- data.timeoutCause = this.timeoutCause
- if (data.timeoutCause == '') {
- uni.showToast({
- icon: 'none',
- title: '请填写提前完成原因',
- })
- return
- } else {
- confirm(data).then(res => {
- if (res.data.code == 200) {
- uni.showToast({
- title: '已完成',
- })
- location.reload(true);
- } else {
- uni.showToast({
- title: res.data.msg,
- })
- }
- })
- }
- },
- getList(page) {
- var openid = {
- cJsId: this.jsId,
- nStatus: this.nStatus,
- current: page.num,
- size: page.size,
- }
- orderDeatails(openid).then(res => {
- var charToRemove = "T";
- res.data.data.records.forEach(element => {
- element.dtCreateTime = element.dtCreateTime.replace(charToRemove, ' ')
- });
- this.mescroll.endSuccess(res.data.data.records.length);
- this.list = this.list.concat(res.data.data.records)
- })
- },
- statusTap(code, index) {
- this.checkedIndex = index,
- this.list = []
- this.nStatus = code
- // this.getList()
- this.mescroll.resetUpScroll()
- },
- getStatus() {
- statusList().then(res => {
- this.status = res.data.data,
- this.nStatus = ''
- })
- },
- goDetails(cId) {
- uni.navigateTo({
- // url: '../../order/detail/detail?name=商户订单&cid=' + e.currentTarget.dataset.id,
- url: '../order/order_detail?name=商户订单&cid=' + cId
- })
- },
- getInfo() {
- getInfo().then(res => {
- this.money = res.data.data.dBalance
- })
- },
- // 商户详情
- getDetails() {
- var that = this
- var openid = {
- cOpenId: uni.getStorageSync('wx_copenid')
- }
- engineDetail(openid).then(res => {
- this.jsId = res.data.data.id
- this.getStatus();
- })
- },
- },
- mounted() {
- // 在页面加载时获取Token,可以从本地缓存中获取
- this.token = uni.getStorageSync('access-token'); // 假设token保存在本地缓存中
- this.mescroll.optDown.use = false
- },
- computed: {
- header() {
- return {
- Authorization: `tf: ${this.token}`, // 携带Token的请求头
- };
- },
- },
- onLoad() {
- this.checkedIndex = 0
- this.getInfo()
- this.getDetails()
- this.mescroll.resetUpScroll()
- }
- }
- </script>
- <style lang="scss" scoped>
- /* pages/order/order.wxss */
- .order {
- background-color: rgb(248, 248, 248);
- width: 100vw;
- height: 100vh;
- display: flex;
- flex-direction: column;
- position: fixed;
- .arrive {
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.5);
- position: fixed;
- top: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- .photo_box {
- width: 630rpx;
- // height: 652rpx;
- background-color: #fff;
- // padding: 50rpx;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- border-radius: 24rpx;
- overflow: hidden;
- .title {
- width: 100%;
- height: 92rpx;
- background: #E6F8F7;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .photo {
- width: 100%;
- flex: 1;
- overflow: hidden;
- padding: 40rpx 32rpx;
- box-sizing: border-box;
- .small_title {
- width: 100%;
- font-size: 28rpx;
- text-align: center;
- }
- .textarea {
- width: 566rpx;
- height: 292rpx;
- background: #F8F8F8;
- border-radius: 16rpx;
- padding: 20rpx 24rpx;
- box-sizing: border-box;
- margin-top: 32rpx;
- font-size: 26rpx;
- }
- .upload_box {
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-top: 32rpx;
- // margin-bottom: 40rpx;
- }
- }
- .btn_box {
- width: 100%;
- height: 116rpx;
- background: #FFFFFF;
- display: flex;
- align-items: center;
- justify-content: space-around;
- border-top: 2rpx solid #EEEEEE;
- .btn {
- width: 225rpx;
- height: 68rpx;
- // height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- background: linear-gradient(90deg, #1AD7CE 0%, #21C9C1 100%);
- border-radius: 44rpx;
- color: #fff;
- }
- .cancel {
- width: 225rpx;
- height: 68rpx;
- border-radius: 106rpx;
- border: 2rpx solid #BBBBBB;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- }
- }
- }
- .refuse_popup {
- width: 100%;
- height: 100%;
- position: fixed;
- top: 0;
- left: 0;
- background-color: rgba(0, 0, 0, 0.5);
- display: flex;
- justify-content: center;
- .histroy {
- width: 70%;
- height: 160px;
- margin-top: 500rpx;
- background-color: #fff;
- border-radius: 10px;
- padding: 20px;
- box-sizing: border-box;
- .title {
- width: 100%;
- // padding: 10px ;
- text-align: center;
- box-sizing: border-box;
- margin-bottom: 50rpx;
- }
- .content {
- margin-bottom: 20px;
- input {
- display: block;
- border-bottom: 1px solid #ccc;
- }
- }
- .btn_box {
- width: 100%;
- display: flex;
- justify-content: space-around;
- .btn {
- width: 30%;
- height: 30px;
- background-color: #c8c9cc;
- text-align: center;
- line-height: 30px;
- border-radius: 5px;
- }
- .success {
- background: linear-gradient(to right, #35c99d, #27aea7);
- color: #fff;
- }
- }
- }
- }
- .orderStatus {
- width: 100%;
- height: 90rpx;
- display: flex;
- justify-content: space-around;
- align-items: center;
- font-size: 30rpx;
- // padding: 20rpx 0;
- box-sizing: border-box;
- z-index: 999;
- background: radial-gradient(circle, #fcfdff, #fcfdff);
- view {
- padding: 0px 10rpx;
- background-color: #fff;
- box-sizing: border-box;
- padding-bottom: 12rpx;
- // border-radius: 8rpx;
- }
- .active {
- font-size: 30rpx;
- color: #03C8BE;
- font-weight: 400;
- // background-color: #2cb7d4;
- border-bottom: 1px solid #03C8BE;
- }
- }
- .list {
- flex: 1;
- overflow-y: auto;
- background: linear-gradient(180deg, #C1FFF8 0%, #B8FFF3 34%, #F5FFFF 100%);
- padding: 32rpx;
- box-sizing: border-box;
- .item {
- // margin: 0 20rpx;
- width: 100%;
- // height: 292rpx;
- padding: 24rpx 32rpx;
- margin-bottom: 10rpx;
- font-size: 28rpx;
- margin-bottom: 28rpx;
- box-sizing: border-box;
- background: #FFFFFF;
- box-shadow: 0px 4px 12px 0px rgba(88, 209, 187, 0.1);
- border-radius: 24px 24px 24px 24px;
- .lTitle {
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid #eeeeee;
- margin-bottom: 10rpx;
- padding-bottom: 20rpx;
- font-size: 28rpx;
- .status {
- color: #03C8BE;
- }
- }
- .cont {
- color: rgb(162, 162, 162);
- font-size: 26rpx;
- // display: flex;
- // justify-content: space-between;
- line-height: 45rpx;
- }
- .btn {
- height: 48rpx;
- // text-align: right;
- // padding-top: 20rpx;
- margin-top: 20rpx;
- // margin-bottom: 24rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .count_down {
- // width: 41%;
- // text-align: left;
- font-size: 26rpx;
- color: #F53E54;
- span {
- font-size: 20rpx;
- }
- }
- .button {
- display: flex;
- align-items: center;
- .pay {
- display: inline-block;
- background-color: rgb(46, 188, 215);
- color: #fff;
- margin-left: 20rpx;
- padding: 5rpx 30rpx;
- height: 48rpx;
- line-height: 48rpx;
- background: linear-gradient(135deg, #1AD8CF 0%, #21C8C0 100%);
- border-radius: 98rpx 98rpx 98rpx 98rpx;
- }
- .refuse {
- // width: 152rpx;
- display: inline-block;
- padding: 5rpx 30rpx;
- height: 48rpx;
- height: 48rpx;
- border-radius: 98rpx;
- background: linear-gradient(135deg, #FD8997 0%, #ED5769 100%);
- color: #fff;
- }
- }
- }
- }
- }
- .nodate {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 200rpx 0;
- text-align: center;
- image {
- width: 300rpx;
- margin-bottom: 30rpx;
- }
- }
- </style>
|