Commit ca2cdb22dc4fcb4e39996f1f16521aa76b97b516

Authored by wangfan
1 parent 16951c28

customer

@@ -76,18 +76,19 @@ App({ @@ -76,18 +76,19 @@ App({
76 async _getLiteOpenidByCode(code){ 76 async _getLiteOpenidByCode(code){
77 return new Promise((success,fail)=>{ 77 return new Promise((success,fail)=>{
78 wx.request({ 78 wx.request({
79 - url: uri_dc.HOST__LINE+'App.Wechat.GetLiteOpenidByCode', 79 + url: uri_dc.HOST__LINE+'App.Reserve.GetLiteOpenid',
80 method: 'POST', 80 method: 'POST',
81 - data: {code:code,appid:'wxd3dc4206c76f14fc'}, 81 + data: {code:code},
82 header: { 82 header: {
83 'content-type': 'application/x-www-form-urlencoded' 83 'content-type': 'application/x-www-form-urlencoded'
84 }, 84 },
85 success: function (res) { 85 success: function (res) {
86 - let openid=JSON.parse(res.data.data[0]).openid; 86 + let openid=res.data.data.openid;
87 wx.setStorage({key:'openid',data:openid}); 87 wx.setStorage({key:'openid',data:openid});
88 success(openid); 88 success(openid);
89 }, 89 },
90 fail: function (res) { 90 fail: function (res) {
  91 + console.log(res);
91 fail(res); 92 fail(res);
92 } 93 }
93 }) 94 })
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 "pages/book/b_add", 5 "pages/book/b_add",
6 "pages/book/b_info", 6 "pages/book/b_info",
7 "pages/book/b_desk", 7 "pages/book/b_desk",
8 - "pages/customer/index" 8 + "pages/customer/index",
  9 + "pages/customer/detail_owner"
9 ], 10 ],
10 "window": { 11 "window": {
11 "backgroundTextStyle": "light", 12 "backgroundTextStyle": "light",
  1 +Component({
  2 + properties:{
  3 + url:String,
  4 + openType:{
  5 + type: String,
  6 + value:'navigate',
  7 + },
  8 + },
  9 + data:{
  10 +
  11 + },
  12 + methods:{
  13 + formSubmit: function(e) {
  14 + console.log('formids',e.detail.formId)
  15 + if("the formId is a mock one"!=e.detail.formId){
  16 + let formids=wx.getStorageSync('formids') || [];
  17 + formids.push(e.detail.formId);
  18 + formids=[...new Set(formids)];
  19 + wx.setStorage({key:'formids',data:formids});
  20 + }
  21 + this.triggerEvent("click");
  22 + if(this.data.url || this.data.openType!='navigate'){
  23 + let obj={url:this.data.url};
  24 + switch (this.data.openType){
  25 + case 'navigate':
  26 + wx.navigateTo(obj)
  27 + break;
  28 + case 'redirect':
  29 + wx.redirectTo(obj)
  30 + break;
  31 + case 'switchTab':
  32 + wx.switchTab(obj)
  33 + break;
  34 + case 'reLaunch':
  35 + wx.reLaunch(obj)
  36 + break;
  37 + case 'navigateBack':
  38 + wx.navigateBack(obj)
  39 + break;
  40 + case 'exit':
  41 + break;
  42 + }
  43 + }
  44 + },
  45 + },
  46 + attached(){
  47 + //console.log('this.data',this.data);
  48 + }
  49 +})
  1 +{
  2 + "component": true
  3 +}
  1 +<form bindsubmit="formSubmit" report-submit>
  2 + <button formType="submit" class="button-none">
  3 + <slot></slot>
  4 + </button>
  5 +</form>
  1 +/* component/cook-class/cook-class.wxss */
  2 +@import '../../app.wxss';
  3 +.button-none {
  4 + display: inline-block;
  5 + padding-left: 0;
  6 + padding-right: 0;
  7 + box-sizing: border-box;
  8 + font-size: inherit;
  9 + text-align: center;
  10 + text-decoration: none;
  11 + line-height: inherit;
  12 + -webkit-tap-highlight-color: transparent;
  13 + color: inherit;
  14 +}
  1 +// component/menu/addDelete.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +
  5 +Component({
  6 + /**
  7 + * 组件的属性列表
  8 + */
  9 + properties: {
  10 + // talkImage: {
  11 + // type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
  12 + // value: '/pages/image/menu-fixed-taomei.png'
  13 + // },
  14 + },
  15 +
  16 + /**
  17 + * 组件的初始数据
  18 + */
  19 + data: {
  20 +
  21 + },
  22 + attached(){
  23 +
  24 + },
  25 + ready () {
  26 +
  27 + },
  28 + detached(){
  29 +
  30 + },
  31 + /**
  32 + * 组件的方法列表
  33 + */
  34 + methods: {
  35 + getUserInfoSuccess(e){
  36 + if(e.type="getuserinfo"){
  37 + if(e.detail.errMsg=='getUserInfo:ok'){
  38 + var userInfo = e.detail.userInfo //avatarUrl nickName gender;
  39 + console.log('xxxxx',userInfo)
  40 +
  41 + App.Reserve.AddUser({
  42 + openid: getApp().openid,
  43 + headerimg: userInfo.avatarUrl,
  44 + nickname: userInfo.nickName,
  45 + gender: userInfo.gender
  46 + })
  47 + this.triggerEvent("userinfo",userInfo);
  48 + }else if(e.detail.errMsg=='getUserInfo:fail auth deny'){
  49 + wx.showModal({
  50 + title:'授权提示',
  51 + content:'您点击了拒绝授权,将无法正常显示个人信息,点击确定重新获取授权',
  52 + confirmColor:'#199095',
  53 + cancelColor:'#999',
  54 + success:function(res){
  55 + if(res.confirm){
  56 + util.setting();
  57 + }
  58 + }
  59 + })
  60 + }
  61 + }
  62 + }
  63 + }
  64 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<button bindgetuserinfo="getUserInfoSuccess" open-type="getUserInfo" class="button-none">
  2 + <slot></slot>
  3 +</button>
  1 +.button-none {
  2 + display: inline-block;
  3 + padding-left: 0;
  4 + padding-right: 0;
  5 + box-sizing: border-box;
  6 + font-size: inherit;
  7 + text-align: center;
  8 + text-decoration: none;
  9 + line-height: inherit;
  10 + -webkit-tap-highlight-color: transparent;
  11 + color: inherit;
  12 +}
  1 +// pages/customer/detail_owner.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad: function (options) {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面初次渲染完成
  20 + */
  21 + onReady: function () {
  22 +
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面显示
  27 + */
  28 + onShow: function () {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面隐藏
  34 + */
  35 + onHide: function () {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面卸载
  41 + */
  42 + onUnload: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 页面相关事件处理函数--监听用户下拉动作
  48 + */
  49 + onPullDownRefresh: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 页面上拉触底事件的处理函数
  55 + */
  56 + onReachBottom: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 用户点击右上角分享
  62 + */
  63 + onShareAppMessage: function () {
  64 +
  65 + }
  66 +})
  1 +{
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTextStyle": "black",
  4 + "navigationBarTitleText":"订座详情"
  5 +}
  1 +<!--pages/customer/detail_owner.wxml-->
  2 +<text>pages/customer/detail_owner.wxml</text>
  1 +/* pages/customer/detail_owner.wxss */
  2 +page{
  3 + width: 94%;
  4 + margin: 0 3%;
  5 +}
@@ -31,13 +31,11 @@ Page({ @@ -31,13 +31,11 @@ Page({
31 return; 31 return;
32 } 32 }
33 let url = 'list'; 33 let url = 'list';
34 - if(opt.fromid){  
35 - App.Reserve.SetRelaOpenid({  
36 - id:opt.id,  
37 - openid:opt.openid,  
38 - fromid:opt.fromid?opt.fromid:''  
39 - })  
40 - } 34 + App.Reserve.SetRelaOpenid({
  35 + id:opt.id,
  36 + openid:opt.openid,
  37 + fromid:opt.fromid?opt.fromid:''
  38 + })
41 if (opt.id > 0) { 39 if (opt.id > 0) {
42 App.Reserve.Detail({ 40 App.Reserve.Detail({
43 openid: opt.openid, 41 openid: opt.openid,
@@ -53,7 +51,9 @@ Page({ @@ -53,7 +51,9 @@ Page({
53 } 51 }
54 url+='?id='+opt.id 52 url+='?id='+opt.id
55 wx.redirectTo({url: url}); 53 wx.redirectTo({url: url});
56 - }).catch() 54 + }).catch(res=>{
  55 + wx.redirectTo({url: url});
  56 + })
57 } else { 57 } else {
58 wx.redirectTo({url: url}); 58 wx.redirectTo({url: url});
59 } 59 }
1 { 1 {
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTextStyle": "black",
  4 + "navigationBarTitleText":"定个座儿",
  5 +
2 "backgroundTextStyle": "light", 6 "backgroundTextStyle": "light",
3 - "navigationBarBackgroundColor": "#4c4e4f",  
4 - "navigationBarTextStyle": "white",  
5 "usingComponents": { 7 "usingComponents": {
6 - "network": "/component/network/network" 8 + "network": "/components/network/network"
7 } 9 }
8 } 10 }
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 "newFeature": true 8 "newFeature": true
9 }, 9 },
10 "compileType": "miniprogram", 10 "compileType": "miniprogram",
11 - "libVersion": "1.9.91", 11 + "libVersion": "2.2.3",
12 "appid": "wxd3dc4206c76f14fc", 12 "appid": "wxd3dc4206c76f14fc",
13 "projectname": "xcx-book", 13 "projectname": "xcx-book",
14 "isGameTourist": false, 14 "isGameTourist": false,
@@ -21,12 +21,16 @@ @@ -21,12 +21,16 @@
21 "current": -1, 21 "current": -1,
22 "list": [] 22 "list": []
23 }, 23 },
  24 + "plugin": {
  25 + "current": -1,
  26 + "list": []
  27 + },
24 "game": { 28 "game": {
25 "currentL": -1, 29 "currentL": -1,
26 "list": [] 30 "list": []
27 }, 31 },
28 "miniprogram": { 32 "miniprogram": {
29 - "current": 0, 33 + "current": 6,
30 "list": [ 34 "list": [
31 { 35 {
32 "id": 0, 36 "id": 0,
@@ -63,6 +67,12 @@ @@ -63,6 +67,12 @@
63 "name": "时间选择", 67 "name": "时间选择",
64 "pathName": "pages/report/r_time", 68 "pathName": "pages/report/r_time",
65 "query": "" 69 "query": ""
  70 + },
  71 + {
  72 + "id": -1,
  73 + "name": "pages/customer/index",
  74 + "pathName": "pages/customer/index",
  75 + "query": "id=61"
66 } 76 }
67 ] 77 ]
68 } 78 }
@@ -73,14 +73,16 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0, @@ -73,14 +73,16 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0,
73 success: function (res) { 73 success: function (res) {
74 console.log('request.api==>',host+cache_key+'\nrequest.success',res.data); 74 console.log('request.api==>',host+cache_key+'\nrequest.success',res.data);
75 // return; 75 // return;
76 - if(cachetime!=0 && res.data.ret==200 && res.data.data.length>0){  
77 - cache(cache_key,res.data,cachetime);//.then().catch();  
78 - }  
79 - if(res.data.ret!==200){  
80 - try{  
81 - res.data.msg=res.data.msg.replace('非法请求:','');  
82 - }catch(e){  
83 - console.log('res-fail',res,e); 76 + if(res.data){
  77 + if(cachetime!=0 && res.data.ret==200 && res.data.data && res.data.data.length>0){
  78 + cache(cache_key,res.data,cachetime);//.then().catch();
  79 + }
  80 + if(res.data.ret!==200){
  81 + try{
  82 + res.data.msg=res.data.msg.replace('非法请求:','');
  83 + }catch(e){
  84 + console.log('res-fail',res,e);
  85 + }
84 } 86 }
85 } 87 }
86 success(res.data); 88 success(res.data);
@@ -15,6 +15,11 @@ export default { @@ -15,6 +15,11 @@ export default {
15 //建立预定关系 15 //建立预定关系
16 'App.Reserve.SetRelaOpenid':{ 16 'App.Reserve.SetRelaOpenid':{
17 cachetime:-1, 17 cachetime:-1,
18 - } 18 + },
  19 +
  20 + //增加顾客信息
  21 + 'App.Reserve.AddUser':{
  22 + cachetime:-1,
  23 + },
19 24
20 } 25 }