123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964 |
- //获取应用实例
- var util = require('../../../utils/util.js');
- var api = require('../../../config/api.js');
- var check = require('../../../utils/check.js');
- var app = getApp();
- const chooseLocation = requirePlugin('chooseLocation');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- gender: '2',
- address: {
- id: 0,
- areaCode: 0,
- address: '',
- name: '',
- tel: '',
- isDefault: 0,
- province: '',
- city: '',
- county: '',
- latitude: '',
- longitude: '',
- addressDetail: '',
- detail: '',
- addressname: '',
- addressName:''
- },
- addressIdSave: '', //新增地址保存
- orderInfo: {
- },
- addressId: '',
- checkedAddress: {
- },
- addressList: [],
- addressShow: false,
- remark: '',
- remarkPopupShow: false,
- remarkList: [
- '上门前提前电话联系',
- '请准时到达',
- '请自带打扫工具',
- '主要打扫厨房&卫生间',
- '家里有宠物'
- ],
- remarkActive: '',
- serviceId: '',
- message: '',
- remarkShow: false,
- addressId: '',
- addressName: '',
- noAppoint: '',
- aftersaleStatus: '',
- orderId: '',
- order: '',
- bookId: '',
- bookCount: 0,
- orderStatusText: '订单服务中',
- activeTab: 1,
- orderBook: {
- status: ''
- },
- orderChannel: 0,
- jzOrderBookDetails: [],
- unusedSerList: [],
- usedSerList: [],
- serList: [],
- choosePopup: false,
- timeList: [],
- // dateList: util.getDateList(new Date(new Date().getTime() + 60 * 60 * 1000 * 24 * 0), 1, 30),
- dateList:[],
- timeIndex: '',
- //选中的时间段
- dateIndex: 0, //选中的日期
- appointDate: '', //显示信息
- isHide: false,
- product: {
- serviceTimes: '',
- price: ''
- },
- noonType: 1,
- selectTimeValue: '',
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.log(options);
- if (options.serviceId) {
- this.setData({
- serviceId: options.serviceId
- });
- }
- if (options.orderId) {
- this.setData({
- orderId: options.orderId
- });
- }
- // this.getOrderDetail();
- // this.getServiceDetail();
- app.globalData.mapSelectFinish = false;
- },
- getOrderDetail: function () {
- wx.showLoading({
- title: '加载中'
- });
- setTimeout(function () {
- wx.hideLoading();
- }, 2000);
- util.request(api.OrderDetail, {
- orderId: this.data.orderId
- }).then(res => {
- if (res.errno === 0) {
- wx.hideLoading();
- console.log(res.data);
- console.log(res.data);
- // let data=res.data;
- // 抖音数据结构如下
- let data={actualPrice: 0.01,
- addressId: 0,
- afterSale: null,
- afterSaleStatus: 0,
- applicableTemplate: 1,
- appointmentTimes: 0,
- canReverse: null,
- createTime: "2023-06-14 10:37:47",
- customerServiceReminder: null,
- detailId: 5168,
- discountPrice: 0,
- dyDetails: [],
- goodsId: "1190590",
- goodsName: "保洁3小时(专用)",
- handleOption: {aftersale: true,
- book: true,
- cancel: false,
- comment: false,
- confirm: false,
- delete: false,
- pay: false,
- rebuy: true,
- refund: true},
- id: 2516816,
- increaseSumPrice: null,
- message: "",
- orderChannel: 26,
- orderPrice: 0.01,
- orderSn: "20230614396755",
- orderStatus: 204,
- orderStatusVal: "待预约",
- orderType: 0,
- payChannel: "抖音",
- payId: "TP2023061410374621561507996489",
- payOverTime: null,
- payTime: "2023-06-14 10:38:05",
- picUrl: "https://uat.jzmall.lifejingzhi.com/wx/storage/fetch/fwqc8sajbjhkg6o2b6i8.jpg",
- productId: "2167",
- servedTimes: 0,
- serviceDuration: 3,
- serviceTimes: 1,
- shopTel: "",
- skuName: "保洁3小时",
- ticketStatus: null,
- unitArea: "m2",
- unitDescribe: "新居开荒",
- unitIncreaseNumber: 0,
- updateTime: "2023-06-14 10:38:07",
- userId: 931354,
- }
- this.setData({
- orderInfo: data,
- addressId: data.addressId,
- dyDetails: data.dyDetails,
- afterSale: data.afterSale,
- payOverTime: data.payOverTime,
- remainTimes: data.serviceTimes - data.servedTimes,
- // orderGoods: res.data.orderGoods,
- // handleOption: res.data.orderInfo.handleOption,
- // expressInfo: res.data.expressInfo
- });
-
- if (data.addressId) {
- this.getAddressList();
- }
- }
- });
- },
- getAddressList() {
- util.request(api.AddressList).then(res => {
- if (res.errno === 0) {
- this.setData({
- addressList: res.data.list,
- });
- let current = this.data.addressList.filter(item => {
- return item.id == this.data.addressId
- });
- if (current.length > 0) {
- this.setData({
- checkedAddress: current[0]
- });
- }
- }
- });
- },
- onShow: function () {
- // var addressId = wx.getStorageSync('addressId');
- // if (addressId === "") {
- // addressId = 0;
- // }
- // console.info(addressId);
- // var addressName = wx.getStorageSync('addressName');
- // if (addressName === "") {
- // addressName = "还没有服务地址,去添加";
- // }
- // console.info(addressName);
- // this.setData({
- // addressId: addressId,
- // addressName: addressName
- // })
- // console.info(this.data.addressName);
- this.getOrderDetail();
- if (app.globalData.mapSelectFinish) {
- let poi = app.globalData.mapSelectPoi;
- let location = poi.location;
- let address = this.data.address;
- address.lng = location.split(',')[0];
- address.lat = location.split(',')[1];
- address.addressname = poi.address;
- this.setData({
- address: address,
- // selectAddress:poi.address
- });
- console.log(this.data.address);
- this.getAreaCode();
- }
- // const location = chooseLocation.getLocation();
- // console.log(location);
- // if (location != null) {
- // let address = this.data.address;
- // address.province = location.province ? location.province : location.city;
- // address.city = location.city;
- // address.county = location.district;
- // address.addressName = location.name;
- // address.address = location.address;
- // address.lat = location.latitude;
- // address.lng = location.longitude;
- // this.setData({
- // address: address,
- // });
- // this.getAreaCode()
- // }
- },
- getServiceDetail: function () {
- util.request(api.ServiceDetail, {
- order_id: this.data.orderId
- }).then(res => {
- if (res.errno === 0) {
- let jzOrderBookDetails = res.data.jzOrderBookDetails;
- let unusedSerList = jzOrderBookDetails.filter(item => {
- return item.status === 0 || item.status == 1;
- });
- let usedSerList = jzOrderBookDetails.filter(item => {
- return item.status == 3 || item.status == 4;
- });
- this.setData({
- aftersaleStatus: res.data.order ? res.data.order.aftersaleStatus : '',
- noAppoint: res.data.noAppoint,
- goods: res.data.goods,
- orderBook: res.data.orderBook,
- jzOrderBookDetails: jzOrderBookDetails,
- activeTab: 1,
- unusedSerList: unusedSerList,
- usedSerList: usedSerList,
- serList: unusedSerList,
- orderChannel: res.data.orderChannel,
- addressId: res.data.order.addressId,
- addressName: res.data.order.address,
- mobile: res.data.order.mobile,
- product: res.data.product
- });
- }
- });
- },
- showAppoint(e) {
- // let status = e.currentTarget.dataset.status;
- // if (status == 1) {
- // let time = e.currentTarget.dataset.time;
- // let str = time.substr(0, 16).replace(/-/g, '/');
- // let isNear = new Date(str).getTime() - new Date().getTime() - 2 * 60 * 60 * 1000;
- // console.log(isNear);
- // if (isNear < 0) {
- // wx.showToast({
- // title: '服务时间小于2小时,不能修改预约',
- // icon: 'none',
- // duration: 2000
- // });
- // return false;
- // }
- // }
- // if (this.data.order.aftersaleStatus == 1 || this.data.order.aftersaleStatus == 2) {
- // util.showErrorToast("退款中,无法预约");
- // return;
- // }
- // console.info(this.data.addressName)
- // if (this.data.addressId == 0||this.data.addressName==null||this.data.addressName=='') {
- // util.showErrorToast("请输入服务地址");
- // return;
- // }
- if(this.data.appointDate!=''){
- this.setData({
- choosePopup: true,
- });
- return false;
- }else{
- this.setData({
- choosePopup: true,
- noonType:1,
- timeIndex: 0
- });
- let params = {
- days:30,
- // orderBookId:this.data.bookId,
- bookId:this.data.serviceId,
- goodsId: this.data.orderInfo.goodsId,
- serviceDuration: this.data.orderInfo.serviceDuration
- }
- this.getDayTime(params);
- }
-
- // this.setData({
- // choosePopup: true,
- // noonType: 1,
- // timeIndex: 0
- // });
-
- // if (this.data.dateList[this.data.dateIndex].name == '今天' ) {
- // this.setData({
- // noonType: 2,
- // })
- // }
- // this.getTimeList();
- },
- getTimeList() {
- let timeList = util.getBeginTimeList(this.data.orderInfo.serviceDuration, this.data.noonType, this.data.dateList[this.data.dateIndex].name);
- this.setData({
- timeList: timeList,
- selectTimeValue: timeList.length == 0 ? '' : timeList[0].value
- });
- if(this.data.timeList.length==0){
- this.setData({
- timeIndex:''
- });
- }
- },
- getDayStock() {
- if (this.data.dateIndex < 0) {
- return false;
- }
- let params = {
- day: this.data.dateList[this.data.dateIndex].date,
- goodsId: this.data.orderInfo.goodsId,
- addressId: this.data.addressId == 0 ? this.data.addressIdSave : this.data.checkedAddress.id,
- productId: this.data.orderInfo.productId,
- orderId: this.data.orderInfo.id,
- serviceDuration: this.data.orderInfo.serviceDuration
- };
- wx.showLoading({
- title: '加载中'
- });
- util.request(api.EveryDayStock, params, "GET").then(res => {
- wx.hideLoading();
- if (res.errno == 0) {
- this.setData({
- timeList: res.data
- });
- let validList = this.data.timeList.filter(item => {
- return item.stock > 0;
- });
- if (validList.length > 0) {
- this.setData({
- timeIndex: validList[0].id - 1
- });
- } else {
- this.setData({
- timeIndex: ''
- });
- }
- } else {
- wx.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- });
- this.setData({
- timeList: [],
- timeIndex: ''
- });
- }
- }).catch(err=> {
- console.log(err);
- wx.hideLoading();
- wx.showToast({
- title: err.errMsg,
- icon: 'none'
- });
- this.setData({
- timeList: [],
- timeIndex: ''
- });
- });
- },
- onClose() {
- this.setData({
- choosePopup: false
- });
- },
- getDayTime(params) {
-
- wx.showLoading({
- title: '加载中',
- });
- util.request(api.everyDayTime, params, "GET")
- .then(res => {
- wx.hideLoading();
- if (res.errno == 0) {
- this.setData({
- dateList: res.data,
- dateIndex:0,
- timeIndex: -1,
- noonType:1
- });
- let period=res.data[0].period;
- let list=period.filter(item=>{
- return item.ofTime=='上午';
- });
- this.setData({
- timeList:list
- });
-
- } else {
- wx.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- });
- this.setData({
- timeList: [],
- timeIndex: ''
- });
- }
- }).catch(err=> {
- console.log(err);
- wx.hideLoading();
- wx.showToast({
- title: err.errMsg,
- icon: 'none'
- });
- this.setData({
- timeList: [],
- timeIndex: ''
- });
- });
- },
- dateCheck(e) {
- let index = e.currentTarget.dataset.index;
- let date = e.currentTarget.dataset.date;
- let week = e.currentTarget.dataset.week;
- let isbook = e.currentTarget.dataset.isbook;
- this.setData({
- dateIndex: index
- });
- let period=this.data.dateList[this.data.dateIndex].period;
- let current=(this.data.noonType==1?'上午':'下午');
- let list=period.filter(item=>{
- return item.ofTime==current;
- });
- this.setData({
- timeList:list
- });
- let isNoTime=list.every(item=>{
- return item.timeMsg&&item.timeMsg!=null;
- });
- if(isNoTime){
- this.setData({
- timeIndex:-1,
- selectTimeValue:''
- });
- }
-
- // let dateName = this.data.dateList[this.data.dateIndex].name;
- // this.setData({
- // dateIndex: index
- // });
- // let curDateName = this.data.dateList[this.data.dateIndex].name;
- // if ((curDateName == '今天') || ((new Date()).getHours() >18&&curDateName == "明天")) {
- // this.setData({
- // noonType: 2
- // })
- // }
- // this.getTimeList();
-
- },
- timeCheck(e) {
- let index = e.currentTarget.dataset.index;
- // if (e.currentTarget.dataset.stock == 0) {
- // wx.showToast({
- // title: '所选时间无库存,请选择其他时间',
- // icon: 'none',
- // duration: 2000
- // });
- // return;
- // }
- let msg=e.currentTarget.dataset.msg;
- if (msg==null||msg=='') {
- let time= (this.data.timeList[index].begin).split(':')[0];
- this.setData({
- timeIndex: index,
- selectTimeValue: Number(time)
- });
- }
- // this.setData({
- // timeIndex: index,
- // selectTimeValue: this.data.timeList[index].value
- // });
- },
- submitBook() { //提交预约
- if (this.data.addressId == '' && this.data.addressIdSave == '') {
- util.showErrorToast("请输入服务地址");
- return;
- }
- if (this.data.timeIndex === ''||this.data.timeIndex<0) {
- util.showErrorToast("请选择服务时间");
- return false;
- }
- // if (this.data.mobile == null || this.data.mobile.length != 11) {
- // util.showErrorToast("请填写手机号码");
- // return;
- // }
-
- let date = this.data.dateList[this.data.dateIndex].bookdate;
- let week = this.data.dateList[this.data.dateIndex].weekOfDay;
- let time = this.data.timeList[this.data.timeIndex].begin+'-'+this.data.timeList[this.data.timeIndex].end;
- console.log(date, week, time);
- let params = {
- detail_id: this.data.serviceId ? this.data.serviceId : this.data.orderId,
- // bookId: this.data.bookId,
- date: date,
- startTime: time.split('-')[0],
- endTime: time.split('-')[1],
- addressId: this.data.addressId == 0 ? this.data.addressIdSave : this.data.checkedAddress.id,
- // orderId: this.data.orderId,
- remark: this.data.remark + this.data.message
- };
- console.info(params);
- wx.showLoading({
- title: '加载中...'
- });
- util.request(api.ServiceOrderBookV2, params, "GET").then(res => {
- if (res.errno == 0) {
- wx.hideLoading();
- this.setData({
- isHide: true
- });
- wx.showToast({
- title: '预约成功',
- icon: 'none',
- duration: 2000
- });
- setTimeout(() => {
- wx.navigateTo({
- url: "/pages/ucenter/orderDetail/orderDetail?id=" + this.data.orderId
- });
- }, 2000);
- } else {
- wx.showToast({
- title: res.errmsg,
- icon: 'none'
- });
- // util.showErrorToast(res.errmsg);
- }
- }).catch(err=>{
-
- });
- },
- confirmTime() {
- if (this.data.timeIndex === ''||this.data.timeIndex<0) {
- util.showErrorToast('请选择服务时间');
- return false;
- }
- let date = this.data.dateList[this.data.dateIndex].bookdate;
- let week = this.data.dateList[this.data.dateIndex].weekOfDay;
- let time = this.data.timeList[this.data.timeIndex].begin+'-'+this.data.timeList[this.data.timeIndex].end;
- this.setData({
- choosePopup: false,
- appointDate: date + ' ' + week + ' ' + time
- });
- },
- selectAddress() {
- //已经输入过地址的订单 不允许再次选择地址
- if (this.data.order.addressId > 0) return;
- wx.navigateTo({
- url: '/pages/ucenter/address/address'
- });
- },
- showRemark() {
- this.setData({
- remarkShow: true
- });
- },
- onRemarkClose() {
- this.setData({
- remarkShow: false
- });
- },
- confirmRemark() {
- this.setData({
- remarkShow: false
- });
- },
- bindMessageInput: function (e) {
- this.setData({
- message: e.detail.value
- });
- },
- bindPhone(e) {
- this.setData({
- mobile: e.detail.value
- })
- },
- copyOrder() {
- wx.setClipboardData({
- data: this.data.orderInfo.orderSn,
- success: function (res) {
- wx.getClipboardData({
- success: function (res) {
- wx.showToast({
- title: '订单编号复制成功',
- icon: 'success',
- duration: 2000
- });
- }
- });
- }
- });
- },
- onAddressClose() {
- this.setData({
- addressShow: false
- })
- },
- onAddressClick() {
- //阻止事件冒泡,不要删
- },
- addressConfirm(e) {
- let address = e.currentTarget.dataset.address;
- this.setData({
- checkedAddress: address,
- addressShow: false
- });
- },
- addressSelect() {
- this.setData({
- addressShow: true
- });
- },
- showRemarkSelect() {
- this.setData({
- remarkPopupShow: true
- });
- },
- onRemarkPopupClose() {
- this.setData({
- remarkPopupShow: false
- })
- },
- onRemarkClick() {
- //阻止事件冒泡,不要删
- },
- remarkItemSelect(e) {
- let remark = e.currentTarget.dataset.remark;
- this.setData({
- remark: remark,
- remarkActive: remark,
- });
- },
- remarkItemConfirm() {
- if (this.data.remarkActive === '') {
- util.showErrorToast("请选择备注");
- return false;
- }
- this.setData({
- remarkPopupShow: false
- });
- },
- bindinputMobile(event) {
- let address = this.data.address;
- address.tel = event.detail.value;
- this.setData({
- address: address
- });
- },
- bindinputName(event) {
- let address = this.data.address;
- address.name = event.detail.value;
- this.setData({
- address: address
- });
- },
- bindinputAddress(event) {
- let address = this.data.address;
- address.detail = event.detail.value.replace(/[,,]/g, '');
- this.setData({
- address: address
- });
- // return value.replace(/[,,]/g,'');
- },
- bindAddressDetail(event) {
- let address = this.data.address;
- address.addressname = event.detail.value.replace(/[,,]/g, '');
- this.setData({
- address: address
- });
- },
- submitAll() {
- if (this.data.addressId == '' && this.data.addressIdSave == '') {
- this.saveAddress();
- } else {
- this.submitBook();
- }
- },
- async saveAddress() {
- console.log(this.data.address);
- let address = this.data.address;
- // if (address.addressname == 0) {
- // util.showErrorToast('请选择服务地址');
- // return false;
- // }
- if (address.addressName == '') {
- util.showErrorToast('请选择服务地址');
- return false;
- }
- if (address.detail == '') {
- util.showErrorToast('请输入门牌号');
- return false;
- }
- if (address.name == '') {
- util.showErrorToast('请输入姓名');
- return false;
- }
-
- if (this.data.gender == null || this.data.gender == '') {
- util.showErrorToast('请选择性别');
- return false;
- }
- if (address.tel == '') {
- util.showErrorToast('请输入手机号码');
- return false;
- }
- if (!check.isValidPhone(address.tel)) {
- util.showErrorToast('手机号不正确');
- return false;
- }
- let that = this;
- let addressString = address.detail == '' ? address.addressName : address.addressName + ',' + address.detail;
- wx.showLoading({
- title: '加载中...'
- });
- let res = await util.request(api.AddressSave, {
- // gender: this.data.gender,
- id: address.id,
- name: address.name,
- tel: address.tel,
- province: address.province,
- city: address.city,
- county: address.county,
- areaCode: address.areaCode,
- addressDetail: addressString,
- isDefault: address.isDefault,
- lat: Number(address.lat).toFixed(5),
- lng: Number(address.lng).toFixed(5),
- shopId: app.globalData.shopId ? app.globalData.shopId : '',
- addressName: address.addressName,
- }, 'POST');
- wx.hideLoading();
- if (res.errno === 0) {
- that.setData({
- addressIdSave: res.data.id
- })
- that.submitBook();
- } else {
- wx.showModal({
- title: '提醒',
- showCancel: false,
- content: res.errmsg
- });
- }
- },
- goMapOld() {
- // const key = "JA2BZ-XGOEU-UNZVD-46G64-S6MYJ-6BBF4";
- //使用在腾讯位置服务申请的key
- const key = '6TRBZ-XXC6F-BWWJB-N75ME-BQNOF-YKFQY';
- const referer = '鲸致生活LifePlus'; //调用插件的app的名称
- const category = '小区,生活服务,娱乐休闲';
- if (this.data.address.lat) {
- const location = JSON.stringify({
- latitude: Number(this.data.address.lat),
- longitude: Number(this.data.address.lng)
- });
- wx.navigateTo({
- url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&category=' + category + '&location=' + location
- });
- } else
- wx.navigateTo({
- url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&category=' + category
- });
- },
- goMap() {
- console.log('gomap');
- app.globalData.mapSelectFinish = false;
- // wx.navigateTo({
- // url: '/pages/map/mapContent/mapContent',
- // });
- if (this.data.address.lng && this.data.address.lat) {
- let city = (this.data.address.city == '市辖区' ? this.data.address.province : this.data.address.city)
- wx.navigateTo({
- url: '/pages/map/mapContent/mapContent?lng=' + this.data.address.lng + '&lat=' + this.data.address.lat + '&addressname=' + this.data.address.addressname + '&city=' + city,
- });
- } else {
- wx.navigateTo({
- url: '/pages/map/mapContent/mapContent',
- });
- }
- },
- maleSelect() {
- this.setData({
- gender: 1
- });
- },
- femaleSelect() {
- this.setData({
- gender: 2
- });
- },
- getAreaCode() {
- let param = {
- key: '6TRBZ-XXC6F-BWWJB-N75ME-BQNOF-YKFQY',
- location: this.data.address.lat + ',' + this.data.address.lng
- };
- wx.request({
- url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=',
- data: param,
- method: 'GET',
- header: {
- 'Content-Type': 'application/json',
- 'X-DOUYIN-Token': wx.getStorageSync('token')
- },
- success: res => {
- console.log(res);
- if (res.statusCode == 200) {
- if (res.data.status == 0) {
- let ad_info = res.data.result.ad_info;
- let areaCode = res.data.result.ad_info.adcode;
- this.setData({
- ['address.areaCode']: areaCode,
- ['address.province']: ad_info.province,
- ['address.city']: ad_info.city,
- ['address.county']: ad_info.district,
- // ['address.addressname']:res.data.result.address
- });
- } else {
- wx.showToast({
- title: '获取地区码失败',
- icon: 'none',
- duration: 3000
- });
- }
- } else {
- wx.showToast({
- title: '获取地区码失败',
- icon: 'none',
- duration: 3000
- });
- }
- },
- fail: function (err) {
- reject(err);
- }
- });
- },
- goAddAddress() {
- wx.navigateTo({
- url: '/pages/ucenter/addressAdd/addressAdd?id=' + 0
- });
- },
- noonTab(e) {
- let noon=e.currentTarget.dataset.noon;
-
- this.setData({
- timeIndex: -1,
- noonType: noon,
- selectTimeValue:'',
- });
- let period=this.data.dateList[this.data.dateIndex].period;
- let current=(this.data.noonType==1?'上午':'下午');
- let list=period.filter(item=>{
- return item.ofTime==current;
- });
- this.setData({
- timeList:list
- });
- }
- });
|