Commit bccd4da2 authored by 和慭琛's avatar 和慭琛

登录模块 下单模块 接单列表 接口对接 100%

parent dddb2c7c
......@@ -5,13 +5,116 @@
<script>
export default {
globalData: {
//https://system.banshouhui.com
//https://system.dev.banshouhui.com
//http://192.168.0.208:8192
domain_Name: 'http://192.168.0.208:37080',
token:'',
//RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502
//登录注册页--
//通过code获取用户信息(登录)
getUsersByCode:'/wxh-support-rest/rest/ssoinfo/v3/getUsersByCode',
//通过手机号获取用户信息(注册并登录)
findByMobile:'/wxh-support-rest/rest/ssoinfo/v3/findByMobile',
//下单模块--
//立即下单
createAppletsOrder:'',
//下单列表
createOrderList:'',
//接单模块--
//抢单广场
grabbing:'',
//检查抢单用户状态
checkRobStatus:'',
///wxh-worker-rest/rest/order/revision/applets/{token}/order/check
//工单列表
workOrderList:'',
//工单详情
workOrderDetail:'',
},
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
var that=this
uni.getStorage({
key: 'token',
success: function (res) {
console.log('本地获取token成功')
console.log(res.data);
that.globalData.token = res.data
}
})
this.globalData.token = 'RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502'
this.initAPIneedToken()
console.log('当前token',this.token)
},
methods: {
initAPIneedToken: function() {
//RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502
///*
if(this.globalData.token){
console.log('initAPIneedToken')
//下单模块--
//立即下单
this.globalData.createAppletsOrder = '/wxh-worker-rest/rest/order/revision/applets/'
+this.globalData.token+'/order/createAppletsOrder',
console.log('立即下单'+this.globalData.createAppletsOrder)
//下单列表
this.globalData.createOrderList = '/wxh-worker-rest/rest/order/revision/applets/'
+this.globalData.token+'/order/customer'
console.log('下单列表'+this.globalData.createOrderList)
//接单模块--
//抢单广场
this.globalData.grabbing = '/wxh-worker-rest/rest/order/revision/applets/'
+this.globalData.token+'/order/grabbing'
console.log('抢单广场'+this.globalData.grabbing)
//检查抢单用户状态
this.globalData.checkRobStatus = '/wxh-worker-rest/rest/order/revision/applets/'
+this.globalData.token+'/order/check',
console.log('检查抢单用户状态'+this.globalData.checkRobStatus)
//工单列表
this.globalData.workOrderList = '/wxh-worker-rest/rest/order/revision/applets/'
+this.globalData.token+'/order/worker',
console.log('工单列表'+this.globalData.workOrderList)
//工单详情
this.globalData.workOrderDetail = '/wxh-worker-rest/rest/order/revision/applets/'
+this.globalData.token+'/order/detail',
console.log('工单详情'+this.globalData.workOrderDetail)
}
//*/
},
},
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
......
......@@ -5,6 +5,14 @@
},
*/
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/take/index",
"style": {
"navigationBarTitleText": "接单"
}
},
{
"path": "pages/index/index",
"style": {
......@@ -13,6 +21,7 @@
},
{
"path": "pages/take/finish",
"style": {
......@@ -28,12 +37,7 @@
"navigationBarTitleText": "抢单"
}
},
{
"path": "pages/take/index",
"style": {
"navigationBarTitleText": "接单"
}
},
{
......
......@@ -71,7 +71,7 @@
</template>
<script>
import { getworkertype} from '@/take_order_api/api.js'; //引入需要的api
//import { getworkertype} from '@/take_order_api/api.js'; //引入需要的api
export default {
data() {
......@@ -102,9 +102,10 @@
},
onShow() {
this.getWorkerType()
this.getPerson()
//this.getWorkerType()
//this.getPerson()
this.checkClean()
},
methods: {
......@@ -143,6 +144,7 @@
protocolClick: function () {
console.log('服务协议点击')
},
recordClick: function () {
......@@ -154,13 +156,29 @@
confirmClick: function () {
console.log('立即下单')
uni.navigateTo({
url: '/pages/index/success'
})
console.log(getApp().globalData.token)
// if(!getApp().globalData.token){
// uni.navigateTo({
// url:'/pages/login/wxlogin'
// })
// return
// }
this.createAppletsOrder()
},
checkClean: function (){
// uni.getStorage({
// key: 'token',
// success: function (res) {
// console.log('本地获取token成功')
// console.log(res.data);
// getApp().globalData.token = res.data
// }
// })
let pages = getCurrentPages();
let currPage = pages[pages.length-1];
console.log('是否清除:')
......@@ -181,7 +199,62 @@
},
///*
//客户报单接口
createAppletsOrder: async function() {
console.log('联系人:'+this.name)
console.log('联系电话:'+this.phone)
console.log('地址:'+this.address)
console.log('品类:'+this.activeProduct)
console.log('服务类型:'+this.activeService)
console.log('服务备注:'+this.demandContent)
uni.showLoading({
title:'请稍候'
})
uni.request({
url: getApp().globalData.domain_Name
+getApp().globalData.createAppletsOrder,
method: 'POST',
header: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization':''
},
data: {
contactName:this.name,
contactPhone:this.phone,
contactAddress:this.address,
categoryName:this.activeProduct,
brandName:this.activeProduct,
orderServiceType:this.activeService,
serviceContent:this.demandContent,
},
success: (res) => {
console.log('客户报单接口 成功')
console.log(res)
uni.hideLoading()
if(res.data.code==200){
uni.showToast({
title:'下单成功'
})
uni.navigateTo({
url: '/pages/index/success'
})
}
},
fail: (e) => {
uni.hideLoading()
uni.showToast({
title:'下单失败'
})
console.log('客户报单接口 失败')
console.log(e)
}
})
},
/*
async getWorkerType() {
let res = await this.$u.api.getWorkertype();
if (res.code != 1) {
......@@ -191,7 +264,7 @@
console.log('请求工种类型:')
console.log(res)
},
//*/
getPerson: async function() {
uni.showLoading({
......@@ -208,7 +281,8 @@
console.log(data)
const data = res.data
},
},
*/
}
......
......@@ -76,10 +76,57 @@
onLoad() {
},
onShow(){
// if(!getApp().globalData.token){
// uni.navigateTo({
// url:'/pages/login/wxlogin'
// })
// return
// }
this.createOrderList()
},
methods: {
//获取下单列表
createOrderList: function () {
uni.request({
url: getApp().globalData.domain_Name
+getApp().globalData.createOrderList,
method: 'GET',
data: {
type:this.activeTop,
pageNumber:1,
pageSize:20,
},
success: (res) => {
console.log('获取下单列表 成功')
console.log(res)
if(res.data.code==200){
}else{
uni.showToast({
title:res.errMsg
})
}
},
fail: (e) => {
console.log('获取下单列表 失败')
console.log(e)
}
})
},
topClick: function (active) {
if(this.activeTop!=active){
this.activeTop = active
this.createOrderList()
}
},
......@@ -88,7 +135,8 @@
uni.makePhoneCall({
phoneNumber: phone
});
}
},
}
......
<template>
<view class="">
<view class="backView">
<button class="loginBtn" open-type="getUserInfo" lang="zh_CN" @getuserinfo="getUserInfo">
<button v-if="!isNewUser" class="loginBtn" open-type="getUserInfo" lang="zh_CN" @getuserinfo="getUserInfo">
<text class="u-font-32 white">立即登录</text>
</button>
<button v-if="isNewUser" class="loginBtn" open-type="getPhoneNumber" throttle-time="1000" @getphonenumber="getPhoneNumber">
<text class="u-font-32 white">授权登录</text>
</button>
</view>
......@@ -12,11 +15,15 @@
export default {
data() {
return {
productType:'家电安装',
domain_name:'http://192.168.0.208:8192',
isNewUser:false,
unionID:'',
openID:'',
}
},
onLoad() {
//this.domain_name = getApp().globalData.domain_Name
console.log('当前域名:'+this.domain_name)
},
methods: {
......@@ -39,7 +46,9 @@
});
} else {
this.getCode()
/*
try {
let code = await this.getCode();
let rawData = e.detail
......@@ -51,12 +60,14 @@
iv: rawData.iv
}
this.getUnionID(code)
this.getUsersByCode(code)
//this.getUnionID(code)
//this.toLogin(data);
} catch (e) {
this.$u.toast(e);
}
*/
}
},
......@@ -76,8 +87,9 @@
console.log('getCode成功')
console.log(res)
if (res.code) {
that.getUsersByCode(res.code)
//that.getUnionID(res.code)
resolve(res.code);
//resolve(res.code);
} else {
//login成功,但是没有取到code
reject('未取得code');
......@@ -90,6 +102,140 @@
});
},
//通过code获取用户信息(新接口)
getUsersByCode: async function(code) {
console.log('通过code获取用户信息 请求接口:')
console.log(getApp().globalData.domain_Name
+getApp().globalData.getUsersByCode)
uni.request({
url: this.domain_name
+getApp().globalData.getUsersByCode,
method: 'GET',
data: {
code: code,
},
success: (res) => {
console.log('通过code获取用户信息(新接口) 成功')
console.log(res)
if(res.data.code==200){
this.unionID = res.data.data.user.unionid
this.openID = res.data.data.user.wxopenid
if(res.data.data.token){
uni.showToast({
title:'登陆成功'
})
this.saveUserInfo(res)
}else{
uni.showToast({
title:'新用户请授权登录'
})
this.isNewUser = true
}
}else{
uni.showToast({
title:res.errMsg
})
}
},
fail: (e) => {
console.log('通过code获取用户信息(新接口) 失败')
console.log(e)
}
})
},
//用户信息存本地
saveUserInfo: async function(res) {
console.log('用户信息存本地 token:' +res.data.token);
uni.setStorage({
key: 'token',
data: res.data.token,
success: function (res) {
console.log('保存token 成功'+res);
}
});
uni.navigateBack({
})
},
//获取用户手机号
getPhoneNumber: async function(e) {
console.log('获取用户手机号')
console.log(e.detail)
if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
//this.$u.toast('未授权');
uni.showModal({
title: '授权失败',
content: '请允许获取用户信息的授权',
showCancel: false
});
} else {
this.findByMobile(e)
}
},
//通过手机号获取用户信息
findByMobile: async function(e) {
uni.request({
url: this.domain_name
+getApp().globalData.findByMobile,
method: 'POST',
data: {
wxopenid: this.openID,
unionid:this.unionID,
encryptedData:e.detail.encryptedData,
iv:e.detail.iv
},
header:{
'Content-Type': 'application/x-www-form-urlencoded'
},
success: (res) => {
console.log('通过手机号获取用户信息 成功')
console.log(res)
if(res.data.code==200){
uni.showToast({
title:'登陆成功'
})
this.saveUserInfo(res)
}else{
uni.showToast({
title:res.errMsg
})
}
},
fail: (e) => {
console.log('通过code获取用户信息(新接口) 失败')
console.log(e)
}
})
},
/*
//微信授权
toLogin: async function(data) {
uni.showLoading({
......@@ -104,9 +250,8 @@
return;
}
if (res.data) {
let app = getApp();
this.setLoginStatus()
//this.setLoginStatus()
// this.success(res.data.user.id);
}
},
......@@ -115,8 +260,8 @@
getUnionID: async function(code) {
uni.request({
url: 'http://192.168.0.208:8192'+
'/wxh-support-rest/rest/ssoinfo/getUsersByCode',
url: getApp().globalData.domain_Name
+'/wxh-support-rest/rest/ssoinfo/getUsersByCode',
method: 'GET',
data: {
code: code,
......@@ -142,7 +287,7 @@
getSSOID: async function(unionID) {
uni.request({
url: 'http://192.168.0.208:8192'
url: getApp().globalData.domain_Name
+ '/wxh-support-rest/rest/ssoinfo/v2/findByUnionId',
method: 'GET',
data: {
......@@ -166,7 +311,7 @@
getLoginCode: async function() {
uni.request({
url: 'http://192.168.0.208:8192'
url: getApp().globalData.domain_Name
+ '/wxh-support-rest/rest/ssoinfo/v2/getLoginCode',
method: 'GET',
data: {
......@@ -192,7 +337,7 @@
//获取token
getToken: async function(loginCode) {
uni.request({
url: 'http://192.168.0.208:8192'
url: getApp().globalData.domain_Name
+ '/wxh-support-rest/rest/worker/login/applets/'
+loginCode,
method: 'GET',
......@@ -208,7 +353,7 @@
}
})
},
*/
}
}
</script>
......
......@@ -89,9 +89,44 @@
},
onLoad() {
},
onShow(){
this.getOrderDetail()
},
methods: {
//获取工单详情
getOrderDetail: function () {
uni.request({
url: getApp().globalData.domain_Name
+getApp().globalData.workOrderDetail,
method: 'GET',
data: {
orderId:'5534486'
},
success: (res) => {
console.log('获取工单详情 成功')
console.log(res)
if(res.data.code==200){
}else{
uni.showToast({
title:res.errMsg
})
}
},
fail: (e) => {
console.log('获取工单详情 失败')
console.log(e)
}
})
},
phoneCallClick: function (phone) {
uni.makePhoneCall({
phoneNumber: phone
......
......@@ -143,11 +143,108 @@
},
onLoad() {
},
onShow() {
this.getData()
},
methods: {
//获取数据
getData: function () {
//抢单广场
if(this.activeTop==0){
this.getRobList()
}
//工单列表
//type 0 全部、1 待接单、2今日预约、3明日预约、4未预约 5已完成
//全部未完工
if(this.activeTop==1){
//0 全部
this.getOrderList(0)
}
//已完工
if(this.activeTop==2){
//5已完成
this.getOrderList(5)
}
},
//获取抢单广场列表
getRobList: function () {
uni.request({
url: getApp().globalData.domain_Name
+getApp().globalData.grabbing,
method: 'GET',
data: {
pageNumber:0,
pageSize:20,
},
success: (res) => {
console.log('获取抢单广场列表 成功')
console.log(res)
if(res.data.code==200){
}else{
uni.showToast({
title:res.errMsg
})
}
},
fail: (e) => {
console.log('获取抢单广场列表 失败')
console.log(e)
}
})
},
//获取工单列表
getOrderList: function (type) {
uni.request({
url: getApp().globalData.domain_Name
+getApp().globalData.workOrderList,
method: 'GET',
data: {
type:type,
pageNumber:0,
pageSize:20,
},
success: (res) => {
console.log('获取工单列表 成功')
console.log(res)
if(res.data.code==200){
}else{
uni.showToast({
title:res.errMsg
})
}
},
fail: (e) => {
console.log('获取工单列表 失败')
console.log(e)
}
})
},
topClick: function (active) {
if(this.activeTop!=active){
this.activeTop = active
this.getData()
}
},
......@@ -161,7 +258,7 @@
if(this.activeTop==0){//抢单市场
if(item.status=='待抢单'){
uni.navigateTo({
url: '/pages/take/rob'
url: '/pages/take/rob'+'?orderId='+item.orderId
})
}else{
uni.navigateTo({
......
......@@ -26,6 +26,7 @@
export default {
data() {
return {
orderId:0,
orderInfo:{
name:'梵护博',
phone:'15811112222',
......@@ -43,20 +44,172 @@
},
}
},
onLoad() {
onLoad(e) {
this.orderId = '10704467'
},
methods: {
robClick: function (item) {
console.log('抢单 点击')
this.checkUserStatus()
},
//检查用户状态
checkUserStatus: function (item) {
console.log('检查用户状态')
uni.request({
url: getApp().globalData.domain_Name
+getApp().globalData.checkRobStatus,
method: 'GET',
data: {
},
success: (res) => {
console.log('检查用户状态 成功')
console.log(res)
if(res.data.code==200){
this.checkShowModal(res.data.data)
}else{
uni.showToast({
title:res.errMsg
})
}
},
fail: (e) => {
console.log('检查用户状态 失败')
console.log(e)
}
})
},
//判断状态显示弹窗
//0 通过 1不是师傅 2没有认证通过 3技能不匹配
checkShowModal: function (data) {
console.log('判断状态显示弹窗')
console.log(data)
var content = ''
var confirmText = ''
data =0
//0 通过
if(data==0){
this.robPost()
return
}
//1不是师傅
if(data==1){
content = '无法抢单!请先入驻平台'
confirmText = '立即入驻'
}
//2没有认证通过
if(data==2){
content = '你的技能和区域信息等认证信息未完善'
confirmText = '立即完善'
}
//3技能不匹配
if(data==3){
content = '无法抢单!您的区域或技能不符合工单要求'
confirmText = '联系客服400-8834-123'
}
let that = this
console.log('11111')
uni.showModal({
title: '提示',
content: '无法抢单!请先入驻平台',
content: content,
showCancel:false,
success: res => {
confirmText:confirmText,
success: (res) => {
that.modalConfirm(data)
},
})
console.log('22222')
},
//确认按钮
modalConfirm: function (data) {
//1不是师傅
if(data==1){
this.enterNow()
}
//2没有认证通过
if(data==2){
this.completeNow()
}
//3技能不匹配
if(data==3){
this.contactService()
}
},
//立即入驻
enterNow: function () {
console.log('立即入驻')
},
//立即完善
completeNow: function () {
console.log('立即完善')
},
//联系客服
contactService: function () {
console.log('联系客服')
uni.makePhoneCall({
phoneNumber:'4008834123'
})
},
//抢单请求
////%@/worker/%@/order/%@/accept
robPost: function () {
console.log('抢单请求')
uni.request({
url: 'http://192.168.1.22'
+'/wxh-sts-rest/rest/worker/'+
'RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502'
+'/order/'+this.orderId+'/accept',
method: 'POST',
data: {
},
success: (res) => {
console.log('抢单请求 成功')
console.log(res)
if(res.data.code==200){
}else{
uni.showToast({
title:res.errMsg
})
}
},
fail: (e) => {
console.log('抢单请求 失败')
console.log(e)
}
})
},
......
{
"pages": [
"pages/take/index",
"pages/index/index",
"pages/take/finish",
"pages/take/rob",
"pages/take/index",
"pages/take/detail",
"pages/index/record",
"pages/index/success",
......
......@@ -101,7 +101,7 @@ __webpack_require__.r(__webpack_exports__);
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; //
/* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; //
//
//
//
......@@ -109,15 +109,119 @@ var _default =
{
globalData: {
//https://system.banshouhui.com
//https://system.dev.banshouhui.com
//http://192.168.0.208:8192
domain_Name: 'http://192.168.0.208:37080',
token: '',
//RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502
//登录注册页--
//通过code获取用户信息(登录)
getUsersByCode: '/wxh-support-rest/rest/ssoinfo/v3/getUsersByCode',
//通过手机号获取用户信息(注册并登录)
findByMobile: '/wxh-support-rest/rest/ssoinfo/v3/findByMobile',
//下单模块--
//立即下单
createAppletsOrder: '',
//下单列表
createOrderList: '',
//接单模块--
//抢单广场
grabbing: '',
//检查抢单用户状态
checkRobStatus: '',
///wxh-worker-rest/rest/order/revision/applets/{token}/order/check
//工单列表
workOrderList: '',
//工单详情
workOrderDetail: '' },
onLaunch: function onLaunch() {
console.log('App Launch');
},
onShow: function onShow() {
console.log('App Show');
var that = this;
uni.getStorage({
key: 'token',
success: function success(res) {
console.log('本地获取token成功');
console.log(res.data);
that.globalData.token = res.data;
} });
this.globalData.token = 'RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502';
this.initAPIneedToken();
console.log('当前token', this.token);
},
methods: {
initAPIneedToken: function initAPIneedToken() {
//RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502
///*
if (this.globalData.token) {
console.log('initAPIneedToken');
//下单模块--
//立即下单
this.globalData.createAppletsOrder = '/wxh-worker-rest/rest/order/revision/applets/' +
this.globalData.token + '/order/createAppletsOrder',
console.log('立即下单' + this.globalData.createAppletsOrder);
//下单列表
this.globalData.createOrderList = '/wxh-worker-rest/rest/order/revision/applets/' +
this.globalData.token + '/order/customer';
console.log('下单列表' + this.globalData.createOrderList);
//接单模块--
//抢单广场
this.globalData.grabbing = '/wxh-worker-rest/rest/order/revision/applets/' +
this.globalData.token + '/order/grabbing';
console.log('抢单广场' + this.globalData.grabbing);
//检查抢单用户状态
this.globalData.checkRobStatus = '/wxh-worker-rest/rest/order/revision/applets/' +
this.globalData.token + '/order/check',
console.log('检查抢单用户状态' + this.globalData.checkRobStatus);
//工单列表
this.globalData.workOrderList = '/wxh-worker-rest/rest/order/revision/applets/' +
this.globalData.token + '/order/worker',
console.log('工单列表' + this.globalData.workOrderList);
//工单详情
this.globalData.workOrderDetail = '/wxh-worker-rest/rest/order/revision/applets/' +
this.globalData.token + '/order/detail',
console.log('工单详情' + this.globalData.workOrderDetail);
}
//*/
} },
onHide: function onHide() {
console.log('App Hide');
} };exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
/***/ }),
/* 8 */
......
......@@ -11123,81 +11123,6 @@ var take_orderApiFun = function take_orderApiFun(vm) {
module.exports = {
take_orderApiFun: take_orderApiFun };
/***/ }),
/* 52 */,
/* 53 */,
/* 54 */,
/* 55 */,
/* 56 */,
/* 57 */,
/* 58 */
/*!**************************************************************************!*\
!*** /Users/liyifan/Desktop/take-order/take-order/take_order_api/api.js ***!
\**************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });exports.getworkertype = getworkertype;var _request = _interopRequireDefault(__webpack_require__(/*! @/take_order_api/request.js */ 59));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
function getworkertype(data) {
return (0, _request.default)({
url: '/addons/cms/wxapp.user/getworkertype',
method: 'GET',
data: data });
}
/***/ }),
/* 59 */
/*!******************************************************************************!*\
!*** /Users/liyifan/Desktop/take-order/take-order/take_order_api/request.js ***!
\******************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; //把配置项单独处理
//import store from '/store/index.js'; //vuex
var server_url = 'https://fa.banshouhui.com'; //请求地址
var token = ' '; //凭证
true ? '192.168.0.1' : undefined; //环境配置
function service() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
//store.state.token && (token = store.state.token); //从vuex中获取登录凭证
options.url = "".concat(server_url).concat(options.url);
//配置请求头
options.header = {
'content-type': 'application/x-www-form-urlencoded',
'accessToken': "".concat(token) //Bearer
};
return new Promise(function (resolved, rejected) {
//成功
options.success = function (res) {
if (Number(res.data.code) == 0) {//请求成功
resolved(res.data.data);
} else {
uni.showToast({
icon: 'none',
duration: 3000,
title: "".concat(res.data.msg) });
rejected(res.data.msg); //错误
}
};
//错误
options.fail = function (err) {
rejected(err); //错误
};
uni.request(options);
});
}var _default =
service;exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
/***/ })
]]);
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map
\ No newline at end of file
......@@ -237,10 +237,57 @@ var _default =
onLoad: function onLoad() {
},
onShow: function onShow() {
// if(!getApp().globalData.token){
// uni.navigateTo({
// url:'/pages/login/wxlogin'
// })
// return
// }
this.createOrderList();
},
methods: {
//获取下单列表
createOrderList: function createOrderList() {
uni.request({
url: getApp().globalData.domain_Name +
getApp().globalData.createOrderList,
method: 'GET',
data: {
type: this.activeTop,
pageNumber: 1,
pageSize: 20 },
success: function success(res) {
console.log('获取下单列表 成功');
console.log(res);
if (res.data.code == 200) {
} else {
uni.showToast({
title: res.errMsg });
}
},
fail: function fail(e) {
console.log('获取下单列表 失败');
console.log(e);
} });
},
topClick: function topClick(active) {
if (this.activeTop != active) {
this.activeTop = active;
this.createOrderList();
}
},
......
<view><view class="backView"><button class="loginBtn" open-type="getUserInfo" lang="zh_CN" data-event-opts="{{[['getuserinfo',[['getUserInfo',['$event']]]]]}}" bindgetuserinfo="__e"><text class="u-font-32 white">授权登录</text></button></view></view>
\ No newline at end of file
<view><view class="backView"><block wx:if="{{!isNewUser}}"><button class="loginBtn" open-type="getUserInfo" lang="zh_CN" data-event-opts="{{[['getuserinfo',[['getUserInfo',['$event']]]]]}}" bindgetuserinfo="__e"><text class="u-font-32 white">立即登录</text></button></block><block wx:if="{{isNewUser}}"><button class="loginBtn" open-type="getPhoneNumber" throttle-time="1000" data-event-opts="{{[['getphonenumber',[['getPhoneNumber',['$event']]]]]}}" bindgetphonenumber="__e"><text class="u-font-32 white">授权登录</text></button></block></view></view>
\ No newline at end of file
......@@ -221,9 +221,44 @@ var _default =
},
onLoad: function onLoad() {
},
onShow: function onShow() {
this.getOrderDetail();
},
methods: {
//获取工单详情
getOrderDetail: function getOrderDetail() {
uni.request({
url: getApp().globalData.domain_Name +
getApp().globalData.workOrderDetail,
method: 'GET',
data: {
orderId: '5534486' },
success: function success(res) {
console.log('获取工单详情 成功');
console.log(res);
if (res.data.code == 200) {
} else {
uni.showToast({
title: res.errMsg });
}
},
fail: function fail(e) {
console.log('获取工单详情 失败');
console.log(e);
} });
},
phoneCallClick: function phoneCallClick(phone) {
uni.makePhoneCall({
phoneNumber: phone });
......
......@@ -275,11 +275,108 @@ var _default =
},
onLoad: function onLoad() {
},
onShow: function onShow() {
this.getData();
},
methods: {
//获取数据
getData: function getData() {
//抢单广场
if (this.activeTop == 0) {
this.getRobList();
}
//工单列表
//type 0 全部、1 待接单、2今日预约、3明日预约、4未预约 5已完成
//全部未完工
if (this.activeTop == 1) {
//0 全部
this.getOrderList(0);
}
//已完工
if (this.activeTop == 2) {
//5已完成
this.getOrderList(5);
}
},
//获取抢单广场列表
getRobList: function getRobList() {
uni.request({
url: getApp().globalData.domain_Name +
getApp().globalData.grabbing,
method: 'GET',
data: {
pageNumber: 0,
pageSize: 20 },
success: function success(res) {
console.log('获取抢单广场列表 成功');
console.log(res);
if (res.data.code == 200) {
} else {
uni.showToast({
title: res.errMsg });
}
},
fail: function fail(e) {
console.log('获取抢单广场列表 失败');
console.log(e);
} });
},
//获取工单列表
getOrderList: function getOrderList(type) {
uni.request({
url: getApp().globalData.domain_Name +
getApp().globalData.workOrderList,
method: 'GET',
data: {
type: type,
pageNumber: 0,
pageSize: 20 },
success: function success(res) {
console.log('获取工单列表 成功');
console.log(res);
if (res.data.code == 200) {
} else {
uni.showToast({
title: res.errMsg });
}
},
fail: function fail(e) {
console.log('获取工单列表 失败');
console.log(e);
} });
},
topClick: function topClick(active) {
if (this.activeTop != active) {
this.activeTop = active;
this.getData();
}
},
......@@ -293,7 +390,7 @@ var _default =
if (this.activeTop == 0) {//抢单市场
if (item.status == '待抢单') {
uni.navigateTo({
url: '/pages/take/rob' });
url: '/pages/take/rob' + '?orderId=' + item.orderId });
} else {
uni.navigateTo({
......
......@@ -158,6 +158,7 @@ var _default =
{
data: function data() {
return {
orderId: 0,
orderInfo: {
name: '梵护博',
phone: '15811112222',
......@@ -175,20 +176,172 @@ var _default =
},
onLoad: function onLoad() {
onLoad: function onLoad(e) {
this.orderId = '10704467';
},
methods: {
robClick: function robClick(item) {
console.log('抢单 点击');
this.checkUserStatus();
},
//检查用户状态
checkUserStatus: function checkUserStatus(item) {var _this = this;
console.log('检查用户状态');
uni.request({
url: getApp().globalData.domain_Name +
getApp().globalData.checkRobStatus,
method: 'GET',
data: {},
success: function success(res) {
console.log('检查用户状态 成功');
console.log(res);
if (res.data.code == 200) {
_this.checkShowModal(res.data.data);
} else {
uni.showToast({
title: res.errMsg });
}
},
fail: function fail(e) {
console.log('检查用户状态 失败');
console.log(e);
} });
},
//判断状态显示弹窗
//0 通过 1不是师傅 2没有认证通过 3技能不匹配
checkShowModal: function checkShowModal(data) {
console.log('判断状态显示弹窗');
console.log(data);
var content = '';
var confirmText = '';
data = 0;
//0 通过
if (data == 0) {
this.robPost();
return;
}
//1不是师傅
if (data == 1) {
content = '无法抢单!请先入驻平台';
confirmText = '立即入驻';
}
//2没有认证通过
if (data == 2) {
content = '你的技能和区域信息等认证信息未完善';
confirmText = '立即完善';
}
//3技能不匹配
if (data == 3) {
content = '无法抢单!您的区域或技能不符合工单要求';
confirmText = '联系客服400-8834-123';
}
var that = this;
console.log('11111');
uni.showModal({
title: '提示',
content: '无法抢单!请先入驻平台',
content: content,
showCancel: false,
confirmText: confirmText,
success: function success(res) {
that.modalConfirm(data);
} });
console.log('22222');
},
//确认按钮
modalConfirm: function modalConfirm(data) {
//1不是师傅
if (data == 1) {
this.enterNow();
}
//2没有认证通过
if (data == 2) {
this.completeNow();
}
//3技能不匹配
if (data == 3) {
this.contactService();
}
},
//立即入驻
enterNow: function enterNow() {
console.log('立即入驻');
},
//立即完善
completeNow: function completeNow() {
console.log('立即完善');
},
//联系客服
contactService: function contactService() {
console.log('联系客服');
uni.makePhoneCall({
phoneNumber: '4008834123' });
},
//抢单请求
////%@/worker/%@/order/%@/accept
robPost: function robPost() {
console.log('抢单请求');
uni.request({
url: 'http://192.168.1.22' +
'/wxh-sts-rest/rest/worker/' +
'RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502' +
'/order/' + this.orderId + '/accept',
method: 'POST',
data: {},
success: function success(res) {
console.log('抢单请求 成功');
console.log(res);
if (res.data.code == 200) {
} else {
uni.showToast({
title: res.errMsg });
}
},
fail: function fail(e) {
console.log('抢单请求 失败');
console.log(e);
} });
} } };exports.default = _default;
......
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