Commit 3c8038f6 authored by Morson's avatar Morson

首页与入驻页面对接

parent 98eac386
...@@ -46,10 +46,12 @@ ...@@ -46,10 +46,12 @@
that.globalData.token = util.getToken() that.globalData.token = util.getToken()
AnalysysAgent.registerSuperProperty("platform", "self-support"); AnalysysAgent.registerSuperProperty("platform", "self-support");
// 应用启动,或从后台进入前台显示
this.autoLogin()
}, },
onShow: function() { onShow: function() {
// 应用启动,或从后台进入前台显示 // 应用启动,或从后台进入前台显示
this.autoLogin() // this.autoLogin()
}, },
onHide: function() { onHide: function() {
// 应用从前台进入后台 // 应用从前台进入后台
...@@ -73,7 +75,9 @@ ...@@ -73,7 +75,9 @@
if (!res.data) { if (!res.data) {
return return
} }
callBack(vm, res.data) if(typeof callBack == 'function') {
callBack(vm, res.data)
}
uni.hideLoading() uni.hideLoading()
return res.data return res.data
...@@ -95,6 +99,7 @@ ...@@ -95,6 +99,7 @@
if (result) { if (result) {
if (result.code == 200 && result.data) { if (result.code == 200 && result.data) {
that.setUserData(result.data) that.setUserData(result.data)
that.getBaseInfo(that)
} }
} else { } else {
uni.showModal({ uni.showModal({
......
...@@ -8,16 +8,19 @@ import { ...@@ -8,16 +8,19 @@ import {
settledApiFun settledApiFun
} from '@/common/api/settled.js'; } from '@/common/api/settled.js';
import { learnApiFun } from "@/common/api/learn.js"; import { learnApiFun } from "@/common/api/learn.js";
import { orderApiFun } from "@/common/api/order.js";
let apiFun = function(vm) { let apiFun = function(vm) {
let commonApi = commonApiFun(vm); let commonApi = commonApiFun(vm);
let settledApi = settledApiFun(vm) let settledApi = settledApiFun(vm)
let cloudApi = cloudRulesApiFun(vm) let cloudApi = cloudRulesApiFun(vm)
let learnApi=learnApiFun(vm) let learnApi=learnApiFun(vm)
let orderApi=orderApiFun(vm)
let apiUrl = { let apiUrl = {
...commonApi, ...commonApi,
...settledApi, ...settledApi,
...cloudApi, ...cloudApi,
...learnApi ...learnApi,
...orderApi,
} }
return apiUrl return apiUrl
} }
......
let orderApiFun = function(vm){
let listByRecommendOrder = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/recommend/order', params);
const orderApi = {
listByRecommendOrder,
}
return orderApi
}
module.exports = {
orderApiFun
}
\ No newline at end of file
...@@ -36,7 +36,10 @@ let settledApiFun = function(vm){ ...@@ -36,7 +36,10 @@ let settledApiFun = function(vm){
let listOrderingTutorials = async (params = {}) => await vm.$u.get(ucenterApiUrl+'/v1/settled/get-course-rate', params); let listOrderingTutorials = async (params = {}) => await vm.$u.get(ucenterApiUrl+'/v1/settled/get-course-rate', params);
/* 更新接单教程状态 */ /* 更新接单教程状态 */
let saveCourseRate = async (params = {}) => await vm.$u.get(ucenterApiUrl+'/v1/settled/save-course-rate', params); let saveCourseRate = async (params = {}) => await vm.$u.post(ucenterApiUrl+'/v1/settled/save-course-rate', params);
/* 获取消息内容列表 */
let listByNotice = async (params = {}) => await vm.$u.get(ucenterApiUrl+'/v1/notice/list', params);
const settledApi = { const settledApi = {
getSettleBaseInfo, getSettleBaseInfo,
...@@ -52,6 +55,7 @@ let settledApiFun = function(vm){ ...@@ -52,6 +55,7 @@ let settledApiFun = function(vm){
checkSettleSignInfo, checkSettleSignInfo,
listOrderingTutorials, listOrderingTutorials,
saveCourseRate, saveCourseRate,
listByNotice,
} }
return settledApi return settledApi
} }
......
...@@ -254,11 +254,6 @@ ...@@ -254,11 +254,6 @@
"path": "pages/settle/sign-contract", //启动页面,必选 "path": "pages/settle/sign-contract", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到 "query": "" //启动参数,在页面的onLoad函数里面得到
}, },
{
"name": "订单列表", //模式名称
"path": "pages/order/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
},
{ {
"name": "订单 - 完工配置", //模式名称 "name": "订单 - 完工配置", //模式名称
"path": "pages/order/complete", //启动页面,必选 "path": "pages/order/complete", //启动页面,必选
......
...@@ -38,18 +38,8 @@ ...@@ -38,18 +38,8 @@
<!-- 入驻成功之后显示推荐订单列表 --> <!-- 入驻成功之后显示推荐订单列表 -->
<view class="order-list-view"> <view class="order-list-view">
<view v-if="status == 7 && orderList.length > 0" class="order-item-view">
<view v-for="(item, index) in orderList" :key="index">
<OrderCell :orderData="item"> </OrderCell>
</view>
<u-loadmore :status="currentLoadStatus" bgColor="#f2f2f2"></u-loadmore>
</view>
<!-- 入驻成功之后无推荐订单 -->
<view v-else-if="status == 7 && orderList.length <= 0" class="no-order-view">
暂无订单
</view>
<!-- 入驻前--> <!-- 入驻前-->
<view v-else-if="loaded" class="tip-view"> <view v-if="needSettled" class="tip-view">
<view class="tip-title">当前订单(笔)</view> <view class="tip-title">当前订单(笔)</view>
<view class="tip-count">{{ count }}</view> <view class="tip-count">{{ count }}</view>
<view class="tip-other">入驻通过后平台将向您推荐订单</view> <view class="tip-other">入驻通过后平台将向您推荐订单</view>
...@@ -58,6 +48,16 @@ ...@@ -58,6 +48,16 @@
立即入驻 立即入驻
</u-button> </u-button>
</view> </view>
<view v-else-if="!needSettled && orderList.length > 0" class="order-item-view">
<view v-for="(item, index) in orderList" :key="index">
<OrderCell :orderData="item"> </OrderCell>
</view>
<u-loadmore :status="currentLoadStatus" bgColor="#f2f2f2"></u-loadmore>
</view>
<!-- 入驻成功之后无推荐订单 -->
<view v-else-if="!needSettled && orderList.length <= 0" class="no-order-view">
暂无订单
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -94,38 +94,22 @@ ...@@ -94,38 +94,22 @@
indicatorPos: "bottomCenter", indicatorPos: "bottomCenter",
title: "Hello", title: "Hello",
loaded: false, loaded: false,
needSettled: true,
count: 0, // 推荐订单数量 count: 0, // 推荐订单数量
messageList: [{ messageList: [],
id: 1234,
type: "",
level: "",
title: "",
url: "",
body: "好消息",
},
{
id: 1234,
type: "",
level: "",
title: "",
url: "",
body: "好消息",
},
{
id: 1234,
type: "",
level: "",
title: "",
url: "",
body: "好消息",
},
],
loadStatus: ["more", "loading", "noMore"], loadStatus: ["more", "loading", "noMore"],
currentLoadStatus: "loading", currentLoadStatus: "loading",
orderList: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}], orderList: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
search: {
token: app.globalData.token || '',
pageNumber: 0,
pageSize: 10,
},
bottomLoading: false, bottomLoading: false,
}; };
}, },
watch: {},
computed: { computed: {
buttonStyle() { buttonStyle() {
return { return {
...@@ -150,21 +134,58 @@ ...@@ -150,21 +134,58 @@
onShow() { onShow() {
// 每次进入页面都刷新入驻状态 // 每次进入页面都刷新入驻状态
if (app.globalData.token) { if (app.globalData.token) {
// 获取是否显示入驻按钮 // 初始化入驻信息
this.initSettleInfo(); this.initSettleInfo();
} else {
// 初始化订单数据
this.loadOrderList()
} }
}, },
methods: { methods: {
async initSettleInfo() { async initSettleInfo() {
if (this.status == 7) return; let self = this
if (self.status == 7) return;
const callBack = (vm, result) => { const callBack = (vm, result) => {
// 后台自动判断入驻流程是否完成,前台通过status确定状态 // 后台自动判断入驻流程是否完成,前台通过status确定状态
if (result && result.record) { if (result && result.record) {
vm.loaded = true; vm.loaded = true;
vm.status = Number(result.record.status); vm.status = Number(result.record.status);
vm.needSettled = result.needSettled
} }
}; };
await app.getBaseInfo(this, callBack); await app.getBaseInfo(self, callBack);
// 加载消息列表
self.loadMessageList()
self.loadOrderList()
},
loadMessageList() {
let self = this
self.$u.api.listByNotice().then(res => {
if(res.code == 200) {
if(res.data && res.data.length > 3) {
self.messageList = res.data.slice(0, 3)
} else {
self.messageList = res.data || []
}
} else {
console.log(res.message, "初始化消息列表异常");
}
})
},
loadOrderList() {
let self = this
// 加载订单列表
self.search.token = app.globalData.token
self.$u.api.listByRecommendOrder(self.search).then(res => {
if(res.code == 200) {
if(res.data && res.data.length > 0) {
self.orderList.push().apply(res.data)
}
} else {
console.log(res.message, "初始化订单列表异常");
}
})
}, },
onRefresh() { onRefresh() {
if (this._freshing) return; if (this._freshing) return;
...@@ -212,9 +233,9 @@ ...@@ -212,9 +233,9 @@
console.log("-----scroll-------"); console.log("-----scroll-------");
}, },
immediatelyIn() { immediatelyIn() {
if (util.getToken()) { if (util.getToken() && this.needSettled) {
uni.navigateTo({ uni.navigateTo({
url: this.status > 0 ? "/pages/settle/prompt" : "/pages/settle/index", url: !this.status ? "/pages/settle/index" : "/pages/settle/prompt",
}); });
} else { } else {
uni.navigateTo({ uni.navigateTo({
...@@ -257,6 +278,7 @@ ...@@ -257,6 +278,7 @@
border-radius: 12rpx; border-radius: 12rpx;
background-color: #FFFFFF; background-color: #FFFFFF;
padding: 6rpx 30rpx; padding: 6rpx 30rpx;
height: 268rpx;
} }
.msg-content { .msg-content {
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
</image> </image>
</view> </view>
<view class="txt-box"> <view class="txt-box">
<text :class="['title', {failed: status == 4} ,index ? 'active' : '']" v-for="(txt,index) in info.txtArr">{{txt}}</text> <text :class="['title', {failed: status == 4} ,index ? 'active' : '']" v-for="(txt,index) in info.txtArr" :key="index">{{txt}}</text>
</view> </view>
<view class="tips-box" v-if="info.tipsArr"> <view class="tips-box" v-if="info.tipsArr">
<text :class="['tips',info.tipsArr.length>1 && index===0 ? 'red' : '']" <text :class="['tips',info.tipsArr.length>1 && index===0 ? 'red' : '']"
v-for="(txt,index) in info.tipsArr">{{txt}}</text> v-for="(txt,index) in info.tipsArr" :key="index">{{txt}}</text>
</view> </view>
<view class="services-view"> <view class="services-view">
<Services/> <Services/>
......
...@@ -33,6 +33,7 @@ function authorization(data) { ...@@ -33,6 +33,7 @@ function authorization(data) {
if (res) { if (res) {
if (res.code == 200 && res.data) { if (res.code == 200 && res.data) {
app.setUserData(res.data) app.setUserData(res.data)
app.getBaseInfo(app.$vm)
resolve(res); resolve(res);
} else { } else {
reject(res); reject(res);
...@@ -53,6 +54,7 @@ function signup(data) { ...@@ -53,6 +54,7 @@ function signup(data) {
if (res) { if (res) {
if (res.code == 200 && res.data) { if (res.code == 200 && res.data) {
app.setUserData(res.data) app.setUserData(res.data)
app.getBaseInfo(app.$vm)
resolve(res); resolve(res);
} else { } else {
uni.showModal({ uni.showModal({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment