初始化代码
This commit is contained in:
324
uniapp/uni-app/farmer/pages/apply.vue
Normal file
324
uniapp/uni-app/farmer/pages/apply.vue
Normal file
@@ -0,0 +1,324 @@
|
||||
<template>
|
||||
<view class="apply-pages" v-if="isLoad">
|
||||
<view class="fill-base mt-md">
|
||||
<view class="flex-y-center pt-lg pl-lg">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">农场头像</view>
|
||||
</view>
|
||||
<view class="flex-between ml-lg mr-lg pb-sm b-1px-b">
|
||||
<upload @upload="imgUpload" :imagelist="subForm.cover" imgtype="cover" text="添加封面" :imgsize="1">
|
||||
</upload>
|
||||
</view>
|
||||
<view class="flex-between ml-lg mr-lg">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">农场名称</view>
|
||||
</view>
|
||||
<input v-model="subForm.title" type="text" class="item-input flex-1" maxlength="40"
|
||||
placeholder-class="c-placeholder" :placeholder="rule[1].errorMsg" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="fill-base mt-md">
|
||||
<view class="ml-lg mr-lg b-1px-b">
|
||||
<view class="flex-y-center pt-lg pb-md">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">农场描述</view>
|
||||
</view>
|
||||
<textarea v-model="subForm.desc" type="text" class="item-textarea flex-1" maxlength="200"
|
||||
placeholder-class="c-placeholder" :placeholder="rule[2].errorMsg"></textarea>
|
||||
</view>
|
||||
<view class="flex-y-center pt-lg pl-lg">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">农场详情图</view>
|
||||
</view>
|
||||
<view class="flex-between ml-lg mr-lg pb-lg">
|
||||
<upload @upload="imgUpload" @del="imgUpload" :imagelist="subForm.imgs" imgtype="imgs" text="添加图片"
|
||||
:imgsize="9">
|
||||
</upload>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fill-base mt-md">
|
||||
<view class="flex-between ml-lg mr-lg b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">联系电话</view>
|
||||
</view>
|
||||
<input v-model="subForm.mobile" type="text" class="item-input flex-1" placeholder-class="c-placeholder"
|
||||
:placeholder="rule[4].errorMsg" />
|
||||
</view>
|
||||
<view class="flex-between ml-lg mr-lg b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">农场地址</view>
|
||||
</view>
|
||||
<view class="item-input text flex-1">
|
||||
<view @tap.stop="toChooseLocation" class="flex-y-center">
|
||||
<view class="flex-1" style="line-height: 1.2;"
|
||||
:class="[{'c-placeholder':!subForm.address},{'c-title':subForm.address}]">
|
||||
{{subForm.address || `点击右边图标设置`}}
|
||||
</view><i class="iconfont icon-dingwei ml-sm" :style="{color:primaryColor}"></i>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between ml-lg mr-lg b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">姓名</view>
|
||||
</view>
|
||||
<input v-model="subForm.user_name" type="text" class="item-input flex-1" maxlength="20"
|
||||
placeholder-class="c-placeholder" :placeholder="rule[6].errorMsg" />
|
||||
</view>
|
||||
<view class="flex-between ml-lg mr-lg b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">手机号</view>
|
||||
</view>
|
||||
<input v-model="subForm.phone" type="text" class="item-input flex-1" placeholder-class="c-placeholder"
|
||||
:placeholder="rule[7].errorMsg" />
|
||||
</view>
|
||||
<view class="flex-between ml-lg mr-lg">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">身份证号</view>
|
||||
</view>
|
||||
<input v-model="subForm.idcard_code" type="text" class="item-input flex-1"
|
||||
placeholder-class="c-placeholder" :placeholder="rule[8].errorMsg" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="fill-base mt-md">
|
||||
<view class="flex-y-center pt-lg pl-lg">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text" style="width: 400rpx;">身份证正反面照片</view>
|
||||
</view>
|
||||
<view class="flex-between" style="width: 626rpx;margin: 0 auto;">
|
||||
<upload @upload="imgUpload" :imagelist="subForm.idcard_imgs" imgtype="idcard_imgs" imgclass="md"
|
||||
text="身份证正面照" :imgsize="1" bgimg="/static/image/farm/idcard.png"></upload>
|
||||
<upload @upload="imgUpload" :imagelist="subForm.idcard_imgs_fan" imgtype="idcard_imgs_fan" imgclass="md"
|
||||
text="身份证反面照" :imgsize="1" bgimg="/static/image/farm/idcard_fan.png"></upload>
|
||||
</view>
|
||||
<view class="flex-between pb-lg f-caption c-caption" style="width: 626rpx;margin: 0 auto;">
|
||||
<view class="flex-center" style="width: 292rpx;">身份证正面照</view>
|
||||
<view class="flex-center" style="width: 292rpx;">身份证反面照</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="space-max-footer"></view>
|
||||
|
||||
<auth :needAuth="userInfo && !userInfo.nickname" :must="true" @go="submit">
|
||||
<fix-bottom-button :text="[{text:options.type==1?'保存':'提交申请',type:'confirm'}]" bgColor="#fff">
|
||||
</fix-bottom-button>
|
||||
</auth>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
options: {},
|
||||
subForm: {
|
||||
id: 0,
|
||||
cover: [], // 农场头像
|
||||
title: '', //农场名称
|
||||
desc: '', // 简介
|
||||
imgs: [], // 详情
|
||||
mobile: '', //联系电话
|
||||
address: '', //农场地址
|
||||
lng: '',
|
||||
lat: '',
|
||||
user_name: '', //用户名称
|
||||
phone: '', //手机号
|
||||
idcard_code: '', //身份证号
|
||||
idcard_imgs: [], //身份证
|
||||
idcard_imgs_fan: []
|
||||
},
|
||||
rule: [{
|
||||
name: "cover",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请上传农场头像"
|
||||
}, {
|
||||
name: "title",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请输入您所拥有的农场名称",
|
||||
regType: 2
|
||||
}, {
|
||||
name: "desc",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请输入农场描述",
|
||||
regType: 2
|
||||
}, {
|
||||
name: "imgs",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请上传农场详情图"
|
||||
},
|
||||
{
|
||||
name: "mobile",
|
||||
checkType: "isAllPhone",
|
||||
errorMsg: "请输入农场联系电话",
|
||||
regText: "联系电话"
|
||||
}, {
|
||||
name: "address",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请设置农场地址"
|
||||
}, {
|
||||
name: "user_name",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请输入您的姓名",
|
||||
regType: 2
|
||||
},
|
||||
{
|
||||
name: "phone",
|
||||
checkType: "isMobile",
|
||||
errorMsg: "请输入您的手机号"
|
||||
}, {
|
||||
name: "idcard_code",
|
||||
checkType: "isIdCard",
|
||||
errorMsg: "请输入您的身份证号码"
|
||||
},
|
||||
{
|
||||
name: "idcard_imgs",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请上传身份证正面照"
|
||||
},
|
||||
{
|
||||
name: "idcard_imgs_fan",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请上传身份证反面照"
|
||||
}
|
||||
],
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
}),
|
||||
async onLoad(options) {
|
||||
let {
|
||||
type = 0
|
||||
} = options
|
||||
this.options = options
|
||||
uni.setNavigationBarTitle({
|
||||
title: type == 1 ? `农场管理` : `申请农场主`
|
||||
})
|
||||
await this.initIndex()
|
||||
this.isLoad = true
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getUserInfo']),
|
||||
...mapMutations(['updateUserItem']),
|
||||
async initIndex() {
|
||||
let data = await this.$api.farmer.farmerInfo()
|
||||
if (!data.id) return
|
||||
data.cover = [{
|
||||
path: data.cover
|
||||
}]
|
||||
let arr = ['imgs', 'idcard_imgs']
|
||||
arr.map(item => {
|
||||
data[item] = data[item].map(aitem => {
|
||||
return {
|
||||
path: aitem
|
||||
}
|
||||
})
|
||||
})
|
||||
data.idcard_imgs_fan = [data.idcard_imgs[1]]
|
||||
data.idcard_imgs.splice(1, 2)
|
||||
for (let key in this.subForm) {
|
||||
this.subForm[key] = data[key]
|
||||
}
|
||||
},
|
||||
imgUpload(e) {
|
||||
let {
|
||||
imagelist,
|
||||
imgtype
|
||||
} = e;
|
||||
this.subForm[imgtype] = imagelist;
|
||||
},
|
||||
// 选择地区
|
||||
async toChooseLocation(e) {
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
let [, {
|
||||
address = '',
|
||||
longitude,
|
||||
latitude
|
||||
} = {}] = await uni.chooseLocation();
|
||||
if (!address) return
|
||||
this.subForm.address = address
|
||||
this.subForm.lng = longitude
|
||||
this.subForm.lat = latitude
|
||||
},
|
||||
//表单验证
|
||||
validate(param) {
|
||||
let validate = new this.$util.Validate();
|
||||
this.rule.map(item => {
|
||||
let {
|
||||
name,
|
||||
} = item
|
||||
validate.add(param[name], item);
|
||||
})
|
||||
let message = validate.start();
|
||||
console.log(message, "message");
|
||||
return message;
|
||||
},
|
||||
async submit() {
|
||||
let param = this.$util.deepCopy(this.subForm)
|
||||
let arr = ['cover', 'idcard_imgs', 'idcard_imgs_fan']
|
||||
arr.map(item => {
|
||||
param[item] = param[item].length > 0 ? param[item][0].path : ''
|
||||
})
|
||||
let msg = this.validate(param);
|
||||
if (msg) {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
})
|
||||
return
|
||||
}
|
||||
param.imgs = param.imgs.map(item => {
|
||||
return item.path
|
||||
})
|
||||
param.idcard_imgs = [param.idcard_imgs, param.idcard_imgs_fan]
|
||||
delete param.idcard_imgs_fan
|
||||
if (this.lockTap) return
|
||||
this.lockTap = true
|
||||
this.$util.showLoading()
|
||||
let {
|
||||
type = 0
|
||||
} = this.options
|
||||
let methodModel = type == 1 ? 'farmerUpdate' : 'applyFarmer'
|
||||
try {
|
||||
await this.$api.farmer[methodModel](param)
|
||||
this.$util.hideAll()
|
||||
this.$util.showToast({
|
||||
title: type == 1 ? `修改成功` : `提交成功`
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.back()
|
||||
this.$util.goUrl({
|
||||
url: 1,
|
||||
openType: `navigateBack`
|
||||
})
|
||||
}, 1000)
|
||||
} catch (e) {
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
this.$util.hideAll()
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
160
uniapp/uni-app/farmer/pages/finance/index.vue
Normal file
160
uniapp/uni-app/farmer/pages/finance/index.vue
Normal file
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<view class="farmer-finance-index rel" v-if="isLoad">
|
||||
<view class="count-info flex-center flex-column c-base" :style="{background:primaryColor}">
|
||||
<view class="f-caption">可提余额(元)</view>
|
||||
<view class="price mt-sm">{{detail.cash}}</view>
|
||||
<view class="flex-center btn-list f-paragraph mt-lg pt-lg">
|
||||
<view @tap.stop="$util.goUrl({url:`/mine/pages/cash-out?type=farmer`})"
|
||||
class="item-child flex-center fill-base c-title mr-lg radius">提现</view>
|
||||
<view @tap.stop="$util.goUrl({url:`/farmer/pages/finance/record`})"
|
||||
class="item-child flex-center c-base radius">交易记录</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="money-count fill-base flex-center pt-lg pb-lg">
|
||||
<view class="item-child flex-center flex-column b-1px-r">
|
||||
<view class="flex-y-baseline f-lg-title">{{detail.total_cash}}</view>
|
||||
<view class="f-caption c-caption">总金额(元)</view>
|
||||
</view>
|
||||
<view class="item-child flex-center flex-column">
|
||||
<view class="flex-y-baseline f-lg-title">{{detail.frozen_cash}}</view>
|
||||
<view class="f-caption c-caption">实际冻结金额(元)</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-md"></view>
|
||||
<view class="fill-base pd-lg b-1px-b" v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between">
|
||||
<view class="max-446 ellipsis">{{item.order_code}}</view>
|
||||
<view class="f-title text-bold" :style="{color:index==0 ? primaryColor : '#FF5537'}">
|
||||
{{item.add==1?'+':'-'}} {{item.price}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between f-caption c-desc mt-sm">
|
||||
<view class="c-caption">{{item.create_time_text}}</view>
|
||||
<view>{{item.type_text}}</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>
|
||||
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
import tabbar from "@/components/tabbar.vue"
|
||||
export default {
|
||||
components: {
|
||||
tabbar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
detail: {},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
commonOptions: state => state.user.commonOptions,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad() {
|
||||
this.$util.setNavigationBarColor({
|
||||
color: '#ffffff',
|
||||
bg: '#39b54a'
|
||||
});
|
||||
this.$util.showLoading()
|
||||
this.initIndex()
|
||||
},
|
||||
onUnload() {
|
||||
this.$util.back()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
methods: {
|
||||
...mapMutations([]),
|
||||
async initIndex() {
|
||||
this.detail = await this.$api.farmer.farmerFinanceInfo()
|
||||
this.isLoad = true
|
||||
this.getList()
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param
|
||||
} = this
|
||||
let newList = await this.$api.farmer.farmerFinanceList(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()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
// this.$util.showLoading()
|
||||
// this.param.page = 1
|
||||
// this.list.data = []
|
||||
// this.getList()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.farmer-finance-index {
|
||||
|
||||
.count-info {
|
||||
height: 450rpx;
|
||||
|
||||
.price {
|
||||
font-size: 70rpx;
|
||||
}
|
||||
|
||||
.btn-list {
|
||||
.item-child {
|
||||
width: 240rpx;
|
||||
height: 64rpx;
|
||||
border: 1rpx solid #fff;
|
||||
transform: rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.money-count {
|
||||
.item-child {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
278
uniapp/uni-app/farmer/pages/finance/record.vue
Normal file
278
uniapp/uni-app/farmer/pages/finance/record.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<template>
|
||||
<view class="mine-stored-record">
|
||||
<fixed>
|
||||
<view class="fill-base b-1px-b">
|
||||
<view class="pl-lg pr-lg">
|
||||
<view class="space-lg"></view>
|
||||
<uni-segmented-control :current="typeInd" :values="typeList"
|
||||
@clickItem="handerTabChange($event,'typeInd')" style-type="button" :active-color="primaryColor">
|
||||
</uni-segmented-control>
|
||||
</view>
|
||||
<tab @change="handerTabChange($event,'activeIndex')" :list="tabList"
|
||||
:lockTap="activeIndex==2&&tabList[2].start_time&&tabList[2].end_time ? false : true"
|
||||
:activeIndex="activeIndex" :activeColor="primaryColor" :width="100/tabList.length + '%'"
|
||||
height="100rpx"></tab>
|
||||
</view>
|
||||
</fixed>
|
||||
|
||||
<view class="fill-base pd-lg b-1px-b" v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between">
|
||||
<view class="max-446 ellipsis">{{item.type_text}}</view>
|
||||
<view class="text-bold" :style="{color:primaryColor}">{{item.add==1?'+':'-'}} {{item.price}}</view>
|
||||
</view>
|
||||
<view class="flex-between f-caption c-caption mt-sm">{{item.create_time_text}}</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>
|
||||
|
||||
<view class="space-footer"></view>
|
||||
|
||||
<uni-popup ref="show_choose_time" type="top" :custom="true" :maskClick="false">
|
||||
<view style="height: 184rpx;"></view>
|
||||
<view class="popup-choose-time fill-base f-paragraph c-desc pt-lg pb-lg radius-bottom-34">
|
||||
<view class="time-item flex-center pt-lg">
|
||||
<view @tap.stop="toShowTime('start_time')" class="item-child flex-center flex-column">
|
||||
<view>开始时间</view>
|
||||
<view class="mt-sm" :style="{color:tabList[2].start_time ? primaryColor : '#999'}">
|
||||
{{tabList[2].start_time || '选择时间'}}
|
||||
</view>
|
||||
</view>
|
||||
<view @tap.stop="toShowTime('end_time')" class="item-child flex-center flex-column b-1px-l">
|
||||
<view>结束时间</view>
|
||||
<view class="mt-sm" :style="{color:tabList[2].end_time ? primaryColor : '#999'}">
|
||||
{{tabList[2].end_time || '选择时间'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="button-item flex-center">
|
||||
<view @tap.stop="toConfirm(1)" class="item-child disabled flex-center"> 取消 </view>
|
||||
<view @tap.stop="toConfirm(2)" class="item-child flex-center"
|
||||
:style="{background: primaryColor,color:'#fff'}"> 确定
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<w-picker mode="date" :startYear="startYear" :endYear="endYear" :value="tabList[0].end_time" :current="false"
|
||||
fields="day" @confirm="onConfirm($event)" :disabled-after="false" ref="day" :themeColor="primaryColor"
|
||||
:visible.sync="showDate">
|
||||
</w-picker>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
import uniSegmentedControl from "@/components/uni-segmented-control.vue"
|
||||
import wPicker from "@/components/w-picker/w-picker.vue";
|
||||
export default {
|
||||
components: {
|
||||
uniSegmentedControl,
|
||||
wPicker
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
startYear: '',
|
||||
endYear: '',
|
||||
showKey: '',
|
||||
showDate: false,
|
||||
typeList: [{
|
||||
id: 1,
|
||||
title: '收入记录'
|
||||
}, {
|
||||
id: 0,
|
||||
title: '支出记录'
|
||||
}],
|
||||
typeInd: 0,
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 1,
|
||||
title: '本周',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
}, {
|
||||
id: 2,
|
||||
title: '本月',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
}, {
|
||||
id: 3,
|
||||
title: '自定义',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
}],
|
||||
preTime: {
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
}),
|
||||
onLoad() {
|
||||
this.$util.showLoading()
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
let cur_time = new Date(Math.ceil(new Date().getTime()))
|
||||
const currentDate = new Date()
|
||||
//返回date是一周中的某一天
|
||||
const week = currentDate.getDay()
|
||||
//一天的毫秒数
|
||||
const millisecond = 1000 * 60 * 60 * 24
|
||||
//减去的天数
|
||||
const minusDay = week != 0 ? week - 1 : 6
|
||||
//本周 周一
|
||||
const monday = new Date(currentDate.getTime() - minusDay * millisecond)
|
||||
//本周 周日
|
||||
const sunday = new Date(monday.getTime() + 6 * millisecond)
|
||||
|
||||
this.tabList[0].start_time = this.$util.formatTime(monday, 'YY-M-D')
|
||||
this.tabList[0].end_time = this.$util.formatTime(sunday, 'YY-M-D')
|
||||
this.tabList[1].start_time = this.$util.formatTime(cur_time, 'YY-M') + '-01'
|
||||
this.tabList[1].end_time = this.$util.formatTime(cur_time, 'YY-M-D')
|
||||
let year = this.$util.formatTime(cur_time, 'YY') * 1
|
||||
this.startYear = year - 5
|
||||
this.endYear = year
|
||||
this.param.page = 1
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
activeIndex,
|
||||
tabList,
|
||||
typeList,
|
||||
typeInd
|
||||
} = this
|
||||
let {
|
||||
start_time,
|
||||
end_time
|
||||
} = tabList[activeIndex]
|
||||
let param = this.$util.deepCopy(this.param)
|
||||
param.add = typeList[typeInd].id
|
||||
param.start_time = this.$util.DateToUnix(start_time)
|
||||
param.end_time = this.$util.DateToUnix(end_time) + 24 * 3600 - 1
|
||||
let newList = await this.$api.farmer.farmerFinanceList(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()
|
||||
},
|
||||
handerTabChange(index, key, ind = 2) {
|
||||
this[key] = index;
|
||||
if (key == 'activeIndex') {
|
||||
let methodModel = index == ind ? 'open' : 'close'
|
||||
this.$refs.show_choose_time[methodModel]()
|
||||
if (index == ind) return
|
||||
} else {
|
||||
this.$refs.show_choose_time.close()
|
||||
}
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
toShowTime(key, ind = 2) {
|
||||
if (key == 'end_time' && !this.tabList[ind].start_time) {
|
||||
this.$util.showToast({
|
||||
title: `请选择开始时间`
|
||||
})
|
||||
return
|
||||
}
|
||||
this.showKey = key
|
||||
this.showDate = true
|
||||
},
|
||||
async onConfirm(val, ind = 2) {
|
||||
let {
|
||||
start_time,
|
||||
end_time
|
||||
} = this.tabList[ind]
|
||||
let {
|
||||
showKey
|
||||
} = this
|
||||
if ((end_time && showKey == 'start_time' && this.$util.DateToUnix(end_time) < this.$util.DateToUnix(val
|
||||
.result)) || (
|
||||
showKey == 'end_time' && this.$util.DateToUnix(start_time) > this.$util.DateToUnix(val.result)
|
||||
)) {
|
||||
this.$util.showToast({
|
||||
title: `结束时间不能小于开始时间`
|
||||
})
|
||||
return
|
||||
}
|
||||
this.tabList[ind][showKey] = val.result;
|
||||
if (showKey == 'end_time') {
|
||||
this.showDate = false
|
||||
}
|
||||
},
|
||||
toConfirm(type, ind = 2) {
|
||||
let {
|
||||
start_time = '',
|
||||
end_time = ''
|
||||
} = type == 1 ? this.preTime : this.tabList[ind]
|
||||
if (type == 1) {
|
||||
this.tabList[ind].start_time = start_time
|
||||
this.tabList[ind].end_time = end_time
|
||||
} else {
|
||||
if (!start_time || !end_time) {
|
||||
this.$util.showToast({
|
||||
title: !start_time ? `请选择开始时间` : `请选择结束时间`
|
||||
})
|
||||
return
|
||||
}
|
||||
this.preTime.start_time = start_time
|
||||
this.preTime.end_time = end_time
|
||||
}
|
||||
this.activeIndex = start_time && end_time ? ind : 0
|
||||
this.$refs.show_choose_time.close()
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
178
uniapp/uni-app/farmer/pages/order/claim/list.vue
Normal file
178
uniapp/uni-app/farmer/pages/order/claim/list.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<view class="farmer-order-claim-list">
|
||||
<fixed>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex" :activeColor="primaryColor"
|
||||
:width="100/tabList.length + '%'" height="100rpx"></tab>
|
||||
<view class="b-1px-b"></view>
|
||||
</fixed>
|
||||
<view @tap.stop="goDetail(index)" class="order-item fill-base mg-big pd-lg radius-16 box-shadow"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between pb-lg">
|
||||
<view class="f-paragraph c-title"
|
||||
:style="{color:item.pay_type == 1? subColor: item.pay_type == 2? primaryColor: ''}">
|
||||
{{statusType[item.pay_type]}}
|
||||
</view>
|
||||
<i class="iconfont icon-right"></i>
|
||||
</view>
|
||||
<view class="flex-center">
|
||||
<image mode="aspectFill" lazy-load class="avatar radius-24" :src="item.goods_cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-title c-title text-bold ellipsis" style="max-width: 498rpx;"> {{item.goods_name}}
|
||||
</view>
|
||||
<view class="f-caption c-caption mt-sm"> 数量:{{`${item.num}/${item.unit}`}} </view>
|
||||
<view class="f-caption c-caption"> 配送周期:{{item.send_cycle}} </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between f-paragraph mt-md pt-md b-1px-t">
|
||||
<view class="c-desc max-380 ellipsis">认养编号 {{item.claim_code}}</view>
|
||||
<view class="flex-y-baseline c-title">总计:<view class="f-title c-warning">¥{{item.pay_price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between mt-md">
|
||||
<view></view>
|
||||
<view @tap.stop="toTel(index)" class="common-btn flex-center f-caption c-base radius-4 ml-lg"
|
||||
:style="{background:primaryColor}">
|
||||
联系买家
|
||||
</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>
|
||||
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 0,
|
||||
title: '全部'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '认养中',
|
||||
number: 0
|
||||
}, {
|
||||
id: 3,
|
||||
title: '配送中',
|
||||
number: 0
|
||||
}, {
|
||||
id: 7,
|
||||
title: '已完成'
|
||||
}],
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
1: '待支付',
|
||||
2: '认养中',
|
||||
3: '配送中',
|
||||
7: '已完成',
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
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,
|
||||
} = options
|
||||
this.options = options
|
||||
this.activeIndex = tab
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
tabList,
|
||||
activeIndex
|
||||
} = this
|
||||
param.pay_type = tabList[activeIndex].id
|
||||
let newList = await this.$api.farmer.claimOrderList(param);
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.tabList[1].number = newList.claim_ing
|
||||
this.tabList[2].number = newList.send_ing
|
||||
this.$util.hideAll()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
toTel(index) {
|
||||
let {
|
||||
mobile: url
|
||||
} = this.list.data[index].address_info
|
||||
this.$util.goUrl({
|
||||
url,
|
||||
openType: 'call'
|
||||
})
|
||||
},
|
||||
goDetail(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/claim/pages/order/detail?id=${id}&farmer=1`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
366
uniapp/uni-app/farmer/pages/order/distribution/detail.vue
Normal file
366
uniapp/uni-app/farmer/pages/order/distribution/detail.vue
Normal file
@@ -0,0 +1,366 @@
|
||||
<template>
|
||||
<view class="farmer-order-distribution-detail" v-if="detail.id">
|
||||
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
|
||||
:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="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="f-sm-title text-bold pt-md">{{statusType[detail.pay_type]}}</view>
|
||||
<view class="f-caption">
|
||||
<block v-if="detail.pay_type == -1">已退配送费 ¥{{detail.pay_price}}</block>
|
||||
<block v-if="detail.pay_type == 2">请尽快为买家配送该商品</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-text-info ml-md mr-md pd-lg fill-base f-paragraph c-title box-shadow radius-24"
|
||||
v-if="detail.send_type == 2">
|
||||
<view @tap.stop="toMap" class="flex-warp">
|
||||
<i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx;margin-top: 6rpx;"></i>
|
||||
<view class="flex-1">{{detail.address}}</view>
|
||||
</view>
|
||||
<view @tap.stop="$util.goUrl({url:detail.mobile,openType:'call'})" class="flex-y-baseline c-caption"
|
||||
style="margin:5rpx 0 0 38rpx;">{{detail.user_name}}
|
||||
<view class="ml-lg">
|
||||
{{detail.mobile}}
|
||||
</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="flex-between pt-lg pb-lg">
|
||||
<view class="text c-desc">配送单号</view>
|
||||
<view class="flex-y-center">
|
||||
<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">
|
||||
<view class="text c-desc">{{detail.send_type == 1 ? '自提时间':'送货时间'}}</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>{{sendType[detail.send_type]}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t" v-if="detail.send_type == 1">
|
||||
<view class="text c-desc">自提人</view>
|
||||
<view class="flex-y-center">
|
||||
<view class="max-350">{{`${detail.user_name} ${detail.mobile}`}}</view>
|
||||
<view @tap="$util.goUrl( {url:`${detail.mobile}`,openType:'call'})"
|
||||
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.pay_type > 2 && detail.send_type == 2">
|
||||
<view class="text c-desc">发货时间</view>
|
||||
<view>{{detail.send_time}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t" v-if="detail.pay_type == 7">
|
||||
<view class="text c-desc">{{detail.send_type == 1 ? '取货时间':'收货时间'}}</view>
|
||||
<view>{{detail.receiving_time}}</view>
|
||||
</view>
|
||||
<view class="pt-lg pb-lg b-1px-t" v-if="detail.text">
|
||||
<view class="text c-desc">备注</view>
|
||||
<view class="mt-sm">
|
||||
<text decode="emsp" style="word-break:break-all;">{{detail.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-md ml-md mr-md pd-lg fill-base f-paragraph c-title box-shadow radius-24">
|
||||
<view class="order-item flex-center">
|
||||
<image mode="aspectFill" lazy-load class="avatar box-shadow-mini radius-24"
|
||||
:src="detail[orderText[options.type]].goods_cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-title c-title text-bold max-490 ellipsis">
|
||||
{{detail[orderText[options.type]].goods_name}}
|
||||
</view>
|
||||
<block v-if="options.type == 1">
|
||||
<view class="f-caption c-caption mt-sm">
|
||||
数量:{{`${detail[orderText[options.type]].num}/${detail[orderText[options.type]].unit}`}}
|
||||
</view>
|
||||
<view class="f-caption c-caption"> 配送周期:{{detail[orderText[options.type]].send_cycle}}
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="options.type == 2">
|
||||
<view class="f-caption c-caption mt-sm">租赁期限:{{detail[orderText[options.type]].end_time}} 到期
|
||||
</view>
|
||||
<view class="f-caption c-caption"> 租赁面积:{{detail[orderText[options.type]].area}}㎡ </view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="fill-base mt-md ml-md mr-md pl-lg pr-lg f-paragraph c-title box-shadow radius-24"
|
||||
v-if="options.type == 1">
|
||||
<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">
|
||||
<image mode="aspectFill" lazy-load classload class="seed-img radius-10"
|
||||
:src="detail.claim_order.harvest_cover"></image>
|
||||
<view class="flex-1 ml-lg f-paragraph c-title ellipsis">{{detail.claim_order.harvest_text}}</view>
|
||||
</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="options.type == 2 && detail.land_order.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.land_order.seed" :key="index">
|
||||
<image mode="aspectFill" lazy-load classload 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"
|
||||
v-if="detail.send_type == 2">
|
||||
<view class="flex-between pt-lg pb-lg">
|
||||
<view class="text">配送费</view>
|
||||
<view>¥{{detail.pay_price}}</view>
|
||||
</view>
|
||||
<view class="flex-between pt-lg pb-lg b-1px-t">
|
||||
<view class="text">实付金额</view>
|
||||
<view class="c-warning text-bold">¥{{detail.pay_price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="order-text-info mt-md ml-md mr-md pd-lg fill-base f-caption c-title box-shadow radius-24">
|
||||
<view class="flex-warp pt-sm">
|
||||
<view class="text c-caption">订单类型</view>
|
||||
<view class="flex-1">{{orderType[options.type]}}</view>
|
||||
</view>
|
||||
<block v-if="detail.send_type == 2">
|
||||
<view class="flex-warp pt-md">
|
||||
<view class="text c-caption">付款单号</view>
|
||||
<view class="flex-1 flex-y-center">{{detail.transaction_id}}
|
||||
<view @tap="$util.goUrl( {url:`${detail.transaction_id}`,openType:'copy'})"
|
||||
class="copy-btn sm flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-md" v-if="detail.pay_type == -1">
|
||||
<view class="text c-caption">退款单号</view>
|
||||
<view class="flex-1 flex-y-center">{{detail.refund_code}}
|
||||
<view @tap="$util.goUrl( {url:`${detail.refund_code}`,openType:'copy'})"
|
||||
class="copy-btn sm flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="flex-warp pt-md">
|
||||
<view class="text c-caption">下单时间</view>
|
||||
<view class="flex-1">{{detail.create_time}}</view>
|
||||
</view>
|
||||
<block v-if="detail.send_type == 2">
|
||||
<view class="flex-warp pt-md" v-if="detail.pay_time">
|
||||
<view class="text c-caption">支付时间</view>
|
||||
<view class="flex-1">{{detail.pay_time}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-md" v-if="detail.pay_type == -1">
|
||||
<view class="text c-caption">退款时间</view>
|
||||
<view class="flex-1">{{detail.refund_time}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-md">
|
||||
<view class="text c-caption">支付方式</view>
|
||||
<view class="flex-1">{{payType[detail.pay_model]}}</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<view :class="[{'space-max-footer':detail.pay_type == 2},{'space-footer':detail.pay_type != 2}]"></view>
|
||||
<block v-if="detail.pay_type == 2">
|
||||
<fix-bottom-button @confirm="toChangeOrder('confirm_get_item')" :text="[{type:'confirm',text: '确认取货'}]"
|
||||
v-if="detail.send_type == 1">
|
||||
</fix-bottom-button>
|
||||
<fix-bottom-button @confirm="toChangeOrder('confirm_send_item')" :text="[{type:'confirm',text: '立即发货'}]"
|
||||
v-if="detail.send_type == 2">
|
||||
</fix-bottom-button>
|
||||
</block>
|
||||
|
||||
<common-popup @confirm="confirmChangeOrder" ref="confirm_get_item" title="确认取货" desc="请确认是否取货,确认后将无法恢复"
|
||||
text="确认取货" :info="popupInfo">
|
||||
</common-popup>
|
||||
<common-popup @confirm="confirmChangeOrder" ref="confirm_send_item" title="立即发货" desc="请确认是否发货,确认后将无法恢复"
|
||||
text="确认发货" :info="popupInfo">
|
||||
</common-popup>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
options: {},
|
||||
detail: {},
|
||||
payType: {
|
||||
1: '微信支付',
|
||||
2: '余额支付',
|
||||
3: '支付宝支付'
|
||||
},
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
2: '待配送',
|
||||
3: '配送中',
|
||||
7: '已完成',
|
||||
},
|
||||
orderType: {
|
||||
1: '认养订单',
|
||||
2: '土地订单'
|
||||
},
|
||||
orderText: {
|
||||
1: 'claim_order',
|
||||
2: 'land_order'
|
||||
},
|
||||
sendType: {
|
||||
1: '自提',
|
||||
2: '快递'
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
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.options = options
|
||||
this.$util.showLoading()
|
||||
this.initIndex()
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getConfigInfo']),
|
||||
async initIndex() {
|
||||
let {
|
||||
id,
|
||||
type
|
||||
} = this.options
|
||||
let methodModel = type == 1 ? 'claim' : 'land'
|
||||
let data = await this.$api[methodModel].sendOrderInfo({
|
||||
id
|
||||
})
|
||||
this.detail = data
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
},
|
||||
async toMap() {
|
||||
let {
|
||||
lat,
|
||||
lng,
|
||||
address
|
||||
} = this.detail
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
await uni.getLocation({
|
||||
type: 'gcj02',
|
||||
})
|
||||
await uni.openLocation({
|
||||
latitude: lat * 1,
|
||||
longitude: lng * 1,
|
||||
name: address,
|
||||
scale: 28
|
||||
})
|
||||
},
|
||||
// 确认取货/开始配送/配送到家
|
||||
async toChangeOrder(key) {
|
||||
let {
|
||||
id,
|
||||
order_code,
|
||||
} = this.detail
|
||||
this.popupInfo = {
|
||||
id,
|
||||
name: `订单编号:${order_code}`,
|
||||
image: '',
|
||||
refs_key: key
|
||||
}
|
||||
this.$refs[key].open()
|
||||
},
|
||||
async confirmChangeOrder() {
|
||||
let {
|
||||
id,
|
||||
refs_key
|
||||
} = this.popupInfo
|
||||
if (this.lockTap) return;
|
||||
this.lockTap = true;
|
||||
this.$util.showLoading()
|
||||
let methodModel = {
|
||||
'confirm_get_item': {
|
||||
method: 'sendOrderPickup',
|
||||
msg: '取货成功'
|
||||
},
|
||||
'confirm_send_item': {
|
||||
method: 'sendOrderSend',
|
||||
msg: '发货成功'
|
||||
}
|
||||
}
|
||||
let {
|
||||
method,
|
||||
msg,
|
||||
} = methodModel[refs_key]
|
||||
try {
|
||||
await this.$api.farmer[method]({
|
||||
id
|
||||
})
|
||||
this.$util.hideAll()
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
})
|
||||
this.initRefresh()
|
||||
this.$util.back()
|
||||
this.lockTap = false
|
||||
this.$refs[refs_key].close()
|
||||
} catch (e) {
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
this.$util.hideAll()
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.farmer-order-distribution-detail {
|
||||
.order-seed-item {
|
||||
.seed-img {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
282
uniapp/uni-app/farmer/pages/order/distribution/list.vue
Normal file
282
uniapp/uni-app/farmer/pages/order/distribution/list.vue
Normal file
@@ -0,0 +1,282 @@
|
||||
<template>
|
||||
<view class="farmer-order-distribution-list">
|
||||
<fixed>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex" :activeColor="primaryColor"
|
||||
:width="100/tabList.length + '%'" height="100rpx"></tab>
|
||||
<view class="b-1px-b"></view>
|
||||
</fixed>
|
||||
<view @tap.stop="goDetail(index)"
|
||||
class="order-item fill-base mg-big pd-lg f-paragraph c-title radius-16 box-shadow"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between pb-lg b-1px-b">
|
||||
<view class="c-desc max-500 ellipsis">配送单号:{{item.order_code}}</view>
|
||||
<view :style="{color:item.pay_type == 2? subColor: item.pay_type == 3? primaryColor: ''}">
|
||||
{{statusType[item.pay_type]}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-warp mt-lg">
|
||||
<view class="text-item c-desc">订单类型</view>
|
||||
<view class="flex-1">{{orderType[item.type]}}</view>
|
||||
</view>
|
||||
<view class="flex-warp mt-md">
|
||||
<view class="text-item c-desc">{{item.send_type == 1 ? '自提时间':'送货时间'}}</view>
|
||||
<view class="flex-1">{{item.time_text}}</view>
|
||||
</view>
|
||||
<view class="flex-warp mt-md">
|
||||
<view class="text-item c-desc">配送方式</view>
|
||||
<view class="flex-1">{{sendType[item.send_type]}}</view>
|
||||
</view>
|
||||
<view class="flex-warp mt-md" v-if="item.send_type == 2">
|
||||
<view class="text-item c-desc">收货地址</view>
|
||||
<view class="flex-1">{{item.address}}</view>
|
||||
</view>
|
||||
<view class="flex-warp mt-md">
|
||||
<view class="text-item c-desc">{{item.send_type==1?'自提人':'收货人'}}</view>
|
||||
<view class="flex-1">{{`${item.user_name} ${item.mobile}`}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg" v-if="item.pay_type > 2 && item.send_type == 2">
|
||||
<view class="text-item 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-item c-desc">{{item.send_type == 1 ? '取货时间':'收货时间'}}</view>
|
||||
<view class="flex-1">{{item.receiving_time}}</view>
|
||||
</view>
|
||||
<view class="mt-md" v-if="item.text">
|
||||
<view class="text-item c-desc">备注</view>
|
||||
<view class="mt-sm">
|
||||
<text decode="emsp" style="word-break:break-all;">{{item.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="item.send_type == 2">
|
||||
<view class="flex-warp pt-lg">
|
||||
<view class="text-item c-desc">付款单号</view>
|
||||
<view class="flex-1">{{item.transaction_id}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-lg" v-if="item.pay_type == -1">
|
||||
<view class="text-item c-desc">退款单号</view>
|
||||
<view class="flex-1">{{item.refund_code}}</view>
|
||||
</view>
|
||||
<view class="flex-warp mt-md">
|
||||
<view class="text-item c-desc">配送费</view>
|
||||
<view class="flex-1 flex-y-center c-warning">
|
||||
<view>¥{{item.pay_price}}</view>
|
||||
<view class="ml-sm" v-if="item.pay_type == -1">(已退)</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="flex-between mt-md" v-if="item.pay_type == 2">
|
||||
<view></view>
|
||||
<view @tap.stop="toChangeOrder(index,item.send_type==1?'confirm_get_item':'confirm_send_item')"
|
||||
class="common-btn flex-center f-caption c-base radius-4 ml-lg" :style="{background:primaryColor}">
|
||||
{{item.send_type == 1?'确认取货':'立即发货'}}
|
||||
</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>
|
||||
|
||||
<view class="space-footer"></view>
|
||||
|
||||
<common-popup @confirm="confirmChangeOrder" ref="confirm_get_item" title="确认取货" desc="请确认是否取货,确认后将无法恢复"
|
||||
text="确认取货" :info="popupInfo">
|
||||
</common-popup>
|
||||
<common-popup @confirm="confirmChangeOrder" ref="confirm_send_item" title="立即发货" desc="请确认是否发货,确认后将无法恢复"
|
||||
text="确认发货" :info="popupInfo">
|
||||
</common-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 0,
|
||||
title: '全部'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '待配送',
|
||||
number: 0
|
||||
}, {
|
||||
id: 3,
|
||||
title: '配送中',
|
||||
number: 0
|
||||
}, {
|
||||
id: 7,
|
||||
title: '已完成'
|
||||
}, {
|
||||
id: -1,
|
||||
title: '已取消'
|
||||
}],
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
2: '待配送',
|
||||
3: '配送中',
|
||||
7: '已完成',
|
||||
},
|
||||
orderType: {
|
||||
1: '认养订单',
|
||||
2: '土地订单'
|
||||
},
|
||||
sendType: {
|
||||
1: '自提',
|
||||
2: '快递'
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
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()
|
||||
this.options = options
|
||||
let {
|
||||
tab = 0
|
||||
} = options
|
||||
this.activeIndex = tab
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
tabList,
|
||||
activeIndex
|
||||
} = this
|
||||
param.pay_type = tabList[activeIndex].id
|
||||
let newList = await this.$api.farmer.farmerSendOrderList(param);
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.tabList[1].number = newList.no_send
|
||||
this.tabList[2].number = newList.send_ing
|
||||
this.$util.hideAll()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
// 确认取货/开始配送/配送到家
|
||||
async toChangeOrder(index, key) {
|
||||
let {
|
||||
id,
|
||||
order_code,
|
||||
} = this.list.data[index]
|
||||
this.popupInfo = {
|
||||
id,
|
||||
name: `订单编号:${order_code}`,
|
||||
image: '',
|
||||
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 = {
|
||||
'confirm_get_item': {
|
||||
method: 'sendOrderPickup',
|
||||
msg: '取货成功'
|
||||
},
|
||||
'confirm_send_item': {
|
||||
method: 'sendOrderSend',
|
||||
msg: '发货成功'
|
||||
}
|
||||
}
|
||||
let {
|
||||
method,
|
||||
msg,
|
||||
} = methodModel[refs_key]
|
||||
try {
|
||||
await this.$api.farmer[method]({
|
||||
id
|
||||
})
|
||||
this.$util.hideAll()
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
})
|
||||
this.lockTap = false
|
||||
this.$refs[refs_key].close()
|
||||
this.initRefresh()
|
||||
} catch (e) {
|
||||
setTimeout(() => {
|
||||
this.lockTap = false
|
||||
this.$util.hideAll()
|
||||
}, 2000)
|
||||
}
|
||||
},
|
||||
// 订单详情
|
||||
goDetail(index) {
|
||||
let {
|
||||
id,
|
||||
type
|
||||
} = this.list.data[index]
|
||||
let url = `/farmer/pages/order/distribution/detail?id=${id}&type=${type}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
174
uniapp/uni-app/farmer/pages/order/land/list.vue
Normal file
174
uniapp/uni-app/farmer/pages/order/land/list.vue
Normal file
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<view class="farmer-order-land-list">
|
||||
<fixed>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex" :activeColor="primaryColor"
|
||||
:width="100/tabList.length + '%'" height="100rpx"></tab>
|
||||
<view class="b-1px-b"></view>
|
||||
</fixed>
|
||||
<view @tap.stop="goDetail(index)" class="order-item fill-base mg-big pd-lg radius-16 box-shadow"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between pb-lg">
|
||||
<view class="f-paragraph c-title"
|
||||
:style="{color:item.pay_type == 1? subColor: item.pay_type == 2? primaryColor: ''}">
|
||||
{{statusType[item.pay_type]}}
|
||||
</view>
|
||||
<i class="iconfont icon-right"></i>
|
||||
</view>
|
||||
<view class="flex-center" :class="[{'mt-lg':index!=0}]">
|
||||
<image mode="aspectFill" lazy-load class="avatar radius-24" :src="item.goods_cover"></image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-title c-title text-bold ellipsis" style="max-width: 498rpx;"> {{item.goods_name}}
|
||||
</view>
|
||||
<view class="f-caption c-caption mt-sm"> 租赁期限:{{item.end_time}} 到期 </view>
|
||||
<view class="f-caption c-caption"> 租赁面积:{{item.area}}㎡ </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between mt-md">
|
||||
<view></view>
|
||||
<view @tap.stop="toTel(index)" class="common-btn flex-center f-caption c-base radius-4 ml-lg"
|
||||
:style="{background:primaryColor}">
|
||||
联系买家
|
||||
</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>
|
||||
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 0,
|
||||
title: '全部'
|
||||
}, {
|
||||
id: 1,
|
||||
title: '待支付',
|
||||
number: 0
|
||||
}, {
|
||||
id: 2,
|
||||
title: '租赁中',
|
||||
number: 0
|
||||
}, {
|
||||
id: 7,
|
||||
title: '已完成'
|
||||
}],
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
1: '待支付',
|
||||
2: '租赁中',
|
||||
7: '已完成',
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
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()
|
||||
this.options = options
|
||||
let {
|
||||
tab = 0
|
||||
} = options
|
||||
this.activeIndex = tab
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
tabList,
|
||||
activeIndex
|
||||
} = this
|
||||
param.pay_type = tabList[activeIndex].id
|
||||
let newList = await this.$api.farmer.landOrderList(param);
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.tabList[1].number = newList.count.no_pay_count
|
||||
this.tabList[2].number = newList.count.rent_count
|
||||
this.$util.hideAll()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
toTel(index) {
|
||||
let {
|
||||
mobile: url
|
||||
} = this.list.data[index].address_info
|
||||
this.$util.goUrl({
|
||||
url,
|
||||
openType: 'call'
|
||||
})
|
||||
},
|
||||
// 订单详情
|
||||
goDetail(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/land/pages/order/detail?id=${id}&farmer=1`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
Reference in New Issue
Block a user