Commit 6bfb418fef63acd58c342fb00c1c0c1f85a1cdcd

Authored by zhangyan
0 parents

no message

Showing 74 changed files with 3897 additions and 0 deletions
  1 +App({
  2 +
  3 +})
  1 +{
  2 + "pages":[
  3 +
  4 + "pages/book/b_index",
  5 + "pages/book/b_detail",
  6 + "pages/book/b_add",
  7 + "pages/book/b_info",
  8 + "pages/book/b_desk"
  9 +
  10 + ],
  11 + "window":{
  12 + "backgroundTextStyle":"light",
  13 + "navigationBarBackgroundColor": "#199095",
  14 + "navigationBarTitleText": "点餐商户端",
  15 + "navigationBarTextStyle":"light"
  16 + },
  17 + "networkTimeout": {
  18 + "request": 10000,
  19 + "downloadFile": 10000
  20 + },
  21 + "debug": true
  22 +
  23 +}
  1 +/*水平方向左右分布*/
  2 +.flex-lr{
  3 + display: flex;
  4 + display: -webkit-flex;
  5 + justify-content: space-between;
  6 + align-items:center;
  7 + flex-direction: row;
  8 + -webkit-flex-direction: row;
  9 +}
  10 +.flex-ll{
  11 + display: flex;
  12 + display: -webkit-flex;
  13 + justify-content: flex-start;
  14 + align-items: center;
  15 + flex-direction: row;
  16 + -webkit-flex-direction: row;
  17 +}
  18 +.flex-rr{
  19 + display: flex;
  20 + display: -webkit-flex;
  21 + justify-content: flex-end;
  22 + align-items: center;
  23 + flex-direction: row;
  24 + -webkit-flex-direction: row;
  25 +}
  26 +/*垂直方向居中分布*/
  27 +.flex-vc{
  28 + display: flex;
  29 + display: -webkit-flex;
  30 + justify-content: center;
  31 + align-items: center;
  32 + flex-direction: column;
  33 + -webkit-flex-direction: column;
  34 +}
  35 +/*垂直方向居左分布*/
  36 +.flex-vl{
  37 + display: flex;
  38 + display: -webkit-flex;
  39 + justify-content: flex-start;
  40 + align-items: left;
  41 + flex-direction: column;
  42 + -webkit-flex-direction: column;
  43 +}
  44 +.flex-vr{
  45 + display: flex;
  46 + display: -webkit-flex;
  47 + justify-content: flex-end;
  48 + align-items: center;
  49 + flex-direction: column;
  50 + -webkit-flex-direction: column;
  51 +}
  52 +/*水平方向居中分布*/
  53 +.flex-cc{
  54 + display: flex;
  55 + display: -webkit-flex;
  56 + justify-content: center;
  57 + align-items: center;
  58 + flex-direction: row;
  59 + -webkit-flex-direction: row;
  60 +}
  61 +/*基准线对齐*/
  62 +.flex-bc{
  63 + display: flex;
  64 + display: -webkit-flex;
  65 + justify-content: center;
  66 + align-items: baseline;
  67 + flex-direction: row;
  68 + -webkit-flex-direction: row;
  69 +}
  70 +/*流式布局*/
  71 +.flex-auto{
  72 + display: flex;
  73 + display: -webkit-flex;
  74 + justify-content: space-around;
  75 + align-content: flex-start;
  76 + flex-flow:wrap;
  77 +}
  78 +.font34r{
  79 + font-size:34rpx;
  80 +}
  81 +.font28r{
  82 + font-size:28rpx;
  83 +}
  84 +.font30r{
  85 + font-size:30rpx;
  86 +}
  87 +.font32r{
  88 + font-size:32rpx;
  89 +}
  90 +.font26r{
  91 + font-size:26rpx;
  92 +}
  93 +.font24r{
  94 + font-size:24rpx;
  95 +}
  96 +.font38r{
  97 + font-size:38rpx;
  98 +}
  99 +.font40r{
  100 + font-size:40rpx;
  101 +}
  102 +.font44r{
  103 + font-size:44rpx;
  104 +}
  105 +.font20r{
  106 + font-size:20rpx;
  107 +}
  108 +.black-font{
  109 + color:#353535;
  110 +}
  111 +.white-font{
  112 + color:#fff;
  113 +}
  114 +.green-font{
  115 + color:#199095;
  116 +}
  117 +.flex-rc{
  118 + display:flex;
  119 + display: -webkit-flex;
  120 + justify-content:center;
  121 + align-items:center;
  122 +}
  123 +.flex-rs{
  124 + display:flex;
  125 + display: -webkit-flex;
  126 + justify-content:flex-start;
  127 + align-items:center;
  128 + flex-direction: row;
  129 + flex-wrap:wrap;
  130 +}
  131 +.flex-cmc{
  132 + display:flex;
  133 + display: -webkit-flex;
  134 + justify-content:center;
  135 + align-items:center;
  136 + flex-direction: column;
  137 +}
  138 +.flex-re{
  139 + display:flex;
  140 + display: -webkit-flex;
  141 + justify-content:flex-end;
  142 +}
  143 +.default-setting{
  144 + color:#999;
  145 + font-size:38rpx;
  146 + -webkit-font-smoothing: antialiased;
  147 + -moz-osx-font-smoothing: grayscale;
  148 +}
  149 +.cut{
  150 + width:100%;
  151 + height:20rpx;
  152 +}
  153 +.smooth{
  154 + -webkit-font-smoothing: antialiased;
  155 + -moz-osx-font-smoothing: grayscale;
  156 +}
  157 +button::after{
  158 + border:0;
  159 +}
  160 +.font-bold{
  161 + font-weight:bold;
  162 +}
  163 +.font-more{
  164 + overflow:hidden;
  165 + text-overflow:ellipsis;
  166 + white-space:nowrap;
  167 +}
  168 +.font-more-two{
  169 + display: -webkit-box;
  170 + -webkit-box-orient: vertical;
  171 + -webkit-line-clamp: 2;
  172 + overflow: hidden;
  173 +}
  174 +image{
  175 + background:transparent;
  176 +}
  177 +.gray-font{
  178 + color:#999;
  179 +}
  180 +.gray-deep-font{
  181 + color:#666;
  182 +}
  183 +.icon12-22{
  184 + width:12rpx;
  185 + height:22rpx;
  186 + background:transparent;
  187 +
  188 +}
  189 +.bg_white{
  190 + background:#fff;
  191 +}
  192 +.bg_green{
  193 + background:#199095;
  194 +}
  195 +.bg_gray{
  196 + background:#efeef3;
  197 +}
  198 +.font-siny{
  199 + font-weight:300;
  200 +}
  201 +.cut{
  202 + width:100%;
  203 + height:20rpx;
  204 +}
  205 +.border-right{
  206 + border-right:1px solid #efeef3;
  207 +}
  1 +var util = require('../../../utils/util.js')
  2 +var uri=require('../../../utils/uri.js');
  3 +var systemInfo=util.getsystem();
  4 +Component({
  5 + properties:{
  6 +
  7 + },
  8 + data:{
  9 + height:systemInfo.windowHeight
  10 +
  11 + },
  12 + methods:{
  13 + addBook:function(){
  14 + wx.navigateTo({
  15 + url:'/pages/book/b_add'
  16 + })
  17 + }
  18 + }
  19 +})
  1 +{
  2 + "component": true
  3 +}
  1 +<view class="fixed-button white-font font34r flex-lr smooth">
  2 + <view class="book-button flex-cc">查空位</view>
  3 + <view class="book-button flex-cc" bindtap="addBook">录入订座</view>
  4 +</view>
  1 +@import '../common.wxss';
  2 +.fixed-button{
  3 + width:700rpx;
  4 + height:85rpx;
  5 + margin:0 auto;
  6 + position:fixed;
  7 + left:0;
  8 + right:0;
  9 + bottom:60rpx;
  10 + padding-top:40rpx;
  11 + background:transparent;
  12 +}
  13 +.book-button{
  14 + width:320rpx;
  15 + height:100%;
  16 + background:#199095;
  17 + border-radius:10rpx;
  18 +}
  1 +.font34r{
  2 + font-size:34rpx;
  3 +}
  4 +.font28r{
  5 + font-size:28rpx;
  6 +}
  7 +.font30r{
  8 + font-size:30rpx;
  9 +}
  10 +.font32r{
  11 + font-size:32rpx;
  12 +}
  13 +.font26r{
  14 + font-size:26rpx;
  15 +}
  16 +.font24r{
  17 + font-size:24rpx;
  18 +}
  19 +.font36r{
  20 + font-size:36rpx;
  21 +}
  22 +.font38r{
  23 + font-size:38rpx;
  24 +}
  25 +.font40r{
  26 + font-size:40rpx;
  27 +}
  28 +.font44r{
  29 + font-size:44rpx;
  30 +}
  31 +.font72r{
  32 + font-size:72rpx;
  33 +}
  34 +.black-font{
  35 + color:#353535;
  36 +}
  37 +.white-font{
  38 + color:#fff;
  39 +}
  40 +.green-font{
  41 + color:#199095;
  42 +}
  43 +.flex-rc{
  44 + display:flex;
  45 + display: -webkit-flex;
  46 + justify-content:center;
  47 + align-items:center;
  48 +}
  49 +.flex-rs{
  50 + display:flex;
  51 + display: -webkit-flex;
  52 + justify-content:flex-start;
  53 + align-items:center;
  54 + flex-direction: row;
  55 + flex-wrap:wrap;
  56 +}
  57 +.flex-cmc{
  58 + display:flex;
  59 + display: -webkit-flex;
  60 + justify-content:center;
  61 + align-items:center;
  62 + flex-direction: column;
  63 +}
  64 +.flex-re{
  65 + display:flex;
  66 + display: -webkit-flex;
  67 + justify-content:flex-end;
  68 +}
  69 +/*水平方向左右分布*/
  70 +.flex-lr{
  71 + display: flex;
  72 + display: -webkit-flex;
  73 + justify-content: space-between;
  74 + align-items:center;
  75 + flex-direction: row;
  76 + -webkit-flex-direction: row;
  77 +}
  78 +.flex-ll{
  79 + display: flex;
  80 + display: -webkit-flex;
  81 + justify-content: flex-start;
  82 + align-items: center;
  83 + flex-direction: row;
  84 + -webkit-flex-direction: row;
  85 +}
  86 +.flex-rr{
  87 + display: flex;
  88 + display: -webkit-flex;
  89 + justify-content: flex-end;
  90 + align-items: center;
  91 + flex-direction: row;
  92 + -webkit-flex-direction: row;
  93 +}
  94 +/*垂直方向居中分布*/
  95 +.flex-vc{
  96 + display: flex;
  97 + display: -webkit-flex;
  98 + justify-content: center;
  99 + align-items: center;
  100 + flex-direction: column;
  101 + -webkit-flex-direction: column;
  102 +}
  103 +/*垂直方向居左分布*/
  104 +.flex-vl{
  105 + display: flex;
  106 + display: -webkit-flex;
  107 + justify-content: flex-start;
  108 + align-items: left;
  109 + flex-direction: column;
  110 + -webkit-flex-direction: column;
  111 +}
  112 +.flex-vr{
  113 + display: flex;
  114 + display: -webkit-flex;
  115 + justify-content: flex-end;
  116 + align-items: center;
  117 + flex-direction: column;
  118 + -webkit-flex-direction: column;
  119 +}
  120 +/*水平方向居中分布*/
  121 +.flex-cc{
  122 + display: flex;
  123 + display: -webkit-flex;
  124 + justify-content: center;
  125 + align-items: center;
  126 + flex-direction: row;
  127 + -webkit-flex-direction: row;
  128 +}
  129 +/*基准线对齐*/
  130 +.flex-bc{
  131 + display: flex;
  132 + display: -webkit-flex;
  133 + justify-content: center;
  134 + align-items: baseline;
  135 + flex-direction: row;
  136 + -webkit-flex-direction: row;
  137 +}
  138 +/*流式布局*/
  139 +.flex-auto{
  140 + display: flex;
  141 + display: -webkit-flex;
  142 + justify-content: space-around;
  143 + align-content: flex-start;
  144 + flex-flow:wrap;
  145 +}
  146 +.cut{
  147 + width:100%;
  148 + height:20rpx;
  149 +}
  150 +.smooth{
  151 + -webkit-font-smoothing: antialiased;
  152 + -moz-osx-font-smoothing: grayscale;
  153 +}
  154 +button::after{
  155 + border:0;
  156 +}
  157 +.font-bold{
  158 + font-weight:bold;
  159 +}
  160 +.font-more{
  161 + overflow:hidden;
  162 + text-overflow:ellipsis;
  163 + white-space:nowrap;
  164 +}
  165 +.font-more-two{
  166 + display: -webkit-box;
  167 + -webkit-box-orient: vertical;
  168 + -webkit-line-clamp: 2;
  169 + overflow: hidden;
  170 +}
  171 +image{
  172 + background:transparent;
  173 +}
  174 +.gray-font{
  175 + color:#999;
  176 +}
  177 +.gray-deep-font{
  178 + color:#666;
  179 +}
  180 +.icon12-22{
  181 + width:12rpx;
  182 + height:22rpx;
  183 + background:transparent;
  184 +}
  185 +.bg-white{
  186 + background:#fff;
  187 +}
  188 +.green-font{
  189 + color:#199095;
  190 +}
  191 +.font-more{
  192 + overflow:hidden;
  193 + text-overflow:ellipsis;
  194 + white-space:nowrap;
  195 +}
  196 +button{
  197 + margin:0;
  198 + padding:0;
  199 + background:transparent;
  200 +}
  1 +var util = require('../../../utils/util.js')
  2 +var uri=require('../../../utils/uri.js');
  3 +Component({
  4 + properties:{
  5 + list:Array
  6 + },
  7 + data:{
  8 +
  9 + },
  10 + methods:{
  11 + selectdesk:function(e){
  12 + var tebleid=e.currentTarget.dataset.id;
  13 + var tables=util.cache('tableid') ? util.cache('tableid') : [];
  14 + var list=this.data.list;
  15 + list.forEach(function(v,i){
  16 + if(v.id==tebleid){
  17 + if(v.isselect==true){
  18 + var thisindex=tables.indexOf(tebleid);
  19 + tables.splice(thisindex,1)
  20 + }else{
  21 + tables.push(tebleid)
  22 + }
  23 + v.isselect=!v.isselect
  24 + }
  25 + })
  26 + util.cache('tableid',tables);
  27 + this.triggerEvent("changedesk");
  28 + this.setData({
  29 + list:list
  30 + })
  31 + }
  32 + }
  33 +})
  1 +{
  2 + "component": true
  3 +}
  1 +<view class="desk-list flex-rs">
  2 + <block wx:for="{{list}}">
  3 + <block wx:if="{{!item.r_status}}">
  4 + <view class="desk-single flex-vc green-deep-bg desk-can black-font" data-id="{{item.id}}" bindtap="selectdesk">
  5 + <view class="font38r font-bold desk-name flex-cc font-more">{{item.name}}</view>
  6 + <view class="font34r desk-pnum flex-cc">{{item.table_pnum}}人桌</view>
  7 + <view class="desk-mask {{item.isselect==true ? 'desk-mask-active white-font flex-vc font24r' : ''}}">
  8 + <block wx:if="{{item.isselect==false}}">
  9 + <icon type="success_no_circle" class="icon-success" color="#fff" size="13"></icon>
  10 + </block>
  11 + <block wx:else>
  12 + {{index+1}}
  13 + </block>
  14 + </view>
  15 + </view>
  16 + </block>
  17 + <block wx:if="{{item.r_status==1}}">
  18 + <view class="desk-single flex-vc gray-deep-bg desk-nocan black-font">
  19 + <view class="font38r desk-name flex-cc font-more">{{item.name}}</view>
  20 + <view class="font34r desk-pnum flex-cc">{{item.table_pnum}}人桌</view>
  21 + <view class="desk-status white-font flex-cc font32r">已预订</view>
  22 + </view>
  23 + </block>
  24 + <!--<block wx:if="{{item.rstatus==2}}">
  25 + <view class="desk-single flex-vc green-light-bg desk-nocan black-font">
  26 + <view class="font38r desk-name flex-ll font-more">{{item.name}}</view>
  27 + <view class="font34r desk-pnum flex-lr">
  28 + <view class="gray-deep-font font34r">{{item.pnum}}人</view>
  29 + <view class="flex-rr">
  30 + <image class="desk-time" src="/pages/image/clock.png"></image>
  31 + <view class="font24r gray-font">10</view>
  32 + </view>
  33 + </view>
  34 + <view class="desk-status white-font flex-cc font32r">用餐中</view>
  35 + </view>
  36 + </block>-->
  37 + </block>
  38 +</view>
  1 +@import '../common.wxss';
  2 +.desk-list{
  3 + width:740rpx;
  4 + height:auto;
  5 + margin:0 auto;
  6 +}
  7 +.desk-single{
  8 + width:200rpx;
  9 + height:200rpx;
  10 + box-sizing:border-box;
  11 + border-radius:10rpx;
  12 + margin-left:35rpx;
  13 + margin-top:40rpx;
  14 + position:relative;
  15 +}
  16 +.desk-can{
  17 + padding-top:10rpx;
  18 +}
  19 +.desk-nocan{
  20 + padding-bottom:55rpx;
  21 +}
  22 +.desk-name{
  23 + width:100%;
  24 + padding:0 20rpx;
  25 + box-sizing:border-box;
  26 + display:inline-block;
  27 + text-align:center;
  28 +}
  29 +.desk-pnum{
  30 + width:100%;
  31 + padding:0 20rpx;
  32 + box-sizing:border-box;
  33 + margin-top:10rpx;
  34 +}
  35 +.desk-mask{
  36 + width:36rpx;
  37 + height:36rpx;
  38 + border-radius:50%;
  39 + border:1px solid #fff;
  40 + position:absolute;
  41 + right:10rpx;
  42 + top:10rpx;
  43 +}
  44 +.desk-mask-active{
  45 + border:1px solid #199095;
  46 + background:#199095;
  47 +}
  48 +
  49 +.icon-success{
  50 + position:absolute;
  51 + left:4rpx;
  52 + top:6rpx;
  53 +}
  54 +.green-deep-bg{
  55 + border:1px solid #199095;
  56 + background:#A9E3E6;
  57 +}
  58 +.gray-deep-bg{
  59 + border:1px solid #999;
  60 + background:#e0e0e0;
  61 +}
  62 +.green-light-bg{
  63 + border:1px solid #999;
  64 + background:#EBF8F8;
  65 +}
  66 +.desk-time{
  67 + width:28rpx;
  68 + height:28rpx;
  69 + margin-right:6rpx;
  70 +}
  71 +.desk-status{
  72 + position:absolute;
  73 + left:0;
  74 + bottom:0;
  75 + width:100%;
  76 + height:55rpx;
  77 + background:#777;
  78 +}
  1 +var util = require('../../../utils/util.js')
  2 +var uri=require('../../../utils/uri.js');
  3 +Component({
  4 + properties:{
  5 + item:Object
  6 + },
  7 + data:{
  8 +
  9 + },
  10 + methods:{
  11 + detail:function(e){
  12 + var obj=e.currentTarget.dataset.obj;
  13 + var path='';
  14 + var i=0;
  15 + for (var key in obj){
  16 + i++;
  17 + if(i==1){
  18 + path=path+'?'+key+'='+obj[key]
  19 + }else{
  20 + path=path+'&'+key+'='+obj[key]
  21 + }
  22 + }
  23 + wx.navigateTo({
  24 + url:'b_detail'+path
  25 + })
  26 + },
  27 +
  28 + }
  29 +})
  1 +{
  2 + "component": true
  3 +}
  1 +<view class="book-list-tds flex-lr font30r black-font" data-obj="{{item}}" bindtap="detail">
  2 + <view class="book-list-td flex-cc">
  3 + <view class="book-list-info font-more-two" style="display:block;">{{item.name}}</view>
  4 + </view>
  5 + <view class="book-list-td flex-cc">{{item.order_time}}</view>
  6 + <view class="book-list-td flex-cc">
  7 + <block wx:if="{{item.status==1}}">已预订</block>
  8 + <block wx:if="{{item.status==2}}">点餐中</block>
  9 + </view>
  10 + <view class="book-list-td flex-rr green-font">查看详情</view>
  11 +</view>
  1 +@import '../common.wxss';
  2 +.book-list-tds{
  3 + width:100%;
  4 + height:160rpx;
  5 + padding:0 40rpx;
  6 + box-sizing:border-box;
  7 +}
  8 +.book-list-td{
  9 + width:25%;
  10 + height:100%;
  11 +}
  12 +.book-list-info{
  13 + width:100%;
  14 + line-height:1.2;
  15 +}
  1 +var util = require('../../../utils/util.js')
  2 +var uri=require('../../../utils/uri.js');
  3 +var systemInfo=util.getsystem();
  4 +Component({
  5 + properties:{
  6 + height:{
  7 + type:Number,
  8 + value:systemInfo.windowHeight
  9 + }
  10 + },
  11 + data:{
  12 +
  13 + },
  14 + methods:{
  15 +
  16 + }
  17 +})
  1 +{
  2 + "component": true
  3 +}
  1 +<view style="height:{{height}}px;" class="nothing-page flex-vc bg-white">
  2 + <image class="nothing-booklist" src="/pages/image/nothing-booklist.png"></image>
  3 + <view class="black-font font34r smooth nothing-content">暂无内容</view>
  4 +</view>
  1 +@import '../common.wxss';
  2 +.nothing-page{
  3 + width:100%;
  4 + padding-bottom:90rpx;
  5 + box-sizing:border-box;
  6 +}
  7 +.nothing-booklist{
  8 + width:384rpx;
  9 + height:296rpx;
  10 +}
  11 +.nothing-content{
  12 + margin-top:40rpx;
  13 +}
  1 +var util = require('../../../utils/util.js')
  2 +var uri=require('../../../utils/uri.js');
  3 +Component({
  4 + properties:{
  5 + phoneNumber:String
  6 + },
  7 + data:{
  8 + list:[
  9 + {
  10 + imgurl:'/pages/image/notice-wx.png',
  11 + title:'微信'
  12 + },
  13 + {
  14 + imgurl:'/pages/image/notice-msg.png',
  15 + title:'短信'
  16 + },
  17 + {
  18 + imgurl:'/pages/image/notice-call.png',
  19 + title:'电话'
  20 + }
  21 + ],
  22 + noticeHidden:true
  23 + },
  24 + methods:{
  25 + show:function(){
  26 + this.setData({
  27 + noticeHidden:false
  28 + })
  29 + },
  30 + close:function(){
  31 + this.setData({
  32 + noticeHidden:true
  33 + })
  34 + },
  35 + callcustom:function(e){
  36 + var idx=e.currentTarget.dataset.idx;
  37 + if(idx==2){
  38 + var that=this;
  39 + wx.makePhoneCall({
  40 + phoneNumber: this.data.phoneNumber, //仅为示例,并非真实的电话号码
  41 + complete:function(){
  42 + that.close();
  43 + }
  44 + })
  45 + }
  46 + if(idx==0){
  47 + this.triggerEvent("share");
  48 + }
  49 + }
  50 + }
  51 +})
  1 +{
  2 + "component": true
  3 +}
  1 +<view class="notice-mask" hidden="{{noticeHidden}}" bindtap="close"></view>
  2 +<view class="notice-fixed flex-lr {{noticeHidden==false ? 'notice-fixed-active' : ''}}">
  3 + <block wx:for="{{list}}">
  4 + <block wx:if="{{index!=0}}">
  5 + <view class="notice-single flex-vc" bindtap="callcustom" data-idx="{{index}}">
  6 + <view class="notice-image flex-vc">
  7 + <image src="{{item.imgurl}}" class="notice-image-icon"></image>
  8 + </view>
  9 + <view class="black-font font30r">{{item.title}}</view>
  10 + </view>
  11 + </block>
  12 + <block wx:else>
  13 + <button class="notice-single flex-vc" open-type="share">
  14 + <view class="notice-image flex-vc">
  15 + <image src="{{item.imgurl}}" class="notice-image-icon"></image>
  16 + </view>
  17 + <view class="black-font font30r">{{item.title}}</view>
  18 + </button>
  19 + </block>
  20 + </block>
  21 +</view>
  1 +@import '../common.wxss';
  2 +.notice-mask{
  3 + position:fixed;
  4 + left:0;
  5 + right:0;
  6 + top:0;
  7 + bottom:0;
  8 + background:rgba(0,0,0,0);
  9 +}
  10 +.notice-fixed{
  11 + width:100%;
  12 + height:322rpx;
  13 + padding:0 50rpx;
  14 + box-sizing:border-box;
  15 + background:#F0F0F1;
  16 + position:fixed;
  17 + left:0;
  18 + bottom:-322rpx;
  19 + transition:bottom .3s ease;
  20 +}
  21 +.notice-fixed-active{
  22 + bottom:0;
  23 +}
  24 +.notice-single{
  25 + width:160rpx;
  26 + height:auto;
  27 +}
  28 +.notice-image{
  29 + width:100%;
  30 + height:160rpx;
  31 + background:#fff;
  32 + border-radius:10rpx;
  33 + margin-bottom:30rpx;
  34 +}
  35 +.notice-image-icon{
  36 + width:100rpx;
  37 + height:100rpx;
  38 +}
  1 +var util = require('../../../utils/util.js')
  2 +var uri=require('../../../utils/uri.js');
  3 +var systemInfo=util.getsystem();
  4 +Component({
  5 + properties:{
  6 + pnum:String
  7 + },
  8 + data:{
  9 +
  10 + },
  11 + methods:{
  12 + editPnum:function(e){
  13 + this.setData({
  14 + pnum:parseInt(e.detail.pnum)
  15 + })
  16 + util.cache('order_pnum',this.data.pnum)
  17 + this.triggerEvent("changepnum",this.data.pnum);
  18 + },
  19 + addPnum:function(){
  20 + var pnum=parseInt(this.data.pnum);
  21 + if(this.data.pnum<10000) {
  22 + this.setData({
  23 + pnum: pnum + 1
  24 + })
  25 + util.cache('order_pnum',this.data.pnum)
  26 + this.triggerEvent("changepnum",this.data.pnum);
  27 + }
  28 + },
  29 + reducePnum:function(){
  30 + var pnum=parseInt(this.data.pnum);
  31 + if(pnum>1){
  32 + this.setData({
  33 + pnum:pnum-1
  34 + })
  35 + util.cache('order_pnum',this.data.pnum)
  36 + this.triggerEvent("changepnum",this.data.pnum);
  37 + }
  38 + }
  39 + }
  40 +})
  1 +{
  2 + "component": true
  3 +}
  1 +<view class="selected-time flex-cc">
  2 + <view class="flex-vc padding-topbottom padding-left25" bindtap="reducePnum">
  3 + <image src="/pages/image/reduce-act.png" class="select-act"></image>
  4 + </view>
  5 + <input value="{{pnum}}" class="select-input flex-cc green-font font34r" bindunput="editpnum"/>
  6 + <view class="flex-vc padding-topbottom padding-right25" bindtap="addPnum">
  7 + <image src="/pages/image/add-act.png" class="select-act"></image>
  8 + </view>
  9 +</view>
  1 +@import '../common.wxss';
  2 +.selected-time{
  3 + width:375rpx;
  4 + height:100%;
  5 +}
  6 +.select-act{
  7 + width:48rpx;
  8 + height:48rpx;
  9 +}
  10 +.select-input{
  11 + width:100rpx;
  12 + height:44rpx;
  13 + text-align:center;
  14 + margin:0 15rpx;
  15 +}
  16 +.padding-topbottom{
  17 + padding:25rpx 0;
  18 +}
  19 +.padding-left25{
  20 + padding-left:25rpx;
  21 +}
  22 +.padding-right25{
  23 + padding-right:25rpx;
  24 +}
  1 +var util = require('../../../utils/util.js')
  2 +var uri=require('../../../utils/uri.js');
  3 +Component({
  4 + properties:{
  5 + item:Object
  6 + },
  7 + data:{
  8 +
  9 + },
  10 + methods:{
  11 + selecttime:function(e){
  12 + var time_dur=e.currentTarget.dataset.time_dur;
  13 + console.log(e)
  14 + this.triggerEvent("changelist",time_dur);
  15 + var title=e.currentTarget.dataset.title;
  16 + var timelist=this.data.item;
  17 + timelist.list.forEach(function(v,i){
  18 + v.isselect=false
  19 + if(v.time_dur==time_dur){
  20 + v.isselect=true;
  21 + }
  22 + })
  23 + this.setData({
  24 + item:timelist
  25 + })
  26 + }
  27 + }
  28 +})
  1 +{
  2 + "component": true
  3 +}
  1 +<view class="time-dur">
  2 + <view class="border-line"></view>
  3 + <view class="time-dur-title black-font font30r">{{item.title}} <text class="font26r smooth gray-deep-font">({{item.time_dur}})</text></view>
  4 + <view class="time-list flex-rs">
  5 + <block wx:for="{{item.list}}" wx:for-item="list">
  6 + <view class="time-single flex-cc gray-deep-font {{list.isselect==true ? 'time-single-active' : ''}} font30r smooth" data-time_dur="{{list.time_dur}}" bindtap="selecttime" data-title="{{item.title}}">{{list.time_dur}}</view>
  7 + </block>
  8 + </view>
  9 +</view>
  1 +@import '../common.wxss';
  2 +.time-dur{
  3 + width:100%;
  4 + height:auto;
  5 + padding-bottom:45rpx;
  6 +}
  7 +.border-line{
  8 + width:680rpx;
  9 + height:1px;
  10 + background:#efeef3;
  11 + margin:0 auto;
  12 +}
  13 +.time-single{
  14 + width:120rpx;
  15 + height:75rpx;
  16 + border:1px solid #999;
  17 + box-sizing:border-box;
  18 + border-radius:8rpx;
  19 + margin-left:44rpx;
  20 + margin-right:16rpx;
  21 + margin-top:30rpx;
  22 +}
  23 +.time-dur-title{
  24 + width:100%;
  25 + padding:0 44rpx;
  26 + padding-top:35rpx;
  27 + box-sizing:border-box;
  28 +}
  29 +.time-single-active{
  30 + border:0;
  31 + background:#A9E3E6;
  32 +}
  1 +var util = require('../../utils/util.js')
  2 +var uri=require('../../utils/uri.js')
  3 +var bookOrder=require('../../utils/bookCommon.js')
  4 +Page({
  5 + data:{
  6 + },
  7 + onLoad:function(){
  8 + util.setBarTitle('选择用餐时间');
  9 + this.getdatelist()
  10 + this.getimelist();
  11 + wx.removeStorage({
  12 + key:'order_pnum',
  13 + })
  14 + wx.removeStorage({
  15 + key:'tabletype',
  16 + })
  17 + },
  18 + onShow:function(){
  19 +
  20 + },
  21 + changelist:function(e){
  22 + console.log('xxxx',e)
  23 + var timelist=this.data.timeList;
  24 + timelist.forEach(function(v,i){
  25 + v.list.forEach(function(r,n){
  26 + r.isselect=false
  27 + })
  28 + })
  29 + this.setData({
  30 + timeList:timelist,
  31 + time_dur:e.detail
  32 + })
  33 + },
  34 + //日期选择
  35 + selectdate:function(e){
  36 + var title=e.currentTarget.dataset.title;
  37 + var datelist=this.data.dateList;
  38 + var selectdate=''
  39 + datelist.forEach(function(v,i){
  40 + v.isActive=false
  41 + if(v.title==title){
  42 + v.isActive=true;
  43 + selectdate=v.date
  44 + }
  45 + })
  46 + this.setData({
  47 + dateList:datelist,
  48 + selectdate:selectdate,
  49 + time_dur:null
  50 + })
  51 + this.getimelist();
  52 + },
  53 + selectOther:function(){
  54 + var currentTime=Date.parse(new Date());
  55 + var timeobj=bookOrder.changedate(currentTime)
  56 + console.log(this.data.selectdate,this.data.time_dur)
  57 + wx.navigateTo({
  58 + url:'b_info?year='+timeobj.year+'&date='+this.data.selectdate+'&time='+this.data.time_dur
  59 + })
  60 + },
  61 + //获取日期列表
  62 + getdatelist:function(){
  63 + var currentTime=Date.parse(new Date());
  64 + var dur=24*60*60*1000;
  65 + var list=[currentTime,currentTime+dur,currentTime+2*dur];
  66 + var desklist=[];
  67 + for(var i=0;i<list.length;i++){
  68 + var dd=bookOrder.changedate(list[i]);
  69 + if(i==0){
  70 + var title='今天';
  71 + var isselect=true
  72 + }
  73 + if(i==1){
  74 + var title='明天';
  75 + var isselect=false
  76 + }
  77 + if(i==2){
  78 + var myDate = new Date(list[2]);
  79 + var title=bookOrder.getweek(myDate.getDay());
  80 + var isselect=false
  81 + }
  82 + desklist.push({
  83 + title:title,
  84 + date:'0'+dd.month+(dd.day<10 ? '-0'+dd.day : '-'+dd.day),
  85 + isActive:isselect,
  86 + year:dd.year
  87 + })
  88 + }
  89 + this.setData({
  90 + dateList:desklist,
  91 + selectdate:desklist[0].date
  92 + })
  93 + console.log(this.data.selectdate)
  94 + },
  95 + //获取时间列表
  96 + getimelist:function(){
  97 + var currentTime=Date.parse(new Date());
  98 + var timeobj=bookOrder.changedate(currentTime)
  99 + var timelist=[
  100 + {
  101 + title:'早市',
  102 + time_dur:'6:00-10:00',
  103 + list:[
  104 + {
  105 + time_dur:'6:00',
  106 + isselect:false,
  107 + time_mask:6
  108 + }
  109 + ],
  110 + starttime:6,
  111 + endtime:10
  112 + },
  113 + {
  114 + title:'午市',
  115 + time_dur:'11:00-15:00',
  116 + list:[
  117 + {
  118 + time_dur:'11:00',
  119 + isselect:false,
  120 + time_mask:11
  121 + }
  122 + ],
  123 + starttime:11,
  124 + endtime:15
  125 + },
  126 + {
  127 + title:'晚市',
  128 + time_dur:'17:00-22:00',
  129 + list:[
  130 + {
  131 + time_dur:'17:00',
  132 + isselect:false,
  133 + time_mask:17
  134 + }
  135 + ],
  136 + starttime:17,
  137 + endtime:22
  138 + },
  139 + ];
  140 + var that=this;
  141 + timelist.forEach(function(v,i){
  142 + var len=(v.endtime-v.starttime)/0.5;
  143 + var time=v.starttime;
  144 + console.log(len)
  145 + for(var j=0;j<len;j++){
  146 + time+=0.5;
  147 + if(bookOrder.isInteger(time)==true){
  148 + v.list.push(
  149 + {
  150 + time_dur:time+':00',
  151 + isselect:false,
  152 + time_mask:time
  153 + }
  154 + )
  155 + }else{
  156 + v.list.push(
  157 + {
  158 + time_dur:Math.floor(time)+':30',
  159 + isselect:false,
  160 + time_mask:time
  161 + }
  162 + )
  163 + }
  164 + }
  165 + })
  166 + var thisdate=0;
  167 + if(that.data.selectdate.split('-')[1].length>1){
  168 + thisdate=parseInt(that.data.selectdate.split('-')[1][0]=='0' ? that.data.selectdate.split('-')[1].slice(1,2) : that.data.selectdate.split('-')[1])
  169 + }else{
  170 + thisdate=parseInt(that.data.selectdate.split('-')[1])
  171 + }
  172 + if(thisdate==timeobj.day){
  173 + var thistime=timeobj.hour+timeobj.minute/60;
  174 + var dd=[]
  175 + timelist.forEach(function(v,i){
  176 + if(thistime<v.endtime){
  177 + dd.push(v)
  178 + }
  179 + })
  180 + timelist=dd;
  181 + timelist.forEach(function(v,i){
  182 + if(thistime>=v.starttime && thistime<=v.endtime){
  183 + var list=[]
  184 + v.list.forEach(function(r,n){
  185 + if(thistime<r.time_mask){
  186 + list.push(r)
  187 + }
  188 + })
  189 + v.list=list
  190 + }
  191 + })
  192 +
  193 + }
  194 +
  195 + this.setData({
  196 + timeList:timelist
  197 + })
  198 +
  199 + },
  200 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "timeDuration":"/components/book/time/time"
  7 + }
  8 +
  9 +}
  1 +<!--日期-->
  2 +<view style="padding-bottom:160rpx;">
  3 + <view class="select-date flex-lr smooth">
  4 + <block wx:for="{{dateList}}">
  5 + <view class="single-date gray-deep-font flex-vc" bindtap="selectdate" data-title="{{item.title}}">
  6 + <view class="font30r {{item.isActive==true ? 'black-font' : ''}}">{{item.title}}</view>
  7 + <view class="font34r date-num flex-cc {{item.isActive==true ? 'select-date-active black-font' : ''}}">{{item.date}}</view>
  8 + </view>
  9 + </block>
  10 + <view class="single-date gray-deep-font flex-vc">
  11 + <view class="font30r">更多</view>
  12 + <view class="date-num flex-vc">
  13 + <image src="../image/more-dot.png" class="more-dot"></image>
  14 + </view>
  15 + </view>
  16 + </view>
  17 + <block wx:for="{{timeList}}">
  18 + <timeDuration item="{{item}}" bind:changelist="changelist"></timeDuration>
  19 + </block>
  20 +</view>
  21 +<view class="confirm-button white-font flex-vc font34r {{time_dur ? 'confirm-button-active' : ''}}" bindtap="{{time_dur ? 'selectOther' : ''}}">确定</view>
  22 +
  23 +
  24 +<date-picker
  25 + startTime="{{startTime}}"
  26 + endTime="{{endTime}}"
  27 + unit="{{unit}}"
  28 + reserveUnit="{{reserveUnit}}"
  29 + unreserveTime="{{unreserveTime}}"
  30 + activedConst="{{activedConst}}"
  31 + disabledConst="{{disabledConst}}"
  32 + themeColor="#1f78d1"
  33 + bind:selectTime="onSelectTime"
  34 +/>
  1 +.select-date{
  2 + width:680rpx;
  3 + height:180rpx;
  4 + margin:0 auto;
  5 +}
  6 +.more-dot{
  7 + width:50rpx;
  8 + height:10rpx;
  9 +}
  10 +.date-num{
  11 + padding:0 10rpx;
  12 + height:70rpx;
  13 +}
  14 +.select-date-active{
  15 + border-bottom:2px solid #199095;
  16 + box-sizing:border-box;
  17 +}
  18 +.confirm-button{
  19 + width:680rpx;
  20 + height:85rpx;
  21 + background:#74BBBE;
  22 + position:fixed;
  23 + left:0;
  24 + right:0;
  25 + bottom:60rpx;
  26 + margin:0 auto;
  27 + border-radius:10rpx;
  28 +}
  29 +.confirm-button-active{
  30 + background:#199095;
  31 +}
  1 +var util = require('../../utils/util.js')
  2 +var uri=require('../../utils/uri.js')
  3 +var bookOrder=require('../../utils/bookCommon.js')
  4 +Page({
  5 + data:{
  6 + desk_type:[
  7 + {
  8 + type:2,
  9 + type_name:'包厢',
  10 + isselect:true
  11 + },
  12 + {
  13 + type:1,
  14 + type_name:'散座',
  15 + isselect:false,
  16 + },
  17 + {
  18 + type:'',
  19 + type_name:'全部',
  20 + isselect:false
  21 + }
  22 + ],
  23 + tabletype:2
  24 +
  25 + },
  26 + onLoad:function(opt){
  27 + console.log(opt)
  28 + util.setBarTitle('选择桌位');
  29 + var radio=750/util.getsystem().windowWidth;
  30 + var contentHeight=util.getsystem().windowHeight-Math.ceil(350/radio);
  31 + var temdate=bookOrder.get_date(opt.date);
  32 + var stringTime =opt.year+'-'+temdate+' ' +opt.time_dur+':00';
  33 + console.log(stringTime)
  34 + var time=bookOrder.gettimestamp(stringTime);
  35 + this.setData({
  36 + sellerid:util.cache('sellerid'),
  37 + selectdate:opt.date,
  38 + time_dur:opt.time_dur,
  39 + pnum:opt.pnum,
  40 + contentHeight:contentHeight,
  41 + time:time,
  42 + thisyear:opt.year
  43 + })
  44 + console.log(time)
  45 + var thistype=util.cache('tabletype');
  46 + var fixedtype=this.data.desk_type;
  47 + var dd=[];
  48 + for(var key in thistype){
  49 + var type=key.split('_')[1];
  50 + fixedtype.forEach(function(v,i){
  51 + if(v.type==type){
  52 + v.isselect=false;
  53 + if(type==2){
  54 + dd.unshift(v)
  55 + }else{
  56 + dd.push(v)
  57 + }
  58 +
  59 + }
  60 + })
  61 + }
  62 + dd.push({
  63 + type:'',
  64 + type_name:'全部',
  65 + isselect:false
  66 + })
  67 + dd[0].isselect=true;
  68 + this.setData({
  69 + desk_type:dd,
  70 + tabletype:dd[0].type
  71 + })
  72 + this.getdesklist();
  73 + },
  74 + onShow:function(){
  75 + var that=this;
  76 + util.postSuccessFun=function(json,uri_code){
  77 + switch (uri_code) {
  78 + case uri.CGI_USER_GETTABLELIST__CODE:
  79 + console.log(json)
  80 + var desklist=json.data;
  81 + var thisdesk=[];
  82 + for(var key in desklist){
  83 + if(bookOrder.isInteger(key)==true){
  84 + desklist[key].list.forEach(function(r,n){
  85 + r.isselect=false;
  86 + if(util.cache('tableid')){
  87 + var tables=util.cache('tableid');
  88 + tables.forEach(function(v,i){
  89 + if(v==r.id){
  90 + r.isselect=true;
  91 + }
  92 + })
  93 + }
  94 + })
  95 + thisdesk.push(desklist[key])
  96 + }
  97 +
  98 + }
  99 + if(that.data.tabletype!=''){
  100 + that.selectdesk(thisdesk);
  101 + }else{
  102 + that.setData({
  103 + desklist:thisdesk
  104 + })
  105 + }
  106 +
  107 + console.log(that.data.desklist)
  108 + break;
  109 + }
  110 + }
  111 + },
  112 + selectType:function(e){
  113 + var type=e.currentTarget.dataset.type;
  114 + var desktype=this.data.desk_type;
  115 + desktype.forEach(function(v,i){
  116 + v.isselect=false
  117 + if(v.type==type){
  118 + v.isselect=true
  119 + }
  120 + })
  121 + this.setData({
  122 + desk_type:desktype,
  123 + tabletype:type
  124 + })
  125 + this.getdesklist();
  126 + },
  127 + selectdesk:function(desklist){
  128 + var type=this.data.tabletype;
  129 + console.log('tttt',desklist)
  130 + var thislist=[];
  131 + var temp={}
  132 + desklist.forEach(function(v,i){
  133 + v.list.forEach(function(r,n){
  134 + if(r.tid==type){
  135 + if(!temp.hasOwnProperty(v.name)){
  136 + temp[v.name]=true;
  137 + thislist.push({
  138 + name:v.name,
  139 + list:[]
  140 + })
  141 + }
  142 + }
  143 + })
  144 + })
  145 + console.log(thislist)
  146 + desklist.forEach(function(v,i){
  147 + thislist.forEach(function(r,n){
  148 + if(v.name==r.name){
  149 + v.list.forEach(function(r1,n1){
  150 + if(r1.tid==type){
  151 + r.list.push(r1)
  152 + }
  153 + })
  154 + }
  155 +
  156 + })
  157 + })
  158 + this.setData({
  159 + desklist:thislist
  160 + })
  161 + },
  162 + changepnum:function(e){
  163 + this.setData({
  164 + pnum:e.detail
  165 + })
  166 + this.getdesklist();
  167 + },
  168 + changedesk:function(e){
  169 + var tableid=e.detail;
  170 + this.setData({
  171 + tableid:util.cache('tableid') && util.cache('tableid').length>0 ? util.cache('tableid') :null
  172 + })
  173 + },
  174 + back:function(){
  175 + this.setData({
  176 + buttonClick:true
  177 + })
  178 + wx.navigateBack()
  179 + },
  180 + getdesklist:function(){
  181 + util.post(uri.CGI_USER_GETTABLELIST,{sid:this.data.sellerid,pnum:parseInt(this.data.pnum),rdate:this.data.time},uri.CGI_USER_GETTABLELIST__CODE)
  182 + },
  183 + backtime:function () {
  184 + var pages=getCurrentPages();
  185 + var len=pages.length;
  186 + var timelist=pages[len-3].data.timeList;
  187 + var datelist=pages[len-3].data.dateList;
  188 + var currendate=bookOrder.get_date(this.data.selectdate)
  189 + var time_dur=this.data.time_dur;
  190 + var dateindex;
  191 + datelist.forEach(function(v,i){
  192 + if(v.date==currendate){
  193 + dateindex=i;
  194 + }
  195 + })
  196 + var that=this;
  197 + var timeIndex;
  198 + var durIndex;
  199 + timelist.forEach(function(v,i){
  200 + v.list.forEach(function(r,n){
  201 + r.isselect=false;
  202 + if(r.time_dur==time_dur){
  203 + console.log('xxxx',n,i,time_dur)
  204 + timeIndex=n;
  205 + durIndex=i;
  206 + if(n==0 && i==0){
  207 + if(dateindex==0){
  208 + console.log('不能再退了')
  209 + }else{
  210 + console.log(11111)
  211 + dateindex=dateindex-1;
  212 + datelist.forEach(function(r1,n1){
  213 + r1.isActive=false;
  214 + if(dateindex==n1){
  215 + r1.isActive=true;
  216 + that.setData({
  217 + thisyear:r1.year
  218 + })
  219 + }
  220 + })
  221 + pages[len-3].setData({
  222 + selectdate:datelist[dateindex].date,
  223 + dateList:datelist
  224 + })
  225 + pages[len-3].getimelist();
  226 + timelist=pages[len-3].data.timeList;
  227 + that.setData({
  228 + selectdate:bookOrder.getdate_num(pages[len-3].data.selectdate),
  229 + time_dur:'22:00'
  230 + })
  231 + pages[len-2].setData({
  232 + selectdate:bookOrder.getdate_num(pages[len-3].data.selectdate),
  233 + time_dur:'22:00'
  234 + })
  235 + console.log(that.data.time_dur)
  236 + timelist.forEach(function(r1,n1){
  237 + r1.list.forEach(function(r2,n2){
  238 + r2.isselect=false;
  239 + console.log(r2)
  240 + if(r2.time_dur==that.data.time_dur){
  241 + console.log('xxxxx',r2)
  242 + r2.isselect=true;
  243 + }
  244 + })
  245 + })
  246 + console.log(timelist)
  247 + pages[len-3].setData({
  248 + timeList:timelist,
  249 + time_dur:'22:00'
  250 + })
  251 +
  252 + }
  253 +
  254 + }
  255 + if(n>0 && i==0){
  256 + that.setData({
  257 + time_dur:v.list[n-1].time_dur
  258 + })
  259 + v.list[n-1].isselect=true;
  260 + pages[len-3].setData({
  261 + timeList:timelist,
  262 + time_dur:v.list[n-1].time_dur
  263 + })
  264 + pages[len-2].setData({
  265 + time_dur:v.list[n-1].time_dur
  266 + })
  267 + }
  268 + if(n==0 && i>0){
  269 + console.log('xxxx',2)
  270 + that.setData({
  271 + time_dur:timelist[i-1].list[timelist[i-1].list.length-1].time_dur,
  272 + })
  273 + timelist[i-1].list[timelist[i-1].list.length-1].isselect=true;
  274 + pages[len-3].setData({
  275 + timeList:timelist,
  276 + time_dur:timelist[i-1].list[timelist[i-1].list.length-1].time_dur,
  277 + })
  278 + pages[len-2].setData({
  279 + time_dur:timelist[i-1].list[timelist[i-1].list.length-1].time_dur
  280 + })
  281 + }
  282 + if(n>0 && i>0){
  283 + that.setData({
  284 + time_dur:v.list[n-1].time_dur
  285 + })
  286 + v.list[n-1].isselect=true;
  287 + pages[len-3].setData({
  288 + timeList:timelist,
  289 + time_dur:timelist[i-1].list[timelist[i-1].list.length-1].time_dur,
  290 + })
  291 + pages[len-2].setData({
  292 + time_dur:v.list[n-1].time_dur
  293 + })
  294 + }
  295 + }
  296 + })
  297 + })
  298 + var temdate=bookOrder.get_date(this.data.selectdate);
  299 + var stringTime =this.data.thisyear+'-'+temdate+' ' +this.data.time_dur;
  300 + var time=bookOrder.gettimestamp(stringTime);
  301 + this.setData({
  302 + time:time
  303 + })
  304 + pages[len-3].setData({
  305 + time:time
  306 + })
  307 + pages[len-2].setData({
  308 + time:time
  309 + })
  310 + this.getdesklist();
  311 +
  312 +
  313 + },
  314 + aftertime:function(){
  315 + var pages=getCurrentPages();
  316 + var len=pages.length;
  317 + console.log(len)
  318 + var timelist=pages[len-3].data.timeList;
  319 + var datelist=pages[len-3].data.dateList;
  320 + var currendate=bookOrder.get_date(this.data.selectdate);
  321 + var time_dur=this.data.time_dur;
  322 + var dateindex;
  323 + datelist.forEach(function(v,i){
  324 + if(v.date==currendate){
  325 + dateindex=i;
  326 + }
  327 + })
  328 + var that=this;
  329 + timelist.forEach(function(v,i){
  330 + v.list.forEach(function(r,n){
  331 + r.isselect=false
  332 + if(r.time_dur==time_dur){
  333 + if(i==timelist.length-1 && n==v.list.length-1){
  334 + if(dateindex==2){
  335 + console.log('不能再加了')
  336 + }else{
  337 + console.log('tttttt')
  338 + dateindex=dateindex+1;
  339 + datelist.forEach(function(r1,n1){
  340 + r1.isActive=false;
  341 + if(dateindex==n1){
  342 + r1.isActive=true;
  343 + that.setData({
  344 + thisyear:r1.year
  345 + })
  346 + }
  347 + })
  348 + pages[len-3].setData({
  349 + selectdate:datelist[dateindex].date,
  350 + dateList:datelist
  351 + })
  352 + pages[len-3].getimelist();
  353 + timelist=pages[len-3].data.timeList;
  354 + that.setData({
  355 + selectdate:bookOrder.getdate_num(pages[len-3].data.selectdate),
  356 + time_dur:'6:00'
  357 + })
  358 + console.log(time_dur)
  359 + console.log('hhhh',that.data.time_dur)
  360 + pages[len-2].setData({
  361 + selectdate:bookOrder.getdate_num(pages[len-3].data.selectdate),
  362 + time_dur:'6:00'
  363 + })
  364 + console.log(timelist)
  365 + timelist.forEach(function(r1,n1){
  366 + r1.list.forEach(function(r2,n2){
  367 + r2.isselect=false;
  368 + if(r2.time_dur==that.data.time_dur){
  369 + r2.isselect=true;
  370 + }
  371 + })
  372 + })
  373 + timelist[2].list[0].isselect=false
  374 + console.log('ffff',timelist)
  375 + pages[len-3].setData({
  376 + timeList:timelist,
  377 + time_dur:'6:00'
  378 + })
  379 + var temdate=bookOrder.get_date(that.data.selectdate);
  380 + var stringTime =that.data.thisyear+'-'+temdate+' ' +that.data.time_dur;
  381 + var time=bookOrder.gettimestamp(stringTime);
  382 + that.setData({
  383 + time:time
  384 + })
  385 + pages[len-3].setData({
  386 + time:time
  387 + })
  388 + pages[len-2].setData({
  389 + time:time
  390 + })
  391 + that.getdesklist();
  392 + return;
  393 +
  394 + }
  395 + }
  396 + if(i==timelist.length-1 && n<v.list.length-1){
  397 + that.setData({
  398 + time_dur:v.list[n+1].time_dur
  399 + })
  400 + v.list[n+1].isselect=true
  401 + pages[len-3].setData({
  402 + time_dur:v.list[n+1].time_dur,
  403 + timeList:timelist
  404 + })
  405 + pages[len-2].setData({
  406 + time_dur:v.list[n+1].time_dur
  407 + })
  408 + }
  409 + if(i<timelist.length-1 && n==v.list.length-1){
  410 + that.setData({
  411 + time_dur:timelist[i+1].list[0].time_dur,
  412 + })
  413 + timelist[i+1].list[0].isselect=true;
  414 + pages[len-3].setData({
  415 + time_dur:timelist[i+1].list[0].time_dur,
  416 + timeList:timelist
  417 + })
  418 + pages[len-2].setData({
  419 + time_dur:timelist[i+1].list[0].time_dur,
  420 + })
  421 + }
  422 + if(i<timelist.length-1 && n<v.list.length-1){
  423 + that.setData({
  424 + time_dur:v.list[n+1].time_dur
  425 + })
  426 + v.list[n+1].isselect=true
  427 + pages[len-3].setData({
  428 + time_dur:v.list[n+1].time_dur,
  429 + timeList:timelist
  430 + })
  431 + pages[len-2].setData({
  432 + time_dur:v.list[n+1].time_dur
  433 + })
  434 + }
  435 + }
  436 + })
  437 + })
  438 + var temdate=bookOrder.get_date(this.data.selectdate);
  439 + var stringTime =this.data.thisyear+'-'+temdate+' ' +this.data.time_dur;
  440 + var time=bookOrder.gettimestamp(stringTime);
  441 + this.setData({
  442 + time:time
  443 + })
  444 + pages[len-3].setData({
  445 + time:time
  446 + })
  447 + pages[len-2].setData({
  448 + time:time
  449 + })
  450 + this.getdesklist();
  451 +
  452 + },
  453 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "selectPeople":"/components/book/people/people",
  7 + "orderDesk":"/components/book/desk/desk"
  8 + }
  9 +}
  1 +<view class="other-info flex-lr">
  2 + <view class="selected-time flex-lr">
  3 + <view style="padding:30rpx 40rpx;" bindtap="backtime">
  4 + <image src="../image/green-click-reduce.png" class="icon12-22"></image>
  5 + </view>
  6 + <view class="flex-vc">
  7 + <view class="font34r green-font">{{selectdate}}</view>
  8 + <view class="actual-time green-font font34r">{{time_dur}}</view>
  9 + </view>
  10 + <view style="padding:30rpx 40rpx;" bindtap="aftertime">
  11 + <image src="../image/green-click-add.png" class="icon12-22"></image>
  12 + </view>
  13 + </view>
  14 + <selectPeople bind:changepnum="changepnum" pnum="{{pnum}}"></selectPeople>
  15 +</view>
  16 +<view class="cut"></view>
  17 +
  18 +
  19 +
  20 +
  21 +<!--桌位状态-->
  22 +<view class="desk-type flex-lr">
  23 + <block wx:for="{{desk_type}}">
  24 + <view class="desk-type-single flex-cc {{item.isselect==true ? 'desk-type-single-active white-font' : 'black-font'}} font34r" bindtap="selectType" data-type="{{item.type}}">{{item.type_name}}</view>
  25 + </block>
  26 +</view>
  27 +<view class="desk-list" style="padding-bottom:180rpx;">
  28 + <block wx:for="{{desklist}}">
  29 + <view class="desk-region black-font font34r font-bold">{{item.name}}</view>
  30 + <orderDesk list="{{item.list}}" bind:changedesk="changedesk"></orderDesk>
  31 + </block>
  32 +</view>
  33 +
  34 +<view class="confirm-button white-font flex-vc font34r {{tableid ? 'confirm-button-active' : ''}}" bindtap="back">确定</view>
  1 +view{
  2 + line-height:1.2;
  3 +}
  4 +.other-info{
  5 + width:100%;
  6 + height:220rpx;
  7 + padding:20rpx 0;
  8 + box-sizing:border-box;
  9 +}
  10 +.selected-time{
  11 + width:375rpx;
  12 + height:100%;
  13 + border-right:1px solid #efeef3;
  14 + box-sizing:border-box;
  15 +}
  16 +.actual-time{
  17 + margin-top:10rpx;
  18 +}
  19 +.cut{
  20 + width:100%;
  21 + height:4px;
  22 + background:#efeef3;
  23 +}
  24 +
  25 +
  26 +
  27 +.desk-type{
  28 + width:680rpx;
  29 + padding:40rpx 0 20rpx;
  30 + margin:0 auto;
  31 +}
  32 +.desk-type-single{
  33 + width:160rpx;
  34 + height:60rpx;
  35 + border:1px solid #199095;
  36 + border-radius:30rpx;
  37 + background:#EBF8F8;
  38 +}
  39 +.desk-type-single-active{
  40 + background:#199095;
  41 +}
  42 +
  43 +.desk-list{
  44 + width:100%;
  45 +}
  46 +.desk-region{
  47 + width:680rpx;
  48 + padding-top:40rpx;
  49 + margin:0 auto;
  50 +}
  51 +
  52 +.confirm-button{
  53 + width:680rpx;
  54 + height:85rpx;
  55 + background:#74BBBE;
  56 + position:fixed;
  57 + left:0;
  58 + right:0;
  59 + bottom:60rpx;
  60 + margin:0 auto;
  61 + border-radius:10rpx;
  62 +}
  63 +.confirm-button-active{
  64 + background:#199095;
  65 +}
  1 +var util = require('../../utils/util.js')
  2 +var uri=require('../../utils/uri.js')
  3 +Page({
  4 + onLoad:function (opt) {
  5 + util.setBarTitle('预定详情');
  6 + console.log(opt)
  7 + opt.name=opt.name.length>3 ? opt.name.slice(0,3)+'...' : opt.name
  8 + this.setData({
  9 + sellerid:util.cache('sellerid'),
  10 + phoneNumber:opt.phone,
  11 + bookInfo:opt
  12 + })
  13 + wx.showShareMenu({
  14 + withShareTicket: true,
  15 + success:function(res){
  16 + console.log(res)
  17 + }
  18 + })
  19 + },
  20 + onShow:function(){
  21 + this.getsellerInfo();
  22 + this.getdesklist();
  23 + var that=this;
  24 + this.notice=this.selectComponent('#notice');
  25 + util.postSuccessFun=function(json,uri_code){
  26 + switch (uri_code) {
  27 + case uri.CGI__USER_GETSELLERBYID__CODE:
  28 + console.log(json)
  29 + if(json.ret==200){
  30 + that.setData({
  31 + storeInfo:json.data.data
  32 + })
  33 + }
  34 + break;
  35 + case uri.CGI_USER_GETTABLELIST__CODE:
  36 + var list=json.data;
  37 + var templist=[];
  38 + for(var key in list){
  39 + if(key!='typex' && key!='typey'){
  40 + list[key].list.forEach(function(v,i){
  41 + templist.push(v)
  42 + })
  43 +
  44 + }
  45 + }
  46 + var tables=that.data.bookInfo.tid.split(',');
  47 + var selecttable=[];
  48 + templist.forEach(function (v,i) {
  49 + tables.forEach(function(r,n){
  50 + if(r==v.id){
  51 + v.name=v.name.length>4 ? v.name.slice(0,3)+'...' : v.name;
  52 + selecttable.push(v)
  53 + }
  54 + })
  55 + })
  56 + console.log(selecttable)
  57 + that.setData({
  58 + selecttable:selecttable
  59 + })
  60 + break;
  61 + }
  62 + }
  63 + },
  64 + noticeCall:function(){
  65 + this.notice.show();
  66 + },
  67 + getsellerInfo:function(){
  68 + util.post(uri.CGI__USER_GETSELLERBYID,{sellerid:this.data.sellerid},uri.CGI__USER_GETSELLERBYID__CODE);
  69 + },
  70 + getdesklist:function(){
  71 + util.post(uri.CGI_USER_GETTABLELIST,{sid:this.data.sellerid,pnum:parseInt(this.data.bookInfo.pnum),rdate:this.data.bookInfo.rdate},uri.CGI_USER_GETTABLELIST__CODE)
  72 + },
  73 + lookLocation:function(){
  74 + wx.openLocation({
  75 + latitude:Number(this.data.storeInfo.lat),
  76 + longitude:Number(this.data.storeInfo.long),
  77 + scale:17,
  78 + address:this.data.storeInfo.map_address,
  79 + success:function (res) {
  80 + console.log(res)
  81 + }
  82 + })
  83 + },
  84 + onShareAppMessage: function () {
  85 + this.notice.close();
  86 + var obj=this.data.bookInfo;
  87 + var path='b_detail?sellerid='+this.data.sellerid;
  88 + for (var key in obj){
  89 + path=path+'&'+key+'='+obj[key]
  90 + }
  91 + path=path+'&code=1'
  92 + return {
  93 + title: '恭喜订座成功,点击查看详情,及时通知用餐人员',
  94 + path: '/pages/book/'+path,
  95 + success: function (res) {
  96 + console.log(res,666666)
  97 + },
  98 + fail:function(){
  99 + console.log('ccccc')
  100 + },
  101 + complete:function(){
  102 + console.log('ccccc')
  103 + }
  104 + };
  105 + },
  106 + getcall:function(){
  107 + var that=this;
  108 + wx.makePhoneCall({
  109 + phoneNumber: this.data.phoneNumber, //仅为示例,并非真实的电话号码
  110 + complete:function(){
  111 + this.notice.close();
  112 + }
  113 + })
  114 + }
  115 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "noticeCall":"/components/book/notice/notice"
  7 + }
  8 +}
  1 +
  2 +<!--商家信息-->
  3 +<view class="flex-lr seller-info">
  4 + <view class="flex-ll">
  5 + <image src="{{storeInfo.seller_image}}" class="seller-image"></image>
  6 + <view class="flex-vl black-font">
  7 + <view class="font30r">{{storeInfo.sellername}}</view>
  8 + <view class="font24r gray-deep-font seller-address">{{storeInfo.map_address}}</view>
  9 + </view>
  10 + </view>
  11 + <view style="padding:20rpx 20rpx;" bindtap="lookLocation">
  12 + <image src="../image/gps-icon.png" class="seller-location"></image>
  13 + </view>
  14 +</view>
  15 +
  16 +<!--订单信息-->
  17 +<view class="order-info">
  18 + <view class="flex-lr order-detail">
  19 + <view class="gray-deep-font font30r">用餐时间</view>
  20 + <view class="black-font font34r">{{bookInfo.order_date}}{{bookInfo.order_time}}</view>
  21 + </view>
  22 + <view class="flex-lr order-detail">
  23 + <view class="gray-deep-font font30r">用餐人数</view>
  24 + <view class="black-font font34r">{{bookInfo.pnum}}人</view>
  25 + </view>
  26 + <view class="flex-lr order-desk">
  27 + <view class="gray-deep-font font30r">预定座位</view>
  28 + <image class="order-status" src="../image/order-mask-before.png"></image>
  29 + <view class="flex-re" style="width:80%;flex-wrap:wrap;">
  30 + <block wx:for="{{selecttable}}">
  31 + <view class="order-desk-info">
  32 + <view class="flex-vc order-desk-detail" style="height:{{item.tid==2 ? '90' : '120'}}rpx;">
  33 + <view class="font28r black-font smooth">{{item.name}}</view>
  34 + <view class="font26r black-font" style="margin-top:6rpx;">{{item.table_pnum}}人</view>
  35 + </view>
  36 + <block wx:if="{{item.tid==2}}">
  37 + <view class="order-desk-type flex-cc white-font font20r">包间</view>
  38 + </block>
  39 + </view>
  40 + </block>
  41 + </view>
  42 + </view>
  43 + <view class="flex-lr order-detail">
  44 + <text class="gray-deep-font font30r" space="true" decode="true">预&ensp;订&ensp;人</text>
  45 + <view class="black-font font34r">{{bookInfo.rname}}</view>
  46 + </view>
  47 + <view class="flex-lr order-detail">
  48 + <view class="gray-deep-font font30r">手机号码</view>
  49 + <view class="black-font font34r" bindtap="getcall">{{bookInfo.phone}}</view>
  50 + </view>
  51 + <block wx:if="{{bookInfo.cusdem!='' && bookInfo.cusdem!='null'}}">
  52 + <view class="flex-lr order-detail">
  53 + <view class="gray-deep-font font30r">备注信息</view>
  54 + <view class="black-font font34r">{{bookInfo.cusdem}}</view>
  55 + </view>
  56 + </block>
  57 +</view>
  58 +<block wx:if="{{bookInfo.cusman!='' && bookInfo.cusman!='null'}}">
  59 + <view class="seller-staff flex-lr black-font font34r">
  60 + <view>客户经理</view>
  61 + <view>{{bookInfo.cusman}}</view>
  62 + </view>
  63 +</block>
  64 +
  65 +<!--通知预订人-->
  66 +<block wx:if="{{!bookInfo.code}}">
  67 + <view class="notice-button white-font font34r flex-cc" bindtap="noticeCall">通知预订人</view>
  68 + <noticeCall id="notice" phoneNumber="{{phoneNumber}}"></noticeCall>
  69 +</block>
  1 +view{
  2 + line-height:1.2;
  3 +}
  4 +
  5 +
  6 +/*商家信息*/
  7 +.seller-info{
  8 + width:680rpx;
  9 + height:auto;
  10 + padding:40rpx 0;
  11 + margin:0 auto;
  12 + border-bottom:1px solid #efeef3;
  13 +}
  14 +.seller-image{
  15 + width:60rpx;
  16 + height:60rpx;
  17 + border-radius:50%;
  18 + margin-right:20rpx;
  19 +}
  20 +.seller-address{
  21 + margin-top:10rpx;
  22 +}
  23 +.seller-location{
  24 + width:32rpx;
  25 + height:34rpx;
  26 +}
  27 +
  28 +
  29 +/*订单信息*/
  30 +.order-info{
  31 + width:680rpx;
  32 + height:auto;
  33 + padding:0 20rpx;
  34 + margin:0 auto;
  35 + border-bottom:1px solid #efeef3;
  36 + box-sizing:border-box;
  37 +}
  38 +.order-detail{
  39 + width:100%;
  40 + padding:40rpx 0;
  41 +}
  42 +.order-desk{
  43 + width:100%;
  44 + height:auto;
  45 + position:relative;
  46 +}
  47 +.order-status{
  48 + width:172rpx;
  49 + height:100rpx;
  50 + position:absolute;
  51 + left:0;
  52 + right:0;
  53 + top:0;
  54 + bottom:0;
  55 + margin:auto;
  56 + z-index:2;
  57 +}
  58 +.order-desk-info{
  59 + width:120rpx;
  60 + height:120rpx;
  61 + background:#A9E3E6;
  62 + border:1px solid #199095;
  63 + border-radius:10rpx;
  64 + position:relative;
  65 + overflow:hidden;
  66 + margin-left:20rpx;
  67 + margin-top:20rpx;
  68 +}
  69 +.order-desk-detail{
  70 + width:100%;
  71 + height:90rpx;
  72 +}
  73 +.order-desk-type{
  74 + width:100%;
  75 + height:30rpx;
  76 + background:#199095;
  77 + position:absolute;
  78 + left:0;
  79 + bottom:0;
  80 +}
  81 +
  82 +
  83 +
  84 +.seller-staff{
  85 + width:680rpx;
  86 + padding:40rpx 20rpx;
  87 + box-sizing:border-box;
  88 + margin:0 auto;
  89 +}
  90 +
  91 +
  92 +.notice-button{
  93 + width:675rpx;
  94 + height:85rpx;
  95 + background:#199095;
  96 + border-radius:10rpx;
  97 + margin:0 auto;
  98 + position:fixed;
  99 + left:0;
  100 + right:0;
  101 + bottom:50rpx;
  102 +}
  1 +var util = require('../../utils/util.js')
  2 +var uri=require('../../utils/uri.js')
  3 +var bookOrder=require('../../utils/bookCommon.js')
  4 +Page({
  5 + data:{
  6 + isloading:false,
  7 + pagex:1,
  8 + pagey:10,
  9 + sort:null
  10 +
  11 + },
  12 + onLoad:function(opt){
  13 + var radio=750/util.getsystem().windowWidth;
  14 + var contentHeight=util.getsystem().windowHeight-Math.ceil(165/radio)
  15 + this.setData({
  16 + sellerid:opt.sellerid ? opt.sellerid : util.cache('sellerid'),
  17 + systemInfo:util.getsystem(),
  18 + contentHeight:contentHeight,
  19 + listHeight:contentHeight-Math.ceil(140/radio)
  20 + })
  21 + util.cache('sellerid',opt.sellerid)
  22 + console.log(this.data.sellerid)
  23 + util.setBarTitle('预定本');
  24 +
  25 + },
  26 + onShow:function(){
  27 + var that=this;
  28 + this.setData({
  29 + pagex:1,
  30 + bookList:null,
  31 + isloading:false,
  32 + })
  33 + this.getbooklist();
  34 + var currentTime=Date.parse(new Date());
  35 + var timeobj=bookOrder.changedate(currentTime);
  36 + var afterobj=bookOrder.changedate(currentTime+24*60*60*1000);
  37 + console.log(afterobj)
  38 + util.postSuccessFun=function(json,uri_code){
  39 + switch (uri_code) {
  40 + case uri.CGI_USER_GETRESERVELIST__CODE:
  41 + if(json.ret==200){
  42 + if(json.data.length>0){
  43 + var list=json.data;
  44 + var templist=[];
  45 + var temp=[]
  46 + if(list.length>0){
  47 +
  48 + }
  49 + list.forEach(function(v,i){
  50 + var thisobj=bookOrder.changedate(parseInt(v.rdate)*1000);
  51 + var thisdate=thisobj.year+'年'+thisobj.month+'月'+thisobj.day;
  52 + var ifdate=false
  53 + if(temp.length>0){
  54 + if(temp.indexOf(thisdate)==-1){
  55 + ifdate=true
  56 + }else{
  57 + ifdate=false
  58 + }
  59 + }else{
  60 + temp.push(thisdate);
  61 + if(thisobj.year==timeobj.year && thisobj.month==timeobj.month && timeobj.day==thisobj.day){
  62 + templist.push({
  63 + date:thisdate,
  64 + datemask:'今天',
  65 + list:[]
  66 + })
  67 + }else if(thisobj.year==afterobj.year && thisobj.month==afterobj.month && afterobj.day==thisobj.day){
  68 + templist.push({
  69 + date:thisdate,
  70 + datemask:'明天',
  71 + list:[]
  72 + })
  73 + }else{
  74 + var myDate = new Date(parseInt(v.rdate)*1000);
  75 + var title=bookOrder.getweek(myDate.getDay());
  76 + templist.push({
  77 + date:thisdate,
  78 + datemask:title,
  79 + list:[]
  80 + })
  81 + }
  82 + }
  83 + if(ifdate==true){
  84 + temp.push(thisdate);
  85 + if(thisobj.year==timeobj.year && thisobj.month==timeobj.month && timeobj.day==thisobj.day){
  86 + templist.push({
  87 + date:thisdate,
  88 + datemask:'今天',
  89 + list:[]
  90 + })
  91 + }else if(thisobj.year==afterobj.year && thisobj.month==afterobj.month && afterobj.day==thisobj.day){
  92 + templist.push({
  93 + date:thisdate,
  94 + datemask:'明天',
  95 + list:[]
  96 + })
  97 + }else{
  98 + var myDate = new Date(parseInt(v.rdate)*1000);
  99 + var title=bookOrder.getweek(myDate.getDay());
  100 + templist.push({
  101 + date:thisdate,
  102 + datemask:title,
  103 + list:[]
  104 + })
  105 + }
  106 + }
  107 +
  108 + })
  109 + if(temp.length>0){
  110 + list.forEach(function(v,i){
  111 + var thisobj=bookOrder.changedate(parseInt(v.rdate)*1000);
  112 + console.log(thisobj)
  113 + var thisdate=thisobj.year+'年'+thisobj.month+'月'+thisobj.day;
  114 + templist.forEach(function(r,n) {
  115 + if (r.date == thisdate) {
  116 + v.order_date = thisobj.month + '月' + thisobj.day + '日';
  117 + v.order_time = thisobj.hour + ':' + (thisobj.minute == 0 ? thisobj.minute + '0' : thisobj.minute);
  118 + v.name=v.name.length>9 ? v.name.slice(0,9)+'等' : v.name;
  119 + r.list.push(v)
  120 + }
  121 +
  122 + })
  123 + })
  124 + }
  125 + if(that.data.bookList && that.data.pagex>1){
  126 + var booklist=that.data.bookList;
  127 + if(booklist[booklist.length-1].date==templist[0].date){
  128 + templist[0].list.forEach(function(v,i){
  129 + booklist[booklist.length-1].list.push(v)
  130 + })
  131 + templist.forEach(function(v,i){
  132 + if(i!=0){
  133 + booklist.push(v)
  134 + }
  135 +
  136 + })
  137 + }else{
  138 + templist.forEach(function(v,i){
  139 + booklist.push(v)
  140 + })
  141 + }
  142 + console.log(booklist)
  143 + that.setData({
  144 + bookList:booklist,
  145 + })
  146 + }else{
  147 + that.setData({
  148 + bookList:templist,
  149 + })
  150 + }
  151 + }
  152 + that.setData({
  153 + isloading:true,
  154 + currenlist:json.data
  155 + })
  156 +
  157 + }else{
  158 + that.setData({
  159 + isloading:true
  160 + })
  161 + }
  162 + break;
  163 + }
  164 + }
  165 + },
  166 + getbooklist:function(){
  167 + util.post(uri.CGI_USER_GETRESERVELIST,{sid:this.data.sellerid,x:this.data.pagex,y:10,sort:this.data.p_sort},uri.CGI_USER_GETRESERVELIST__CODE)
  168 + },
  169 + timeorder:function(){
  170 + if(this.data.p_sort==null){
  171 + this.setData({
  172 + p_sort:1
  173 + })
  174 + }else{
  175 + this.setData({
  176 + p_sort:null
  177 + })
  178 + }
  179 + var booklist=this.data.bookList;
  180 + booklist.forEach(function(v,i){
  181 + var thislist=[];
  182 + v.list.forEach(function(r,n){
  183 + thislist.unshift(r)
  184 + })
  185 + v.list=thislist;
  186 + })
  187 + this.setData({
  188 + bookList:booklist.reverse()
  189 + })
  190 + console.log(this.data.bookList)
  191 + },
  192 + addbooklist: function(e){
  193 + console.log(e)
  194 + if(e.detail.scrollTop>200*this.data.pagex && this.data.currenlist.length>0){
  195 + this.setData({
  196 + pagex:this.data.pagex+1
  197 + })
  198 + console.log(this.data.pagex)
  199 + this.getbooklist();
  200 + }
  201 + }
  202 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "nothingBook":"/components/book/nothing/nothing",
  7 + "bookList":"/components/book/list/list",
  8 + "actButton":"/components/book/action/action"
  9 + }
  10 +}
  1 +<block wx:if="{{isloading==true}}">
  2 + <block wx:if="{{!bookList}}">
  3 + <nothingBook></nothingBook>
  4 + </block>
  5 + <block wx:else>
  6 + <view style="height:{{contentHeight}}px;" bindcsroll="onPullDownRefresh">
  7 + <view class="book-page bg_white">
  8 + <view class="book-search flex-ll">
  9 + <image src="../image/search.png" class="search-icon"></image>
  10 + <input placeholder="桌位·预定人姓名·手机号" placeholder-class="font30r gray-font smooth" class="font30r black-font smooth search-input"/>
  11 + </view>
  12 + <scroll-view class="book-list" style="height:{{listHeight}}px;" scroll-y bindscroll="addbooklist">
  13 + <view class="book-list-thead flex-lr font34r black-font">
  14 + <view>桌号</view>
  15 + <view class="flex-cc" bindtap="timeorder">时间<image src="../image/direction.png" class="icon22-26" background-size="cover"></image></view>
  16 + <view class="flex-cc">状态</view>
  17 + <view class="flex-rr">操作</view>
  18 + </view>
  19 + <view class="book-list-body">
  20 + <block wx:for="{{bookList}}">
  21 + <view class="book-list-cut flex-ll font26r black-font">
  22 + <text space='true'>{{item.date}} {{item.datemask}}</text>
  23 + </view>
  24 + <block wx:for="{{item.list}}" wx:for-item="list">
  25 + <block wx:if="{{index!=0}}">
  26 + <view class="border-line"></view>
  27 + </block>
  28 + <bookList item="{{list}}"></bookList>
  29 + </block>
  30 + </block>
  31 + </view>
  32 + </scroll-view>
  33 + </view>
  34 + </view>
  35 + </block>
  36 +</block>
  37 +
  38 +<actButton></actButton>
  1 +page{
  2 + background:#efeef3;
  3 +}
  4 +.book-page{
  5 + width:100%;
  6 + padding-top:20rpx;
  7 +}
  8 +.book-search{
  9 + width:590rpx;
  10 + height:80rpx;
  11 + border-radius:40rpx;
  12 + box-shadow: 0 0 8px #ccc;
  13 + margin:0 auto;
  14 + margin-bottom:20rpx;
  15 +}
  16 +.search-icon{
  17 + width:40rpx;
  18 + height:40rpx;
  19 + margin-left:30rpx;
  20 +}
  21 +.search-input{
  22 + width:520rpx;
  23 + height:100%;
  24 + padding:10rpx;
  25 + box-sizing:border-box;
  26 +}
  27 +.book-list-thead{
  28 + width:100%;
  29 + height:120rpx;
  30 + padding:0 40rpx;
  31 + box-sizing:border-box;
  32 + font-weight:400;
  33 +}
  34 +.book-list-thead>view{
  35 + width:25%;
  36 +}
  37 +.icon22-26{
  38 + width:22rpx;
  39 + height:26rpx;
  40 + margin-left:8rpx;
  41 +}
  42 +.book-list-body{
  43 + width:100%;
  44 + height:auto;
  45 + box-sizing:border-box;
  46 +}
  47 +.book-list-cut{
  48 + width:100%;
  49 + height:80rpx;
  50 + background:#efeef3;
  51 + padding:0 40rpx;
  52 + box-sizing:border-box;
  53 +}
  54 +.border-line{
  55 + width:670rpx;
  56 + height:1px;
  57 + background:#efeef3;
  58 + margin:0 auto;
  59 +}
  1 +var util = require('../../utils/util.js')
  2 +var uri=require('../../utils/uri.js')
  3 +var bookOrder=require('../../utils/bookCommon.js')
  4 +Page({
  5 + data:{
  6 + grand:[
  7 + {
  8 + sex:1,
  9 + grand_title:'先生',
  10 + isselect:true
  11 + },
  12 + {
  13 + sex:2,
  14 + grand_title:'女士',
  15 + isselect:false
  16 + }
  17 + ],
  18 + name:'',
  19 + sex:1,
  20 + phone:'',
  21 + remark:'',
  22 + buttonhide:true,
  23 + pnum:'6'
  24 + },
  25 + onLoad:function(opt){
  26 + wx.removeStorage({
  27 + key:'tableid',
  28 + })
  29 + wx.removeStorage({
  30 + key:'tabletype',
  31 + })
  32 + util.setBarTitle('录入订座信息');
  33 + var selectmonth=opt.date.split('-')[0][0]=='0' ? opt.date.split('-')[0][1] : opt.date.split('-')[0];
  34 + var selectday=opt.date.split('-')[1][0]=='0' ? opt.date.split('-')[1][1] : opt.date.split('-')[1];
  35 + console.log(opt)
  36 + var stringTime =opt.year+'-'+opt.date+' ' +opt.time+':00';
  37 + console.log(stringTime)
  38 + var time=bookOrder.gettimestamp(stringTime);
  39 + console.log(time)
  40 + this.setData({
  41 + thisyear:opt.year,
  42 + selectdate:selectmonth+'月'+selectday+'日',
  43 + time_dur:opt.time,
  44 + sellerid:util.cache('sellerid'),
  45 + time:time,
  46 + pnum:util.cache('order_pnum') ? util.cache('order_pnum') : this.data.pnum,
  47 + })
  48 + this.getdesklist();
  49 + },
  50 + onShow:function(){
  51 + var that=this;
  52 + if(util.cache('tableid')){
  53 + var tables=util.cache('tableid');
  54 + var templist=this.data.templist;
  55 + var showdesk=[];
  56 + for(var i=0;i<tables.length;i++){
  57 + templist.forEach(function(r,n){
  58 + if(tables[i]==r.id){
  59 + r.isselect=true;
  60 + if(r.tid==2){
  61 + r.name=r.name.length>4 ? r.name.slice(0,3)+'...' : r.name;
  62 + showdesk.unshift(r);
  63 + }else {
  64 + r.name=r.name.length>4 ? r.name.slice(0,3)+'...' : r.name;
  65 + showdesk.push(r);
  66 + }
  67 + }
  68 + })
  69 + }
  70 + this.setData({
  71 + showdesk:showdesk.slice(0,2)
  72 + })
  73 + }
  74 + if(util.cache('tableid') && util.cache('tableid').length>0){
  75 + if(this.data.name!='' && this.data.phone!='' && !this.data.reminder){
  76 + this.setData({
  77 + buttonhide:false
  78 + })
  79 + }
  80 + }
  81 + util.postSuccessFun=function(json,uri_code){
  82 + switch (uri_code) {
  83 + case uri.CGI_USER_SETRESERVEINFO__CODE:
  84 + if(json.ret==200){
  85 + wx.showToast({
  86 + title:'添加成功',
  87 + duration:2000,
  88 + success:function(){
  89 + setTimeout(function () {
  90 + wx.navigateBack({
  91 + delta: 2
  92 + })
  93 + },2500)
  94 + }
  95 + })
  96 + }
  97 + break;
  98 + case uri.CGI_USER_GETTABLELIST__CODE:
  99 + console.log('xxxx',json.data);
  100 + var list=json.data;
  101 + var templist=[];
  102 + for(var key in list){
  103 + if(key!='typex' && key!='typey'){
  104 + list[key].list.forEach(function(v,i){
  105 + templist.push(v)
  106 + })
  107 +
  108 + }
  109 + }
  110 + var tempsan=[];
  111 + var tempbao=[];
  112 + var showdesk=[];
  113 + var temp={};
  114 + templist.forEach(function(v,i){
  115 + v.name=v.name.length>4 ? v.name.slice(0,3)+'...' : v.name;
  116 + if(!v.r_status){
  117 + if(v.tid==2){
  118 + tempbao.push(v);
  119 + v.isselect=false;
  120 + showdesk.unshift(v);
  121 + }else{
  122 + tempsan.push(v);
  123 + v.isselect=false;
  124 + showdesk.push(v);
  125 + }
  126 + }
  127 + if(v.tid==2){
  128 + if(!temp.hasOwnProperty("tabletype_2")){
  129 + temp['tabletype_2']=true
  130 + }
  131 +
  132 + }else{
  133 + if(!temp.hasOwnProperty("tabletype_1")){
  134 + temp['tabletype_1']=true
  135 + }
  136 + }
  137 + })
  138 + util.cache('tabletype',temp);
  139 + console.log(showdesk)
  140 + that.setData({
  141 + sancount:list.typex, //typex散座
  142 + baocount:list.typey, //typey包间
  143 + showdesk:showdesk.slice(0,2),
  144 + templist:templist
  145 +
  146 + })
  147 + break;
  148 + }
  149 + }
  150 + },
  151 + changetime:function(){
  152 + wx.navigateBack()
  153 + },
  154 + selectgrand:function(e){
  155 + var sex=e.currentTarget.dataset.sex;
  156 + console.log(sex)
  157 + var grandlist=this.data.grand;
  158 + grandlist.forEach(function(v,i){
  159 + v.isselect=false;
  160 + if(v.sex==sex){
  161 + v.isselect=true;
  162 + }
  163 + })
  164 + this.setData({
  165 + grand:grandlist,
  166 + sex:sex
  167 + })
  168 + },
  169 + condition:function(e){
  170 + var name=this.data.name;
  171 + var phone=e.detail.value;
  172 + var regExp = /^(86)?((13\d{9})|(15[0,1,2,3,5,6,7,8,9]\d{8})|(18[0,5,6,7,8,9]\d{8}))$/
  173 + if(!(regExp.test(phone))){
  174 + this.setData({
  175 + reminder:'手机格式不正确'
  176 + })
  177 + }else{
  178 + this.setData({
  179 + reminder:null
  180 + })
  181 + }
  182 + if(name!='' && !this.data.reminder && phone!='' && util.cache('tableid')){
  183 + this.setData({
  184 + buttonhide:false
  185 + })
  186 + }
  187 + },
  188 + changename:function(e){
  189 + this.setData({
  190 + name:e.detail.value
  191 + })
  192 + },
  193 + changephone:function(e){
  194 + this.setData({
  195 + phone:e.detail.value
  196 + })
  197 + },
  198 + changeremark:function(e){
  199 + this.setData({
  200 + remark:e.detail.value
  201 + })
  202 + },
  203 + ifAll:function(){
  204 + var name=this.data.name;
  205 + var phone=this.data.phone;
  206 + if(name!='' && !this.data.reminder && phone!='' && util.cache('tableid')){
  207 + this.setData({
  208 + buttonhide:false
  209 + })
  210 + }
  211 + },
  212 + formsubmit:function(){
  213 + console.log(this.data.time)
  214 + var formData={
  215 + sid:this.data.sellerid,
  216 + tid:util.cache('tableid').toString(),
  217 + rname:this.data.name, //姓名
  218 + phone:this.data.phone, //手机号
  219 + sex:this.data.sex, //性别
  220 + pnum:this.data.pnum, //人数
  221 + rdate:this.data.time, //时间
  222 + cusdem:this.data.remark //备注
  223 + }
  224 + console.log(formData)
  225 + util.post(uri.CGI_USER_SETRESERVEINFO,formData,uri.CGI_USER_SETRESERVEINFO__CODE)
  226 + },
  227 + changepnum:function(e){
  228 + console.log(e)
  229 + this.setData({
  230 + pnum:e.detail
  231 + })
  232 + this.getdesklist();
  233 + },
  234 + selectdesk:function(){
  235 + wx.navigateTo({
  236 + url:'b_desk?pnum='+this.data.pnum+'&year='+this.data.thisyear+'&date='+this.data.selectdate+'&time_dur='+this.data.time_dur
  237 + })
  238 + },
  239 + getdesklist:function(){
  240 + util.post(uri.CGI_USER_GETTABLELIST,{sid:this.data.sellerid,pnum:parseInt(this.data.pnum),rdate:this.data.time},uri.CGI_USER_GETTABLELIST__CODE)
  241 + },
  242 + binddesk:function(e){
  243 + var id=e.currentTarget.dataset.id;
  244 + var tables=util.cache('tableid') ? util.cache('tableid') : [];
  245 + var showdesk=this.data.showdesk;
  246 + showdesk.forEach(function(v,i){
  247 + if(v.id==id){
  248 + if(v.isselect==true){
  249 + var thisindex=tables.indexOf(id);
  250 + tables.splice(thisindex,1)
  251 + }else{
  252 + tables.push(id)
  253 + }
  254 + v.isselect=!v.isselect
  255 + }
  256 + })
  257 + util.cache('tableid',tables);
  258 + this.setData({
  259 + showdesk:showdesk
  260 + })
  261 + var name=this.data.name;
  262 + var phone=this.data.phone;
  263 + if(name!='' && !this.data.reminder && phone!='' && util.cache('tableid')){
  264 + this.setData({
  265 + buttonhide:false
  266 + })
  267 + }
  268 + }
  269 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "selectPeople":"/components/book/people/people"
  7 + }
  8 +}
  1 +<view class="other-info flex-lr">
  2 + <view class="selected-time flex-vc" bindtap="changetime">
  3 + <view class="font30r black-font">时间</view>
  4 + <view class="actual-time green-font font34r">{{selectdate}} {{time_dur}}</view>
  5 + </view>
  6 + <selectPeople bind:changepnum="changepnum" pnum="{{pnum}}"></selectPeople>
  7 +</view>
  8 +<view class="border-line"></view>
  9 +
  10 +<view class="advice-desk flex-lr">
  11 + <view class="black-font font30r">桌位</view>
  12 + <view>
  13 + <view class="font26r gray-deep-font flex-rr">(包间余{{baocount}}个,散座余{{sancount}}个)</view>
  14 + <view class="advice-desk-detail flex-rr">
  15 + <block wx:for="{{showdesk}}">
  16 + <block wx:if="{{item.tid==2}}">
  17 + <view class="order-desk-info {{item.isselect==true ? 'desk-active' : ''}}" bindtap="binddesk" data-id="{{item.id}}" data-type="{{item.tid}}">
  18 + <view class="flex-vc order-desk-detail">
  19 + <view class="font28r black-font smooth">{{item.name}}</view>
  20 + <view class="font26r black-font" style="margin-top:6rpx;">{{item.table_pnum}}人</view>
  21 + </view>
  22 + <view class="order-desk-type flex-cc white-font font20r">包间</view>
  23 + </view>
  24 + </block>
  25 + <block wx:else>
  26 + <view class="order-desk-info {{item.isselect==true ? 'desk-active' : ''}}" bindtap="binddesk" data-id="{{item.id}}" data-type="{{item.tid}}">
  27 + <view class="flex-vc order-desk-detail" style="height:100%;">
  28 + <view class="font28r black-font smooth">{{item.name}}</view>
  29 + <view class="font26r black-font" style="margin-top:6rpx;">6人</view>
  30 + </view>
  31 + </view>
  32 + </block>
  33 + </block>
  34 + <view class="flex-rr advice-more" bindtap="selectdesk">
  35 + <view style="padding-right:30rpx;" class="gray-deep-font font26r">更多</view>
  36 + <image src="../image/click.png" class="icon12-22"></image>
  37 + </view>
  38 + </view>
  39 + </view>
  40 +</view>
  41 +<view class="cut"></view>
  42 +
  43 +
  44 +<view class="book-info">
  45 + <view class="book-info-single flex-lr" style="align-items:flex-start;">
  46 + <input placeholder="请输入预订人姓名(必填)" placeholder-class="gray-font font34r" class="black-font font34r" maxlength="5" style="width:450rpx;" value="{{name}}" bindinput="changename" bindblur="ifAll"/>
  47 + <view class="book-info-grand flex-rr font28r gray-deep-font">
  48 + <block wx:for="{{grand}}">
  49 + <view class="book-grand flex-cc {{index==0 ? 'book-grand-border' : ''}} {{item.isselect==true ? 'book-grand-active white-font' : ''}}" bindtap="selectgrand" data-sex="{{item.sex}}">{{item.grand_title}}</view>
  50 + </block>
  51 + </view>
  52 + </view>
  53 + <view class="book-info-single flex-lr" style="align-items:flex-start;">
  54 + <input placeholder="请输入预订人手机号码(必填)" placeholder-class="gray-font font34r" class="black-font font34r" type="number" maxlength="11" bindblur="condition" bindinput="changephone" value="{{phone}}" style="color:{{reminder ? '#E14553' : '#353535'}};width:{{reminder ? 400 : 680}}rpx;"/>
  55 + <block wx:if="{{reminder}}">
  56 + <view class="flex-rr" style="height:100rpx;">
  57 + <view style="color:#E14553;" class="font28r">{{reminder}}</view>
  58 + <image src="../image/name-have.png" class="phone-reminder"></image>
  59 + </view>
  60 + </block>
  61 + </view>
  62 + <view class="book-info-single">
  63 + <input placeholder="请输入顾客要求(25字以内,选填)" placeholder-class="gray-font font34r" class="black-font font34r" maxlength="25" value="{{remark}}" bindinput="changeremark"/>
  64 + </view>
  65 +</view>
  66 +<view class="zhanwei"></view>
  67 +
  68 +
  69 +<view class="confirm-button white-font flex-vc font34r {{buttonhide==false ? 'confirm-button-active' : ''}}" bindtap="{{buttonhide==false ? 'formsubmit' : ''}}">确定</view>
  1 +view{
  2 + line-height:1.2;
  3 +}
  4 +.other-info{
  5 + width:100%;
  6 + height:220rpx;
  7 + padding:20rpx 0;
  8 + box-sizing:border-box;
  9 +}
  10 +.selected-time{
  11 + width:375rpx;
  12 + height:100%;
  13 + border-right:1px solid #efeef3;
  14 + box-sizing:border-box;
  15 +}
  16 +.actual-time{
  17 + margin-top:30rpx;
  18 +}
  19 +.border-line{
  20 + width:680rpx;
  21 + height:1px;
  22 + background:#efeef3;
  23 + margin:0 auto;
  24 +}
  25 +.advice-desk{
  26 + width:680rpx;
  27 + height:auto;
  28 + padding:40rpx 0;
  29 + margin:0 auto;
  30 +}
  31 +.advice-desk-detail{
  32 + margin-top:30rpx;
  33 +}
  34 +.order-desk-info{
  35 + width:120rpx;
  36 + height:120rpx;
  37 + background:#EBF8F8;
  38 + border:1px solid #199095;
  39 + border-radius:10rpx;
  40 + position:relative;
  41 + overflow:hidden;
  42 + margin-right:40rpx;
  43 +}
  44 +.desk-active{
  45 + background:#A9E3E6;
  46 +}
  47 +.order-desk-detail{
  48 + width:100%;
  49 + height:90rpx;
  50 +}
  51 +.order-desk-type{
  52 + width:100%;
  53 + height:30rpx;
  54 + background:#199095;
  55 + position:absolute;
  56 + left:0;
  57 + bottom:0;
  58 +}
  59 +.advice-more{
  60 + padding:20rpx 0;
  61 + padding-left:30rpx;
  62 +}
  63 +.cut{
  64 + width:100%;
  65 + height:4px;
  66 + background:#efeef3;
  67 +}
  68 +
  69 +
  70 +
  71 +.book-info{
  72 + width:680rpx;
  73 + padding-top:20rpx;
  74 + margin:0 auto;
  75 +}
  76 +.book-info-single{
  77 + width:100%;
  78 + height:120rpx;
  79 + padding-top:80rpx;
  80 + border-bottom:1px solid #efeef3;
  81 +}
  82 +.book-info-single>input{
  83 + width:100%;
  84 + height:100rpx;
  85 +}
  86 +.book-info-grand{
  87 + height:50rpx;
  88 + border:1px solid #199095;
  89 + margin-top:20rpx;
  90 +}
  91 +.book-grand{
  92 + width:90rpx;
  93 + height:100%;
  94 + box-sizing:border-box;
  95 +}
  96 +.book-grand-active{
  97 + background:rgba(25,153,149,.8);
  98 +}
  99 +.book-grand-border{
  100 + border-right:1px solid #199095;
  101 +}
  102 +.phone-reminder{
  103 + width:32rpx;
  104 + height:32rpx;
  105 + margin-left:20rpx;
  106 +}
  107 +
  108 +.zhanwei{
  109 + width:100%;
  110 + height:205rpx;
  111 + background:#efeef3;
  112 +}
  113 +
  114 +
  115 +.confirm-button{
  116 + width:680rpx;
  117 + height:85rpx;
  118 + background:#199095;
  119 + position:fixed;
  120 + left:0;
  121 + right:0;
  122 + bottom:60rpx;
  123 + margin:0 auto;
  124 + border-radius:10rpx;
  125 + opacity:.6;
  126 +}
  127 +.confirm-button-active{
  128 + opacity:1;
  129 +}
  1 +{
  2 + "description": "项目配置文件。",
  3 + "setting": {
  4 + "urlCheck": true,
  5 + "es6": true,
  6 + "postcss": true,
  7 + "minified": true,
  8 + "newFeature": true
  9 + },
  10 + "compileType": "miniprogram",
  11 + "libVersion": "1.9.91",
  12 + "appid": "wxd3dc4206c76f14fc",
  13 + "projectname": "xcx-book",
  14 + "isGameTourist": false,
  15 + "condition": {
  16 + "search": {
  17 + "current": -1,
  18 + "list": []
  19 + },
  20 + "conversation": {
  21 + "current": -1,
  22 + "list": []
  23 + },
  24 + "game": {
  25 + "currentL": -1,
  26 + "list": []
  27 + },
  28 + "miniprogram": {
  29 + "current": 0,
  30 + "list": [
  31 + {
  32 + "id": 0,
  33 + "name": "预定本",
  34 + "pathName": "pages/book/b_index",
  35 + "query": "sellerid=1"
  36 + },
  37 + {
  38 + "id": 1,
  39 + "name": "经营报表",
  40 + "pathName": "pages/report/r_index",
  41 + "query": ""
  42 + },
  43 + {
  44 + "id": -1,
  45 + "name": "经营中心",
  46 + "pathName": "pages/me/s_index",
  47 + "query": ""
  48 + },
  49 + {
  50 + "id": -1,
  51 + "name": "报表详情",
  52 + "pathName": "pages/report/r_detail",
  53 + "query": ""
  54 + },
  55 + {
  56 + "id": -1,
  57 + "name": "菜品列表",
  58 + "pathName": "pages/report/r_cook",
  59 + "query": ""
  60 + },
  61 + {
  62 + "id": -1,
  63 + "name": "时间选择",
  64 + "pathName": "pages/report/r_time",
  65 + "query": ""
  66 + }
  67 + ]
  68 + }
  69 + }
  70 +}
  1 +var util = require('util.js')
  2 +var uri=require('uri.js')
  3 +module.exports = {
  4 + onShareAppMessage:function() {
  5 + var token=util.cache(uri.CACHE__TOKEN);
  6 + if(!token) {
  7 + wx.navigateTo({
  8 + url:"/pages/login/index"
  9 + });
  10 +
  11 + }else{
  12 + console.log("this.data.share_xcx_url",this.data.share_xcx_url)
  13 + this.sharecallback();
  14 + return {
  15 + title: this.data.share_xcx_name?this.data.share_xcx_name:(this.data.share_xcx_title?this.data.share_xcx_title:'纳极,最懂你的店铺管家'),
  16 + desc: this.data.share_xcx_desc?this.data.share_xcx_desc:'',
  17 + path: this.data.share_xcx_url?this.data.share_xcx_url:'/pages/index/index',
  18 + }
  19 + }
  20 + },
  21 + sharecallback:function(){
  22 + util.post(uri.CGI__ASYN_TOURIST_OPRRATION,{provider_id:this.data.provider_id,type:this.data.sharetype},uri.CGI__ASYN_TOURIST_OPRRATION__CODE);
  23 + },
  24 + onRefresh:function(){
  25 + this.setData({
  26 + refreshpage:true
  27 + })
  28 + var pageinfo=getCurrentPages();
  29 + var pagelength=pageinfo.length;
  30 + var n_pageinfo=pageinfo[pagelength-1];
  31 + var turnpage='/'+n_pageinfo.route;
  32 + if(JSON.stringify(n_pageinfo.options)!='{}'){
  33 + turnpage+='?';
  34 + for(var opt in n_pageinfo.options){
  35 + turnpage+=opt+'='+n_pageinfo.options[opt]+'&';
  36 + }
  37 + }
  38 + wx.redirectTo({
  39 + url: turnpage,
  40 + })
  41 + },
  42 + restartLogin:function(){
  43 + console.log('hahah');
  44 + var pages = getCurrentPages();
  45 + var num = pages.length;
  46 + console.log('hahah');
  47 + wx.openSetting({
  48 + success: (res) => {
  49 + console.log('openSetting',res);
  50 + res.authSetting = {
  51 + "scope.userInfo": true,
  52 + "scope.userLocation": true
  53 + }
  54 + /*wx.redirectTo({
  55 + url:'/pages/index/s_index',
  56 + })*/
  57 + wx.redirectTo({
  58 + url:'../index/s_index',
  59 + })
  60 + },
  61 + fail:(res) => {
  62 + console.log('failsetting');
  63 + wx.redirectTo({
  64 + url:'../me/s_index',
  65 + })
  66 + }
  67 + })
  68 + },
  69 +};
  1 +module.exports ={
  2 + //时间戳转化日期
  3 + changedate:function(timestamp){
  4 + var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  5 + var Y= date.getFullYear();
  6 + var M =date.getMonth()+1;
  7 + var D =date.getDate();
  8 + var h = date.getHours();
  9 + var m = date.getMinutes();
  10 + var s = date.getSeconds();
  11 + return {year:Y,month:M,day:D,hour:h,minute:m,second:s};
  12 +
  13 + },
  14 + //获取星期
  15 + getweek:function (index) {
  16 + var week=['周日','周一','周二','周三','周四','周五','周六'];
  17 + return week[index]
  18 + },
  19 + //判断是否是整数
  20 + isInteger:function (obj) {
  21 + return obj%1 === 0
  22 + },
  23 + //时间转化时间戳
  24 + gettimestamp:function(stringTime){
  25 + var date = new Date(stringTime.replace(/-/g, '/'));
  26 + var timestamp2=Date.parse(date)/1000;
  27 + return timestamp2
  28 + },
  29 + //日期转换 8月8日----08-08
  30 + get_date:function(thiadate){
  31 + var thismoth=thiadate.split('月')[0];
  32 + var thisday=thiadate.split('月')[1].slice(0,-1);
  33 + var timedate=(parseInt(thismoth)<10 ? '0'+thismoth : thismoth)+'-'+(parseInt(thisday)<10 ? '0'+thisday : thisday);
  34 + return timedate;
  35 + },
  36 + //日期转换 08-08----8月8日
  37 + getdate_num:function(thisdate){
  38 + var thismonth=thisdate.split('-')[0][0]=='0' ? thisdate.split('-')[0][1] : thisdate.split('-')[0];
  39 + var thisday=thisdate.split('-')[1][0]=='0' ? thisdate.split('-')[1][1] : thisdate.split('-')[1];
  40 + console.log()
  41 + var timedate=thismonth+'月'+thisday+'日';
  42 + return timedate;
  43 + }
  44 +}
  1 +//application id got from MTAMTA analysis
  2 +var MTA_APP_ID = ''; //常规统计id
  3 +var MTA_EVENT_ID = ''; //自定义事件id
  4 +//data report remote address
  5 +var MTA_API_BASE = 'https://pingtas.qq.com/pingd';
  6 +//MTA wechat apps analysis storage key prefix
  7 +var MTA_VAR_PREFIX = '_mta_';
  8 +
  9 +function getNetworkType(a){wx.getNetworkType({success:function(b){a(b.networkType)}})}function getSystemInfo(){var a=wx.getSystemInfoSync();return{adt:a.model,scl:a.pixelRatio,scr:a.windowWidth+"x"+a.windowHeight,lg:a.language,fl:a.version}}function getUID(){try{return wx.getStorageSync(MTA_VAR_PREFIX+"auid")}catch(a){}}function setUID(){try{var a=getRandom();wx.setStorageSync(MTA_VAR_PREFIX+"auid",a);return a}catch(b){}}
  10 +function getSID(){try{return wx.getStorageSync(MTA_VAR_PREFIX+"ssid")}catch(a){}}function setSID(){try{var a="s"+getRandom();wx.setStorageSync(MTA_VAR_PREFIX+"ssid",a);return a}catch(b){}}function getRandom(a){return(a||"")+Math.round(2147483647*(Math.random()||.5))*+new Date%1E10}function getPagePath(){try{var a=getCurrentPages(),b="/";0<a.length&&(b=a.pop().__route__);return b}catch(e){console.log("get current page path error:"+e)}}
  11 +function getMainInfo(){var a={dm:"wechat.apps.xx",url:getPagePath(),pvi:"",si:"",ty:2};a.pvi=function(){var b=getUID();b||(a.ty=1,b=setUID());return b}();a.si=function(){var a=getSID();a||(a=setSID());return a}();return a}function getBasicInfo(){var a=getSystemInfo();getNetworkType(function(a){wx.setStorageSync(MTA_VAR_PREFIX+"ntdata",a)});a.ct=wx.getStorageSync(MTA_VAR_PREFIX+"ntdata")||"4g";return a}function getExtentInfo(){return{r2:MTA_APP_ID,r4:"wx"}}
  12 +module.exports={initLaunch:function(){setSID()},rptMain:function(){if(""!=MTA_APP_ID){for(var a=[],b=0,e=[getMainInfo(),getBasicInfo(),getExtentInfo(),{random:+new Date}],d=e.length;b<d;b++)for(var f in e[b])e[b].hasOwnProperty(f)&&a.push(f+"="+(e[b][f]||""));wx.request({url:MTA_API_BASE+"?"+a.join("&").toLowerCase()})}},eventStat:function(a,b){if(""!=MTA_EVENT_ID){var e=[],d=getMainInfo(),f=getExtentInfo();d.dm="wxapps.click";d.url=a;f.r2=MTA_EVENT_ID;var c;c="undefined"===typeof b?{}:b;var k=[],
  13 +g;for(g in c)c.hasOwnProperty(g)&&k.push(g+"="+c[g]);c=k.join(";");f.r5=c;c=0;d=[d,getBasicInfo(),f,{random:+new Date}];for(f=d.length;c<f;c++)for(var h in d[c])d[c].hasOwnProperty(h)&&e.push(h+"="+(d[c][h]||""));wx.request({url:MTA_API_BASE+"?"+e.join("&").toLowerCase()})}}};
  1 +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.pingpp=e()}}(function(){return function e(n,t,r){function i(a,l){if(!t[a]){if(!n[a]){var c="function"==typeof require&&require;if(!l&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var d=t[a]={exports:{}};n[a][0].call(d.exports,function(e){var t=n[a][1][e];return i(t?t:e)},d,d.exports,e,n,t,r)}return t[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,n,t){var r=e('./payment_elements.js');n.exports={userCallback:void 0,innerCallback:function(e,n){'function'==typeof this.userCallback&&('undefined'==typeof n&&(n=this.error()),this.userCallback(e,n),this.userCallback=void 0,r.clear())},error:function(e,n){return e='undefined'==typeof e?'':e,n='undefined'==typeof n?'':n,{msg:e,extra:n}}}},{"./payment_elements.js":8}],2:[function(e,n,t){var r=e('../stash'),i=e('../callbacks'),o={}.hasOwnProperty;n.exports={handleCharge:function(e){for(var n=e.credential[e.channel],t=['appId','timeStamp','nonceStr','package','signType','paySign'],a=0;a<t.length;a++)if(!o.call(n,t[a]))return void i.innerCallback('fail',i.error('invalid_credential','missing_field_'+t[a]));r.jsApiParameters=n,this.callpay()},wxLiteEnabled:function(){return'undefined'!=typeof wx&&wx.requestPayment},callpay:function(){if(!this.wxLiteEnabled())return void console.log('请在微信小程序中打开');var e=r.jsApiParameters;delete e.appId,e.complete=function(e){'requestPayment:ok'===e.errMsg&&i.innerCallback('success'),'requestPayment:cancel'===e.errMsg&&i.innerCallback('cancel',i.error('用户取消支付')),'undefined'!==e.err_code&&'undefined'!==e.err_desc&&i.innerCallback('fail',i.error(e.err_desc,e))},wx.requestPayment(e)},runTestMode:function(e){wx.showModal({title:'提示',content:'因 "微信小程序" 限制 域名的原因 暂不支持 模拟付款 请使用 livekey 获取 charge 进行支付'})}}},{"../callbacks":1,"../stash":9}],3:[function(e,n,t){var r=e('./utils'),i=e('./stash'),o=e('./libs/md5'),a={seperator:'###',limit:1,report_url:'https://statistics.pingxx.com/one_stats',timeout:100},l=function(e,n){var t=new RegExp('(^|&)'+n+'=([^&]*)(&|$)','i'),r=e.substr(0).match(t);return null!==r?unescape(r[2]):null},c=function(){return navigator.userAgent},u=function(){return window.location.host};a.store=function(e){if('undefined'!=typeof localStorage&&null!==localStorage){var n=this,t={};t.app_id=e.app_id||i.app_id||'app_not_defined',t.ch_id=e.ch_id||'',t.channel=e.channel||'',t.type=e.type||'',t.user_agent=c(),t.host=u(),t.time=(new Date).getTime(),t.puid=i.puid;var r='app_id='+t.app_id+'&channel='+t.channel+'&ch_id='+t.ch_id+'&host='+t.host+'&time='+t.time+'&type='+t.type+'&user_agent='+t.user_agent+'&puid='+t.puid,o=r;null!==localStorage.getItem('PPP_ONE_STATS')&&0!==localStorage.getItem('PPP_ONE_STATS').length&&(o=localStorage.getItem('PPP_ONE_STATS')+n.seperator+r);try{localStorage.setItem('PPP_ONE_STATS',o)}catch(a){}}},a.send=function(){if('undefined'!=typeof localStorage&&null!==localStorage){var e=this,n=localStorage.getItem('PPP_ONE_STATS');if(!(null===n||n.split(e.seperator).length<e.limit))try{for(var t=[],i=n.split(e.seperator),a=o(i.join('&')),c=0;c<i.length;c++)t.push({app_id:l(i[c],'app_id'),channel:l(i[c],'channel'),ch_id:l(i[c],'ch_id'),host:l(i[c],'host'),time:l(i[c],'time'),type:l(i[c],'type'),user_agent:l(i[c],'user_agent'),puid:l(i[c],'puid')});r.request(e.report_url,'POST',t,function(e,n){200==n&&localStorage.removeItem('PPP_ONE_STATS')},void 0,{'X-Pingpp-Report-Token':a})}catch(u){}}},a.report=function(e){var n=this;n.store(e),setTimeout(function(){n.send()},n.timeout)},n.exports=a},{"./libs/md5":5,"./stash":9,"./utils":11}],4:[function(e,n,t){var r=e('./stash'),i=e('./utils'),o=e('./collection');n.exports={SRC_URL:'https://cookie.pingxx.com',init:function(){var e=this;i.documentReady(function(){e.initPuid()})},initPuid:function(){if('undefined'!=typeof window&&'undefined'!=typeof localStorage){var e=localStorage.getItem('pingpp_uid');if(null===e){e=i.randomString();try{localStorage.setItem('pingpp_uid',e)}catch(n){}}if(r.puid=e,!document.getElementById('p_analyse_iframe')){var t=document.createElement('iframe');t.id='p_analyse_iframe',t.src=this.SRC_URL+'/?puid='+e,t.style.display='none',document.body.appendChild(t)}setTimeout(function(){o.send()},0)}}}},{"./collection":3,"./stash":9,"./utils":11}],5:[function(e,n,t){!function(){function e(e,n){var t=(65535&e)+(65535&n),r=(e>>16)+(n>>16)+(t>>16);return r<<16|65535&t}function t(e,n){return e<<n|e>>>32-n}function r(n,r,i,o,a,l){return e(t(e(e(r,n),e(o,l)),a),i)}function i(e,n,t,i,o,a,l){return r(n&t|~n&i,e,n,o,a,l)}function o(e,n,t,i,o,a,l){return r(n&i|t&~i,e,n,o,a,l)}function a(e,n,t,i,o,a,l){return r(n^t^i,e,n,o,a,l)}function l(e,n,t,i,o,a,l){return r(t^(n|~i),e,n,o,a,l)}function c(n,t){n[t>>5]|=128<<t%32,n[(t+64>>>9<<4)+14]=t;var r,c,u,d,s,f=1732584193,p=-271733879,h=-1732584194,m=271733878;for(r=0;r<n.length;r+=16)c=f,u=p,d=h,s=m,f=i(f,p,h,m,n[r],7,-680876936),m=i(m,f,p,h,n[r+1],12,-389564586),h=i(h,m,f,p,n[r+2],17,606105819),p=i(p,h,m,f,n[r+3],22,-1044525330),f=i(f,p,h,m,n[r+4],7,-176418897),m=i(m,f,p,h,n[r+5],12,1200080426),h=i(h,m,f,p,n[r+6],17,-1473231341),p=i(p,h,m,f,n[r+7],22,-45705983),f=i(f,p,h,m,n[r+8],7,1770035416),m=i(m,f,p,h,n[r+9],12,-1958414417),h=i(h,m,f,p,n[r+10],17,-42063),p=i(p,h,m,f,n[r+11],22,-1990404162),f=i(f,p,h,m,n[r+12],7,1804603682),m=i(m,f,p,h,n[r+13],12,-40341101),h=i(h,m,f,p,n[r+14],17,-1502002290),p=i(p,h,m,f,n[r+15],22,1236535329),f=o(f,p,h,m,n[r+1],5,-165796510),m=o(m,f,p,h,n[r+6],9,-1069501632),h=o(h,m,f,p,n[r+11],14,643717713),p=o(p,h,m,f,n[r],20,-373897302),f=o(f,p,h,m,n[r+5],5,-701558691),m=o(m,f,p,h,n[r+10],9,38016083),h=o(h,m,f,p,n[r+15],14,-660478335),p=o(p,h,m,f,n[r+4],20,-405537848),f=o(f,p,h,m,n[r+9],5,568446438),m=o(m,f,p,h,n[r+14],9,-1019803690),h=o(h,m,f,p,n[r+3],14,-187363961),p=o(p,h,m,f,n[r+8],20,1163531501),f=o(f,p,h,m,n[r+13],5,-1444681467),m=o(m,f,p,h,n[r+2],9,-51403784),h=o(h,m,f,p,n[r+7],14,1735328473),p=o(p,h,m,f,n[r+12],20,-1926607734),f=a(f,p,h,m,n[r+5],4,-378558),m=a(m,f,p,h,n[r+8],11,-2022574463),h=a(h,m,f,p,n[r+11],16,1839030562),p=a(p,h,m,f,n[r+14],23,-35309556),f=a(f,p,h,m,n[r+1],4,-1530992060),m=a(m,f,p,h,n[r+4],11,1272893353),h=a(h,m,f,p,n[r+7],16,-155497632),p=a(p,h,m,f,n[r+10],23,-1094730640),f=a(f,p,h,m,n[r+13],4,681279174),m=a(m,f,p,h,n[r],11,-358537222),h=a(h,m,f,p,n[r+3],16,-722521979),p=a(p,h,m,f,n[r+6],23,76029189),f=a(f,p,h,m,n[r+9],4,-640364487),m=a(m,f,p,h,n[r+12],11,-421815835),h=a(h,m,f,p,n[r+15],16,530742520),p=a(p,h,m,f,n[r+2],23,-995338651),f=l(f,p,h,m,n[r],6,-198630844),m=l(m,f,p,h,n[r+7],10,1126891415),h=l(h,m,f,p,n[r+14],15,-1416354905),p=l(p,h,m,f,n[r+5],21,-57434055),f=l(f,p,h,m,n[r+12],6,1700485571),m=l(m,f,p,h,n[r+3],10,-1894986606),h=l(h,m,f,p,n[r+10],15,-1051523),p=l(p,h,m,f,n[r+1],21,-2054922799),f=l(f,p,h,m,n[r+8],6,1873313359),m=l(m,f,p,h,n[r+15],10,-30611744),h=l(h,m,f,p,n[r+6],15,-1560198380),p=l(p,h,m,f,n[r+13],21,1309151649),f=l(f,p,h,m,n[r+4],6,-145523070),m=l(m,f,p,h,n[r+11],10,-1120210379),h=l(h,m,f,p,n[r+2],15,718787259),p=l(p,h,m,f,n[r+9],21,-343485551),f=e(f,c),p=e(p,u),h=e(h,d),m=e(m,s);return[f,p,h,m]}function u(e){var n,t='';for(n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}function d(e){var n,t=[];for(t[(e.length>>2)-1]=void 0,n=0;n<t.length;n+=1)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return t}function s(e){return u(c(d(e),8*e.length))}function f(e,n){var t,r,i=d(e),o=[],a=[];for(o[15]=a[15]=void 0,i.length>16&&(i=c(i,8*e.length)),t=0;t<16;t+=1)o[t]=909522486^i[t],a[t]=1549556828^i[t];return r=c(o.concat(d(n)),512+8*n.length),u(c(a.concat(r),640))}function p(e){var n,t,r='0123456789abcdef',i='';for(t=0;t<e.length;t+=1)n=e.charCodeAt(t),i+=r.charAt(n>>>4&15)+r.charAt(15&n);return i}function h(e){return unescape(encodeURIComponent(e))}function m(e){return s(h(e))}function _(e){return p(m(e))}function y(e,n){return f(h(e),h(n))}function g(e,n){return p(y(e,n))}function v(e,n,t){return n?t?y(n,e):g(n,e):t?m(e):_(e)}n.exports=v}()},{}],6:[function(e,n,t){var r=e('./version').v,i=e('./testmode'),o=e('./callbacks'),a=e('./mods'),l=e('./stash'),c=e('./collection'),u=e('./payment_elements'),d={}.hasOwnProperty,PingppSDK=function(){e('./init').init()};PingppSDK.prototype={version:r,createPayment:function(e,n,t,r){if('function'==typeof n&&(o.userCallback=n),u.init(e),!d.call(u,'id'))return void o.innerCallback('fail',o.error('invalid_charge','no_charge_id'));if(!d.call(u,'channel'))return void o.innerCallback('fail',o.error('invalid_charge','no_channel'));d.call(u,'app')&&('string'==typeof u.app?l.app_id=u.app:'object'==typeof u.app&&'string'==typeof u.app.id&&(l.app_id=u.app.id)),c.report({type:'pure_sdk_click',channel:u.channel,ch_id:u.id});var s=u.channel;if(!d.call(u,'credential'))return void o.innerCallback('fail',o.error('invalid_charge','no_credential'));if(!u.credential)return void o.innerCallback('fail',o.error('invalid_credential','credential_is_undefined'));if(!d.call(u.credential,s))return void o.innerCallback('fail',o.error('invalid_credential','credential_is_incorrect'));if(!d.call(u,'livemode'))return void o.innerCallback('fail',o.error('invalid_charge','no_livemode_field'));var f=a.getChannelModule(s);return'undefined'==typeof f?(console.error('channel module "'+s+'" is undefined'),void o.innerCallback('fail',o.error('invalid_channel','channel module "'+s+'" is undefined'))):u.livemode===!1?void(d.call(f,'runTestMode')?f.runTestMode(u):i.runTestMode(u)):('undefined'!=typeof t&&(l.signature=t),'boolean'==typeof r&&(l.debug=r),void f.handleCharge(u))},setAPURL:function(e){l.APURL=e}},n.exports=new PingppSDK},{"./callbacks":1,"./collection":3,"./init":4,"./mods":7,"./payment_elements":8,"./stash":9,"./testmode":10,"./version":12}],7:[function(e,n,t){var r={}.hasOwnProperty,i={};n.exports=i,i.channels={wx_lite:e('./channels/wx_lite')},i.extras={},i.getChannelModule=function(e){if(r.call(i.channels,e))return i.channels[e]},i.getExtraModule=function(e){if(r.call(i.extras,e))return i.extras[e]}},{"./channels/wx_lite":2}],8:[function(e,n,t){var r=e('./callbacks'),i={}.hasOwnProperty;n.exports={id:null,or_id:null,channel:null,app:null,credential:{},extra:null,livemode:null,order_no:null,time_expire:null,init:function(e){var n;if('string'==typeof e)try{n=JSON.parse(e)}catch(t){return void r.innerCallback('fail',r.error('json_decode_fail',t))}else n=e;if('undefined'==typeof n)return void r.innerCallback('fail',r.error('json_decode_fail'));if(i.call(n,'object')&&'order'==n.object){n.or_id=n.id,n.id=n.charge,n.order_no=n.merchant_order_no;var o=n.charge_essentials;n.channel=o.channel,n.credential=o.credential,n.extra=o.extra}for(var a in this)i.call(n,a)&&(this[a]=n[a]);return this},clear:function(){for(var e in this)'function'!=typeof this[e]&&(this[e]=null)}}},{"./callbacks":1}],9:[function(e,n,t){n.exports={}},{}],10:[function(e,n,t){var r=e('./utils'),i={}.hasOwnProperty;n.exports={PINGPP_MOCK_URL:'http://sissi.pingxx.com/mock.php',runTestMode:function(e){var n={ch_id:e.id,scheme:'http',channel:e.channel};i.call(e,'or_id')&&null!==e.or_id&&(n.or_id=e.or_id),i.call(e,'order_no')?n.order_no=e.order_no:i.call(e,'orderNo')&&(n.order_no=e.orderNo),i.call(e,'time_expire')?n.time_expire=e.time_expire:i.call(e,'timeExpire')&&(n.time_expire=e.timeExpire),i.call(e,'extra')&&(n.extra=encodeURIComponent(JSON.stringify(e.extra))),r.redirectTo(this.PINGPP_MOCK_URL+'?'+r.stringifyData(n))}}},{"./utils":11}],11:[function(e,n,t){var r={}.hasOwnProperty,i=n.exports={stringifyData:function(e,n,t){'undefined'==typeof t&&(t=!1);var i=[];for(var o in e)r.call(e,o)&&'function'!=typeof e[o]&&('bfb_wap'==n&&'url'==o||'yeepay_wap'==n&&'mode'==o||'channel_url'!=o&&i.push(o+'='+(t?encodeURIComponent(e[o]):e[o])));return i.join('&')},request:function(e,n,t,o,a,l){if('undefined'==typeof XMLHttpRequest)return void console.log('Function XMLHttpRequest is undefined.');var c=new XMLHttpRequest;if('undefined'!=typeof c.timeout&&(c.timeout=6e3),n=n.toUpperCase(),'GET'===n&&'object'==typeof t&&t&&(e+='?'+i.stringifyData(t,'',!0)),c.open(n,e,!0),'undefined'!=typeof l)for(var u in l)r.call(l,u)&&c.setRequestHeader(u,l[u]);'POST'===n?(c.setRequestHeader('Content-type','application/json; charset=utf-8'),c.send(JSON.stringify(t))):c.send(),'undefined'==typeof o&&(o=function(){}),'undefined'==typeof a&&(a=function(){}),c.onreadystatechange=function(){4==c.readyState&&o(c.responseText,c.status,c)},c.onerror=function(e){a(c,0,e)}},formSubmit:function(e,n,t){if('undefined'==typeof window)return void console.log('Not a browser, form submit url: '+e);var i=document.createElement('form');i.setAttribute('method',n),i.setAttribute('action',e);for(var o in t)if(r.call(t,o)){var a=document.createElement('input');a.setAttribute('type','hidden'),a.setAttribute('name',o),a.setAttribute('value',t[o]),i.appendChild(a)}document.body.appendChild(i),i.submit()},randomString:function(e){'undefined'==typeof e&&(e=32);for(var n='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',t=n.length,r='',i=0;i<e;i++)r+=n.charAt(Math.floor(Math.random()*t));return r},redirectTo:function(e){return'undefined'==typeof window?void console.log('Not a browser, redirect url: '+e):void(window.location.href=e)},inWeixin:function(){if('undefined'==typeof navigator)return!1;var e=navigator.userAgent.toLowerCase();return e.indexOf('micromessenger')!==-1},documentReady:function(e){return'undefined'==typeof document?void e():void('loading'!=document.readyState?e():document.addEventListener('DOMContentLoaded',e))},loadUrlJs:function(e,n,t){var r=document.getElementsByTagName('head')[0],i=null;null==document.getElementById(e)?(i=document.createElement('script'),i.setAttribute('type','text/javascript'),i.setAttribute('src',n),i.setAttribute('id',e),i.async=!0,null!=t&&(i.onload=i.onreadystatechange=function(){return!i.ready&&void(i.readyState&&'loaded'!=i.readyState&&'complete'!=i.readyState||(i.ready=!0,t()))}),r.appendChild(i)):null!=t&&t()}}},{}],12:[function(e,n,t){n.exports={v:'2.1.7'}},{}]},{},[6])(6)});
  2 +//# sourceMappingURL=pingpp.js.map
  1 +//正式
  2 +var uri={
  3 +
  4 + HOST__LINE:'https://xt05.colorcun.com/?s=',
  5 +
  6 + //获取商家信息
  7 + CGI__USER_GETSELLERBYID: 'App.Seller.GetSellerById',
  8 + CGI__USER_GETSELLERBYID__CODE: 18001,
  9 +
  10 +
  11 + //录入订座信息
  12 + CGI_USER_SETRESERVEINFO:'App.Reserve.SetReserveInfo',
  13 + CGI_USER_SETRESERVEINFO__CODE:19016,
  14 +
  15 +
  16 + //商家预订本列表
  17 + CGI_USER_GETRESERVELIST:'App.Reserve.GetReserveList',
  18 + CGI_USER_GETRESERVELIST__CODE:19017,
  19 +
  20 +
  21 + //获取座位信息
  22 + CGI_USER_GETTABLELIST:'App.Reserve.GetTableList',
  23 + CGI_USER_GETTABLELIST__CODE:19018,
  24 +
  25 + //查询某个商家下营业信息
  26 + CGI_USER_GETOPERDATEBYDAY:'App.Report.GetOperDateByDay',
  27 + CGI_USER_GETOPERDATEBYDAY__CODE:19019,
  28 +
  29 + //热销、滞销菜品列表
  30 + CGI_USER_GETSALESBYCOOKBOOK:'App.Report.GetSalesByCookbook',
  31 + CGI_USER_GETSALESBYCOOKBOOK__CODE:19020,
  32 +
  33 + //获取打开的商户信息、当前打开的用户信息
  34 + CGI_USER_GETSYSTEMBYOPENID:'App.Seller.GetSystemByOpenid',
  35 + CGI_USER_GETSYSTEMBYOPENID__CODE:19021,
  36 +
  37 + //缓存key
  38 + CACHE__COMMON:'common',
  39 + CACHE__TOKEN:'token',
  40 + CACHE__SYSTEM_INFO:'system.info',
  41 + CACHE__LOGINCODE:'login_code',
  42 + CACHE__USER:'user',
  43 +
  44 + //图片尺寸
  45 + IMAGE__MAX:720,
  46 + IMAGE__MED:360,
  47 + IMAGE__MIN:180,
  48 +
  49 + //over
  50 + end:0
  51 +}
  52 +
  53 +module.exports = uri;
  1 +var uri=require('uri.js')
  2 +var Pingpp=require('pingpp.js')
  3 +
  4 +function formatTime(date,type,connect) {
  5 + var year = date.getFullYear()
  6 + var month = date.getMonth() + 1
  7 + var day = date.getDate()
  8 +
  9 + var hour = date.getHours()
  10 + var minute = date.getMinutes()
  11 + var second = date.getSeconds()
  12 + if(type==1){
  13 + if(connect){
  14 + return [year, month, day].map(formatNumber).join(connect)
  15 + }else{
  16 + return [year, month, day].map(formatNumber).join('/')
  17 + }
  18 + }else if(type==2){
  19 + return [month, day].map(formatNumber).join('/')
  20 + }else{
  21 + return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
  22 + }
  23 +
  24 +}
  25 +function formatNumber(n) {
  26 + n = n.toString()
  27 + return n[1] ? n : '0' + n
  28 +}
  29 +//时间戳转为时间
  30 +function unixtoTime(ns,format) {
  31 + var result;
  32 + var time = new Date(ns*1000);
  33 + //result=format || 'YYYY年MM月DD日 HH时II分SS秒 WW';
  34 + result=format || 'YYYY年MM月DD日';
  35 + console.log(format);
  36 + result=result.toUpperCase();
  37 + result=result.replace('YYYY',time.getFullYear());
  38 + var m=time.getMonth()+1;
  39 + result=result.replace('MM',m>9?m:"0"+m);
  40 + var d=time.getDate();
  41 + result=result.replace('DD',d>9?d:'0'+d);
  42 + var hh=time.getHours();
  43 + result=result.replace('HH',hh>9?hh:'0'+hh);
  44 + var ii=time.getMinutes();
  45 + result=result.replace('II',ii>9?ii:'0'+ii);
  46 + var ss=time.getSeconds();
  47 + result=result.replace('SS',ss>9?ss:'0'+ss);
  48 + var week;
  49 + switch (time.getDay()) {
  50 + case 0:week="星期天";break
  51 + case 1:week="星期一";break
  52 + case 2:week="星期二";break
  53 + case 3:week="星期三";break
  54 + case 4:week="星期四";break
  55 + case 5:week="星期五";break
  56 + case 6:week="星期六";break
  57 + }
  58 + result=result.replace('WW',week);
  59 + return result;
  60 +}
  61 +
  62 +//时间转为时间戳
  63 +function timetouUnix(dasr,connect)
  64 +{
  65 + if(connect){
  66 + var newstr = dasr.replace(/-/g,connect);
  67 + }else{
  68 + var newstr = dasr.replace(/-/g,'/');
  69 + }
  70 +
  71 + var date = new Date(newstr);
  72 + var time_str = date.getTime().toString();
  73 + return time_str.substr(0, 10);
  74 +}
  75 +
  76 +//支付
  77 +function orderPay(charge){
  78 + var that=this;
  79 + console.log(charge);
  80 + var obj = JSON.parse(charge)
  81 + console.log('obj:',obj);
  82 + wx.requestPayment({
  83 + 'timeStamp': obj.timeStamp,
  84 + 'nonceStr': obj.nonceStr,
  85 + 'package': obj.package,
  86 + 'signType': 'MD5',
  87 + 'paySign': obj.paySign,
  88 + 'success':function(res){
  89 + console.log('success:',res);
  90 + },
  91 + 'fail':function(res){
  92 + console.log('fail:',res);
  93 + },
  94 + 'complete':function(res){
  95 +
  96 + }
  97 + })
  98 +}
  99 +module.exports = {
  100 + formatTime: formatTime,
  101 + unixtoTime:unixtoTime,
  102 + timetouUnix:timetouUnix,
  103 + orderPay:orderPay,
  104 + cgi:function(act){
  105 + return uri.HOST__LINE+act //正式
  106 + //return uri.HOST__TEST+act //测试
  107 + },
  108 + wxApiIsUse:function(api){
  109 + if(wx.canIUse(api)){
  110 + return true;
  111 + }else{
  112 + this.alert('当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。');
  113 + }
  114 + },
  115 + openXcx:function(data){
  116 + if(this.wxApiIsUse('navigateToMiniProgram')){
  117 + wx.navigateToMiniProgram({
  118 + appId: data.appId,
  119 + path: data.path,
  120 + extraData: {
  121 + foo: 'bar'
  122 + },
  123 + envVersion: 'trial',
  124 + //envVersion: '',
  125 + success(res) {
  126 + // 打开成功
  127 + }
  128 + })
  129 + }
  130 + },
  131 + loading:function(flag){
  132 + if(flag=='clear' || flag=="clean"){
  133 + wx.hideNavigationBarLoading();
  134 + return;
  135 + }
  136 + wx.showNavigationBarLoading();
  137 + },
  138 + postSuccessFun:function(json,uri_code){
  139 + console.log("APP::postSuccessFun",uri_code,json);
  140 + },
  141 + postFailFun:function(json,uri_code){
  142 + console.log(json,uri_code);
  143 + },
  144 + getToken:function(n_function){
  145 + var token=this.cache(uri.CACHE__TOKEN);
  146 + console.log("token:",token);
  147 + if(!token) {
  148 + this.loginStart(n_function);
  149 + return;
  150 + }
  151 + return token;
  152 + },
  153 + asyn:function(act,data,uri_code,n_function){//静默方式,不带loading
  154 + data=data||{};
  155 + var that=this;
  156 + data.token=that.cache(uri.CACHE__TOKEN);
  157 + wx.request({
  158 + url: that.cgi(act),
  159 + method:'POST',
  160 + data: data,
  161 + header: {
  162 + 'content-type': 'application/x-www-form-urlencoded'
  163 + },
  164 + success: function(res) {
  165 + console.log('asyn_success:',act,uri_code,res);
  166 + that.loading('clear');
  167 + if(n_function){
  168 + that.loginStart(n_function);
  169 + }
  170 + /*if(typeof res.data!='string'){
  171 + if(res.data.code!=200&&res.data.code!=1000){
  172 + console.log(res.data.code==-1,res.data.code);
  173 + if(res.data.code==-1) {
  174 + that.loginStart(n_function);
  175 + return;
  176 + }else{
  177 + that.alert(res.data.message);
  178 + return;
  179 + }
  180 + }
  181 + }*/
  182 + that.postSuccessFun(res.data,uri_code);
  183 + },
  184 + fail: function(res) {
  185 + console.log('asyn_fail:',act,uri_code,res);
  186 + that.loading('clear');
  187 + that.toast(res.errMsg);
  188 + that.postFailFun(res.data,uri_code);
  189 + }
  190 + })
  191 + },
  192 + post:function(act,data,uri_code,is_load,n_function,header={'Content-Type': 'application/x-www-form-urlencoded'}){
  193 + console.log('act:',act)
  194 + if(is_load!='0'){
  195 + this.loading();
  196 + }
  197 + this.asyn(act,data,uri_code,n_function,header);
  198 + },
  199 + upload:function(filePath,fileIndex,uri_code,sellerid,type,file){
  200 + var that=this;
  201 + this.loading();
  202 + if(this.wxApiIsUse('uploadFile')){
  203 + wx.uploadFile({
  204 + url: that.cgi('Seller/Index/UploadImages'),
  205 + filePath: filePath,
  206 + name: 'file',
  207 + formData:{
  208 + sellerid:sellerid,
  209 + type:type
  210 + },
  211 + success: function(res){
  212 + that.loading('clear');
  213 + that.postSuccessFun(res.data,uri_code,fileIndex);
  214 + },
  215 + fail: function(res) {
  216 + that.loading('clear');
  217 + that.toast("上传失败,请重试");
  218 + that.postFailFun(res.data,uri_code,fileIndex);
  219 + }
  220 + });
  221 + }
  222 + },
  223 +
  224 + uploading:function(filePath,fileIndex,dir,uri_code,file){
  225 + var that=this;
  226 + this.loading();
  227 +
  228 + console.log(filePath,fileIndex,dir,uri_code);
  229 +
  230 + if(this.wxApiIsUse('uploadFile')){
  231 + wx.uploadFile({
  232 + url: 'https://xt05.colorcun.com/?s=App.Cookbook.UpLoadFile',
  233 + filePath: filePath,
  234 + name: 'file',
  235 + formData:{
  236 + dir:dir
  237 + },
  238 + success: function(res){
  239 + console.log('上传成功')
  240 + console.log(res)
  241 + that.loading('clear');
  242 + that.postSuccessFun(res.data,uri_code,fileIndex);
  243 + },
  244 + fail: function(res) {
  245 +
  246 + that.toast("上传失败,请重试");
  247 + that.postFailFun(res.data,uri_code,fileIndex);
  248 + }
  249 + });
  250 + }
  251 + },
  252 +
  253 + uploadImg:function(filePath,fileIndex,uri_code){
  254 + var that=this;
  255 + if(this.wxApiIsUse('uploadFile')){
  256 + wx.uploadFile({
  257 + url: that.cgi('bargainimage'),
  258 + filePath: filePath,
  259 + name: 'path',
  260 + formData:{
  261 + 'token': that.getToken()
  262 + },
  263 + success: function(res){
  264 + console.log(res);
  265 + res.data=JSON.parse(res.data);
  266 + if(res.data.code!=200){
  267 + if(res.data.code==-1) {
  268 + wx.navigateTo({url:'/pages/login/index'});
  269 + return;
  270 + }else{
  271 + that.alert(res.data.message);
  272 + }
  273 + }
  274 + console.log("res-code-data",uri_code,res.data);
  275 + that.postSuccessFun(res.data,uri_code,fileIndex);
  276 + },
  277 + fail:function(res){
  278 + console.log(res);
  279 + }
  280 + });
  281 + }
  282 + },
  283 + download:function(id,uri_code,width){
  284 + var that=this;
  285 + this.loading();
  286 + if(this.wxApiIsUse('downloadFile')){
  287 + wx.downloadFile({
  288 + url: that.cgi('download'),
  289 + success: function(res) {
  290 + console.log("res-code-data",uri_code,res);
  291 + wx.playVoice({
  292 + filePath: res.tempFilePath
  293 + })
  294 + that.postSuccessFun(id,uri_code,width,res.data);
  295 + }
  296 + });
  297 + }
  298 + },
  299 + alert:function(msg,success,cancel,title){
  300 + wx.showModal({
  301 + title:title?title:"提示信息",
  302 + content:msg,
  303 + showCancel:typeof cancel=='undefined'?false:true,
  304 + success:function(res){
  305 + if(res.confirm){
  306 + if(success) success();
  307 + }else{
  308 + if(cancel) cancel();
  309 + }
  310 + }
  311 + });
  312 + },
  313 + toast:function(title){
  314 + wx.showToast({
  315 + title:title,
  316 + icon:"success"
  317 + })
  318 + },
  319 + showLoading:function(title){
  320 + wx.showLoading({
  321 + title: '加载中',
  322 + })
  323 +
  324 + },
  325 + getCommonType:function(key){
  326 + var that=this;
  327 + var common = that.cache(uri.CACHE__COMMON) || {time:0};
  328 + var time=Date.now();
  329 + if(common.time<time-600000){
  330 + wx.request({
  331 + url: that.cgi('commontype'),
  332 + header: {
  333 + 'Content-Type': 'application/json'
  334 + },
  335 + success: function(res) {
  336 + if(res.data.code==200){
  337 + common={data:res.data.data,time:time};
  338 + //wx.setStorageSync(uri.CACHE__COMMON,common);
  339 + that.cache(uri.CACHE__COMMON,common)
  340 + }
  341 + }
  342 + })
  343 + }
  344 + if(!key) return common.data;
  345 + common = that.cache(uri.CACHE__COMMON) || {time:0};
  346 + return common.data[key];
  347 + },
  348 + getCommonTag:function(key,v_id){
  349 + var that=this;
  350 + var tagsdata=this.cache(uri.CACHE__COMMONTAG);
  351 + if(!tagsdata){
  352 +
  353 + wx.request({
  354 + url: that.cgi(uri.CGI__USER_TCOMMONTAG),
  355 + data:{
  356 + 'token': that.getToken()
  357 + },
  358 + header: {
  359 + 'Content-Type': 'application/json'
  360 + },
  361 + success: function(res) {
  362 + if(res.data.code==200){
  363 + that.cache(uri.CACHE__COMMONTAG,res.data.data);
  364 + }
  365 + }
  366 + })
  367 + }
  368 + tagsdata=this.cache(uri.CACHE__COMMONTAG);
  369 + var result;
  370 + if(v_id){
  371 + tagsdata[key].map(function(v){
  372 + if(v.id==v_id){
  373 + result=v.tag_name;
  374 + }
  375 + })
  376 + }else{
  377 + result=tagsdata[key];
  378 + }
  379 + return result;
  380 + },
  381 + cache:function(key,value){
  382 + if(value){
  383 + wx.setStorageSync(key,value);
  384 + }
  385 + return wx.getStorageSync(key);
  386 + },
  387 + remove:function(key){
  388 + if(key){
  389 + wx.removeStorage({key: key})
  390 + }
  391 + },
  392 + image:function(id,width=""){
  393 + var url=this.cgi(uri.CGI__DOWNLOAD+'/id/'+id);
  394 + if(width){
  395 + url+='/width/'+width;
  396 + }
  397 + return url;
  398 + },
  399 +
  400 + avatar:function(id,t='pu'){
  401 + return this.cgi(uri.CGI__AVATAR +'/'+t+'/'+id);
  402 + },
  403 + trim:function(str){
  404 + return str.replace(/^([ ]+)/,"").replace(/([ ]+)$/,"");
  405 + },
  406 + clear:function(str){//去除html标签
  407 + return this.trim(str.replace(/<[^>]+>/ig,""));
  408 + },
  409 + clearHtml:function(html){//去除html中特殊字符
  410 + html=html.replace(/[\n\r\t]+/ig,'');
  411 + html=html.replace(/<html[^>]*>(.*)<body[^>]*>/ig,'');
  412 + html=html.replace(/<div[^>]*>(.*)<article[^>]*>/ig,'');
  413 + html=html.replace(/<\/article[^>]*>(.*)<\/div[^>]*>/ig,'');
  414 + html=html.replace(/<style[^>]*>(.*)<\/style>/ig,'');
  415 + html=html.replace(/<\/body.*/ig,'');
  416 + html=html.replace(/<!--[^>]+>/ig,'');
  417 + html=html.replace(/&quot;/ig,'');
  418 + return html;
  419 + },
  420 + val:function(e){
  421 + return e.detail.value;
  422 + },
  423 + attr:function(e,key){
  424 + return e.currentTarget.dataset[key];
  425 + },
  426 + extend:function(destination, source) {
  427 + for (var property in source) {
  428 + destination[property] = source[property];
  429 + }
  430 + return destination;
  431 + },
  432 + getToken:function(n_function){
  433 + var token=this.cache(uri.CACHE__TOKEN);
  434 + console.log("token:",token);
  435 + if(!token) {
  436 + this.loginStart(n_function);
  437 + return;
  438 + }
  439 + return token;
  440 + },
  441 + loginStart:function(n_function){
  442 + console.log("n_function:",n_function,1111);
  443 + var that=this;
  444 + wx.login({
  445 + success: function(login_res) {
  446 + if (login_res.code) {
  447 + console.log('success');
  448 + console.log('wx.login.res' , login_res);
  449 + that.cache(uri.CACHE__LOGINCODE,login_res.code);
  450 + wx.getUserInfo({
  451 + success: function(res) {
  452 + res.code=login_res.code;
  453 + console.log('wx.getProviderInfo.res' , res);
  454 + var data={
  455 + code:login_res.code,
  456 + encryptData:res.encryptData,
  457 + encryptedData:res.encryptedData,
  458 + iv:res.iv,
  459 + rawData:res.rawData,
  460 + signature:res.signature,
  461 + appid:'wxc359908817c7bdd9',
  462 + secret:'a14a8415a501ade9542968d8a6504820',
  463 + }
  464 + wx.request({
  465 + url: that.cgi(uri.CGI__USER_XCXLOGIN),
  466 + data: data,
  467 + header: {
  468 + 'content-type': 'application/json'
  469 + },
  470 + success: function(res) {
  471 + that.cache('setting','success');
  472 + that.cache(uri.CACHE__LOGINCODE,login_res.code);
  473 + /*if(n_function){
  474 + var pagelength=getCurrentPages().length;
  475 + console.log("pagelength:",pagelength);
  476 + console.log("getCurrentPages:",getCurrentPages());
  477 + if(typeof getCurrentPages()[pagelength-1][n_function]()!='undefined'){
  478 + getCurrentPages()[pagelength-1][n_function]();
  479 + }
  480 + }*/
  481 + return;
  482 + }
  483 + })
  484 + },
  485 + fail:function(){
  486 + that.cache('loginfail','fail');
  487 + if(n_function){
  488 + var pagelength=getCurrentPages().length;
  489 + console.log('hahahah');
  490 + getCurrentPages()[pagelength-1].onShow();
  491 + }
  492 + }
  493 + });
  494 + } else {
  495 + console.log('获取用户登录态失败!' + res.errMsg)
  496 + }
  497 + }
  498 + });
  499 + },
  500 + //重新调起授权
  501 + userInfoHandler:function(etarget){
  502 + if(this.wxApiIsUse('button.open-type.getUserInfo')){
  503 + if(etarget.detail&& etarget.detail.errMsg=='getUserInfo:ok'){
  504 + return true
  505 + //this.dc_loginStart()
  506 + }
  507 + }
  508 + },
  509 +
  510 + getAccess_token: function (a, s, n_tempmessage) {
  511 + var that = this;
  512 + wx.request({
  513 + url: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + a + '&secret=' + s, //仅为示例,并非真实的接口地址
  514 + header: {
  515 + 'content-type': 'application/json'
  516 + },
  517 + success: function (res) {
  518 + console.log('access_token!!!!console:', res)
  519 + console.log('access_token:', res.data.access_token)
  520 + that.sendMessage(res.data.access_token, n_tempmessage);
  521 + }
  522 + })
  523 + },
  524 + //模板消息
  525 + sendMessage: function (a_t, dd) {
  526 + var that = this;
  527 + wx.request({
  528 + url: 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=' + a_t, //仅为示例,并非真实的接口地址
  529 + data: dd,
  530 + method: 'POST',
  531 + header: {
  532 + 'content-type': 'application/json'
  533 + },
  534 + success: function (res) {
  535 + console.log('发送模板消息:',res)
  536 + //that.sendMessuc(res);
  537 + }
  538 + })
  539 + },
  540 + //获取当前网络状态
  541 + getNetwork:function(){
  542 + var that=this;
  543 + if(this.wxApiIsUse('getNetworkType')){
  544 + wx.getNetworkType({
  545 + success: function(res) {
  546 + that.getNetworkSuccess(res.networkType);
  547 + },
  548 + fail:function(res){
  549 + that.toast('获取网络状况失败!');
  550 + }
  551 + })
  552 + }
  553 + },
  554 + getNetworkSuccess:function(network){
  555 + return network;
  556 + },
  557 + compare:function(property){
  558 + return function(a,b){
  559 + var value1 = a[property];
  560 + var value2 = b[property];
  561 + return value1 - value2;
  562 + }
  563 + },
  564 + getJsonLength:function(jsonData){
  565 + var jsonLength = 0;
  566 + for(var item in jsonData){
  567 + jsonLength++;
  568 + }
  569 + return jsonLength;
  570 + },
  571 + testPhone:function(phone){
  572 + if(!/^1[3-9][0-9]{9}$/.test(phone)){
  573 + this.alert("请输入正确的电话号码");
  574 + return false;
  575 + }
  576 + },
  577 + //加入卡包
  578 + addInCard:function(sellerid){
  579 + var that = this;
  580 + wx.request({
  581 + url: that.cgi(uri.CGI__USER_GETSIGNOPENCARD),
  582 + method:'GET',
  583 + header: {
  584 + 'content-type': 'application/x-www-form-urlencoded'
  585 + },
  586 + data:{
  587 + sellerid:1,
  588 + },
  589 + success: function(res) {
  590 + console.log(res)
  591 + var cardExtstr = res.data.data.cardExt
  592 + var cardId = res.data.data.cardid
  593 + console.log('cardExtstr:',cardExtstr);
  594 + wx.addCard({
  595 + cardList: [
  596 + {
  597 + cardId: cardId,
  598 + cardExt: cardExtstr,
  599 + }
  600 + ],
  601 + success: function(res) {
  602 + console.log('success:',res)
  603 + that.cache('cardList',res.cardList);
  604 + },
  605 + fail:function(res) {
  606 + console.log('fail:',res)
  607 + },
  608 + })
  609 + }
  610 + })
  611 + },
  612 + //保存图片
  613 + saveImage: function(url){
  614 + var that = this;
  615 + wx.downloadFile({
  616 + url:url,
  617 + success:function(res){
  618 + var path = res.tempFilePath
  619 + wx.saveImageToPhotosAlbum({
  620 + filePath: path,
  621 + success(res) {
  622 +
  623 + },
  624 + //保存图片重新授权
  625 + fail(res) {
  626 + wx.openSetting({
  627 + success: (res) => {
  628 + res.authSetting = {
  629 + "scope.writePhotosAlbum": true
  630 + }
  631 + }
  632 + })
  633 + },
  634 + })
  635 + },
  636 + fail:function(res){
  637 +
  638 + }
  639 + })
  640 + },
  641 + //根据source判断会员卡1 或优惠券2
  642 + sourceFrom:function(){
  643 + var source = this.cache('source')
  644 + console.log('source:',source)
  645 + var title = ''
  646 + if(source==1){
  647 + title = '会员卡'
  648 + }else{
  649 + title = '优惠券'
  650 + }
  651 + wx.setNavigationBarTitle({
  652 + title:title
  653 + })
  654 + return source
  655 + },
  656 + //返回会员卡 优惠券的开通进度
  657 + stepSetting:function(stepnum){
  658 + var source = this.cache('source')
  659 + var step = {
  660 + content:['会员卡开通','会员卡设置','发放确认','发放完成'],
  661 + step:[{id:'0'},{id:'1'},{id:'2'},{id:'3'}],
  662 + stepnum:stepnum
  663 + }
  664 + if(step&&source==2){
  665 + step.content[0] = '优惠券开通'
  666 + step.content[1] = '优惠券设置'
  667 + }
  668 + return step
  669 + },
  670 + setBarTitle:function(title){
  671 + wx.setNavigationBarTitle({
  672 + title:title
  673 + })
  674 + },
  675 + //小数规则:小数只能存在一个小数点并且至多保留两位小数 数字首位可以为0 第二位不能为0
  676 + limitDigit:function(value,firsezero){
  677 + if(value.length==1&value=='.'){
  678 + value = '0'+'.'
  679 + }
  680 + if(value=='00'){
  681 + value = '0'
  682 + }
  683 + value = value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的
  684 + value = value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
  685 + value = value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数
  686 + //firsezero存在 首位不能为0
  687 + if(firsezero){
  688 + if(value.indexOf(".")< 0 && value !=""){//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
  689 + value= parseFloat(value);
  690 + }
  691 + }
  692 + return value
  693 + },
  694 +
  695 + //
  696 + isEOne : function(arr,value){
  697 + for(var i = 0,vlen = arr.length; i < vlen; i++){
  698 + if(arr[i] == value){
  699 + return i;
  700 + }
  701 + }
  702 + return -1;
  703 +},
  704 + linkTo:function(url,sellerid,code){
  705 + var path='pages/menu/'+url;
  706 + if(code!=''){
  707 + path+='?sellerid='+sellerid+'&code='+code
  708 + }
  709 + if(sellerid!=''){
  710 + path+='?sellerid='+sellerid
  711 + }
  712 + console.log(path)
  713 + wx.navigateToMiniProgram({
  714 + appId: 'wx52646daaa3f42a4f',
  715 + path: path,
  716 + envVersion: 'release',
  717 + success:function(res) {
  718 + console.log(path)
  719 + }
  720 + })
  721 + },
  722 + setting:function(){
  723 + if(wx.canIUse('openSetting')==true){
  724 + wx.openSetting({
  725 + success:function(res){
  726 + console.log(res.authSetting)
  727 + return res.authSetting
  728 + }
  729 + })
  730 + }
  731 + },
  732 + //获取设备信息
  733 + getsystem:function(){
  734 + try {
  735 + var res = wx.getSystemInfoSync()
  736 + return res;
  737 + } catch (e) {
  738 + return false
  739 + }
  740 + }
  741 +}
  742 +
  743 +
  744 +
  745 +
  746 +
  747 +
  748 +