Commit f6cf82d5 authored by tangkun's avatar tangkun
Browse files

小程序初始化

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
{
"component": true,
"usingComponents": {
"van-button": "@vant/weapp/button/index",
"van-popup": "@vant/weapp/popup/index",
"van-stepper": "@vant/weapp/stepper/index"
}
}
\ No newline at end of file
<!--components/addShoppingCart/index.wxml-->
<wxs module="numberUtil" src="../../utils/util.wxs"></wxs>
<van-popup show="{{ operationShow }}" custom-class="operationPop" position="bottom" bind:close="onOperationClose">
<view class="cont">
<view class="information">
<image class="img" src="{{reekoData.pic}}"></image>
<view class="right">
<view class="tle">{{reekoData.title}}</view>
<view class="tips">{{reekoData.introduction}}</view>
<view class="num">
<view>¥{{numberUtil.numberFormat(reekoData.totalPrice)}}</view>
</view>
<view class="num" wx:if="{{additionalServices > 0}}">
<view class="Fj">附加服务:¥{{numberUtil.numberFormat(additionalServices)}}</view>
</view>
</view>
</view>
<view class="guige">
<view class="tle">规格</view>
<view class="listData">
<view class="lll {{specificationsIndex == index ? 'active' : '' }}" wx:for="{{reekoData.skuList}}" data-index="{{index}}" wx:for-item="item" wx:key="index" bindtap="onGuigeChange">{{item.name}}</view>
</view>
</view>
<view class="shuliang">
<view class="tle">数量</view>
<van-stepper value="{{ 1 }}" max="{{reekoData.limitQuantity == -1 ? '10000' : reekoData.limitQuantity}}" bind:change="onNumChange" />
</view>
<view class="fujia" wx:if="{{reekoData.extServiceList.length > 0}}">
<view class="tle">附加服务</view>
<view class="listData">
<view class="lll {{item.checksta ? 'active' : '' }}" wx:for="{{reekoData.extServiceList}}" data-index="{{index}}" data-obj="{{item}}" wx:for-item="item" wx:key="index" bindtap="onFujiaChange">{{item.services_name}}
<text class="special" wx:if="{{ item.required == 1 }}">必选</text>
</view>
</view>
</view>
<!-- 加购提示 -->
<view class="addPurchaseTips" wx:if="{{reekoData.minDeliveryPriceFlag && reekoData.minDeliveryPrice > reekoData.subtotal}}">此商品仅支持购物车结算</view>
<view class="exercise">
<van-button bindtap="addCar" class="btn join" type="default">加入购物车</van-button>
<van-button wx:if="{{reekoData.minDeliveryPriceFlag && reekoData.minDeliveryPrice > reekoData.subtotal}}" style="opacity: .5;" class="btn" type="default">立即购买</van-button>
<van-button wx:else bindtap="immediately" class="btn" type="default">立即购买</van-button>
</view>
<!-- <image class="close" src="/image/public/close.png" bindtap="onOperationClose"></image> -->
</view>
</van-popup>
/* components/addShoppingCart/index.wxss */
.operationPop{border-radius: 20rpx 20rpx 0 0;}
.operationPop .cont{padding: 50rpx 32rpx 32rpx;}
.operationPop .cont .information{display: flex;justify-content: space-between;}
.operationPop .cont .information .img{width: 240rpx;height: 240rpx;}
.operationPop .cont .information .right{width: 422rpx;font-size: 28rpx;display: flex;flex-direction: column;justify-content: space-between;}
.operationPop .cont .information .right .tle{font-weight: 900;}
.operationPop .cont .information .right .tips{font-size: 20rpx;color: rgba(102, 102, 102, .8);padding-top: 10rpx;}
.operationPop .cont .information .right .num{display: flex;align-items: center;justify-content: space-between; font-weight: 900;color: #FF7B7B;padding-top: 10rpx;}
.operationPop .cont .information .right .num .Fj{color: #666666;font-size: 24rpx;}
.operationPop .cont .tle{font-weight: 900;}
.operationPop .cont .guige .tle{padding-top: 40rpx;}
.operationPop .cont .guige .listData{display: flex;align-items: center;padding: 20rpx 0 16rpx;flex-wrap: wrap;}
.operationPop .cont .guige .listData .lll{padding: 10rpx 20rpx;border-radius: 30rpx;background: #F7F7FA;font-size: 24rpx;margin: 0 16rpx 32rpx;border: 2rpx solid #F7F7FA;}
.operationPop .cont .guige .listData .active,.operationPop .cont .fujia .listData .active{border: 2rpx solid #E30214 !important;color: #E30214;}
.operationPop .cont .shuliang{display: flex;align-items: center;justify-content: space-between;}
.operationPop .cont .fujia .tle{padding-top: 40rpx;}
.operationPop .cont .fujia .listData{display: flex;align-items: center;padding: 40rpx 0 0;flex-wrap: wrap;}
.operationPop .cont .fujia .listData .lll{position: relative;padding: 10rpx 30rpx;border-radius: 30rpx;background: #F7F7FA;font-size: 24rpx;margin: 0 16rpx 40rpx;border: 2rpx solid #F7F7FA;}
.operationPop .cont .fujia .listData .lll .special{position: absolute;top: -28rpx;right: 0;width: 86rpx;height: 38rpx;background: #E30214;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;font-size: 24rpx;color: #ffffff;}
.operationPop .cont .addPurchaseTips{color: #E30214;font-size: 24rpx;text-align: right;padding-top: 32rpx;}
.operationPop .cont .exercise{display: flex;align-items: center;justify-content: space-between;}
.operationPop .cont .exercise .btn button{width: 330rpx;background: #E30214;color: #ffffff;font-size: 32rpx;font-weight: 900;height: 80rpx;border: none;border-radius: 40rpx;margin-top: 32rpx;}
.operationPop .cont .exercise .join button{background: none;border: 2rpx solid #E30214;color: #E30214;}
.operationPop .cont .exercise .no button{width: 686rpx;}
.operationPop .cont .close{width: 40rpx;height: 40rpx;position: absolute;right: 10rpx;top: 10rpx;}
\ No newline at end of file
// miniprogram/components/countDown/index.js
Component({
externalClasses: ['c-class'], // 自定义样式
/**
* 组件的属性列表
*/
properties: {
target: Number, // 结束时间
showDay: Boolean, // 是否显示天
callback: String, // 回调
format: Array, // 自定义格式
clearTimer: Boolean // 清除定时器
},
/**
* 组件的初始数据
*/
data: {
time: ''
},
ready () {
this.getFormat();
},
/**
* 组件的方法列表
*/
methods: {
init () {
const self = this;
setTimeout(function () {
self.getLastTime.call(self);
}, 1000);
},
getFormat () {
const data = this.data;
if (data.format.length === 3) data.format.splice(0, 0, '');
this.getLastTime();
},
getLastTime () {
const data = this.data;
const gapTime = Math.ceil((data.target - new Date().getTime()) / 1000);// 距离结束还有多少秒
// let time = '00:00:00';
let time = '00:00';
let day = '00';
const format = data.format;
if (gapTime > 0) {
day = this.formatNum(parseInt(gapTime / 86400)); // 天
let lastTime = gapTime % 86400;
const hour = this.formatNum(parseInt(lastTime / 3600)); // 时
lastTime = lastTime % 3600;
const minute = this.formatNum(parseInt(lastTime / 60)); // 分
const second = this.formatNum(lastTime % 60); // 秒
//console.log(day,hour)
if (data.format.length > 0) {// 自定义格式处理
if(day == '00'){
hour == '00' ? time = `${minute}${format[2]}${second}${format[3]}` : time = `${hour}${format[1]}${minute}${format[2]}${second}${format[3]}`
}else{
time = `${data.showDay?`${day}${format[0]}`:''}${hour}${format[1]}${minute}${format[2]}${second}${format[3]}`;
}
} else {
// time = `${data.showDay?`${day}:`:''}${hour}:${minute}:${second}`
time = `${data.showDay?`${day}:`:''}${hour}:${minute}:${second}`
}
if (!data.clearTimer) this.init.call(this);
} else {
this.endfn();
}
this.setData({
time: time
});
},
formatNum (num) {// 格式化
return num > 9 ? num : `0${num}`;
},
endfn () {
this.triggerEvent('callback', {});
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--miniprogram/components/countDown/index.wxml-->
<text class="c-class">{{time}}</text>
/* miniprogram/components/countDown/index.wxss */
\ No newline at end of file
// components/customerService/index.js
var call = require("../../utils/request.js");
Component({
/**
* 组件的属性列表
*/
properties: {
role:{
type: String,
value: '',
}
},
/**
* 组件的初始数据
*/
data: {
customerShow: false, // 暂未开通提示
modeShow: false, // 选择方式
isMode: true, // 是选了电话还是微信客服 true 电话 false 客服
customer_service_mobile: '', // 专属客服
userInfo: '',
},
/**
* 组件的方法列表
*/
methods: {
// 判断弹出哪个
onIsOpen(){
call.httpData('POST','/api/user/userinfo', {},
res => {
console.log(res,'获取用户信息')
if(res.code == 1){
let userInfo = res.data
this.setData({ userInfo,modeShow: true })
}else{
wx.showToast({ icon: 'none',title: res.msg });
}
this.setData({ pageStatus: true })
},function (err) {
console.log(err)
})
},
// 切换 - 选择客服
isMode (e) {
let { status } = e.currentTarget.dataset
console.log(status)
status == 'true' ? this.setData({ isMode: true }) : this.setData({ isMode: false })
},
// 确认 - 选择客服
yesMode(){
let isMode = this.data.isMode
let phoneNumber = this.data.userInfo.customer_service_mobile
this.onModeClose()
wx.makePhoneCall({ phoneNumber })
// if(isMode){ // 电话
// this.onModeClose()
// wx.makePhoneCall({ phoneNumber })
// }else{// 微信
// this.setData({ customerShow: true })
// }
},
handleContact (e) {
console.log(e.detail.path)
console.log(e.detail.query)
},
// 关闭 - 未开通提示
onCustomerClose () {
this.setData({ customerShow: false })
},
// 关闭 - 选择方式
onModeClose () {
this.setData({ modeShow: false })
}
},
})
{
"component": true,
"usingComponents": {
"van-button": "@vant/weapp/button/index",
"van-popup": "@vant/weapp/popup/index"
}
}
\ No newline at end of file
<!--components/customerService/index.wxml-->
<view class="exclusive" >
<!-- <image bindtap="onIsOpen" class="customerService" src="/subPackages/images/my/customerService.png"></image>
<van-button wx:if="{{ role != 1 }}" class="contact" open-type="contact" bindcontact="handleContact"></van-button> -->
<image class="customerService" src="/subPackages/images/my/customerService.png"></image>
<van-button class="contact" open-type="contact" bindcontact="handleContact"></van-button>
</view>
<!-- 选择方式 -->
<van-popup custom-class="modeShow" show="{{ modeShow }}" bind:close="onModeClose">
<view class="main">
<text class="text">专属客服</text>
<view class="in">
<view class="li {{ isMode ? 'liOne' : ''}}" data-status="true" bindtap="isMode">
<image src="/subPackages/images/public/customerOne.png"></image>
<text class="written">电话客服</text>
</view>
<view class="li {{ isMode == false ? 'liTwo' : ''}}" data-status="false" bindtap="isMode">
<image src="/subPackages/images/public/customerTwo.png"></image>
<text class="written">微信客服</text>
</view>
</view>
<van-button class="btn" wx:if="{{isMode}}" bindtap="yesMode">确定</van-button>
<van-button class="btn" wx:else open-type="contact" bindcontact="handleContact">确定</van-button>
<image class="close" src="/subPackages/images/public/close.png" bindtap="onModeClose"></image>
</view>
</van-popup>
<!-- 选择方式 -->
<!-- 暂未开通 -->
<van-popup custom-class="customerPop" show="{{ customerShow }}" bind:close="onCustomerClose">
<view class="main">
<image class="imgP" src="/subPackages/images/public/notOpened.png"></image>
<text class="text">该功能暂未开通,请耐心等待。</text>
<van-button class="btn" bindtap="onCustomerClose">确定</van-button>
</view>
</van-popup>
<!-- 暂未开通 -->
\ No newline at end of file
/* components/customerService/index.wxss */
.exclusive{width: 100rpx;position: fixed;bottom: 200rpx;right: 32rpx;z-index: 2;width: 96rpx;height: 129rpx;}
.exclusive .customerService{width: 96rpx;height: 129rpx;}
.exclusive .text{font-size: 24rpx;color: #758DA8;font-weight: 900;}
.exclusive .contact{position: absolute;top: 0;left: 0;}
.exclusive .contact button{width: 96rpx;height: 129rpx;opacity: 0;}
/* 未开通客服 */
.modeShow{width: 686rpx;border-radius: 20rpx;}
.modeShow .main{display: flex;flex-direction: column;align-items: center;justify-content: center;padding: 76rpx 0 50rpx;}
.modeShow .main .text{font-size: 36rpx;color: #666666;font-weight: 900;}
.modeShow .main .in{padding: 44rpx 0 60rpx;display: flex;align-items: center;justify-content: space-between;width: 526rpx;}
.modeShow .main .in .li{display: flex;flex-direction: column;align-items: center;justify-content: center;border-radius: 20rpx;padding: 10rpx 10rpx 20rpx;border: 4rpx solid #ffffff;}
.modeShow .main .in .li image{width: 224rpx;height: 224rpx;}
.modeShow .main .in .li .written{font-weight: 900;font-size: 28rpx;}
.modeShow .main .in .liOne{border: 4rpx solid #6ABAFF;}
.modeShow .main .in .liTwo{border: 4rpx solid #49AB66;}
.modeShow .main .in .liOne .written{color: #429EC4;}
.modeShow .main .in .liTwo .written{color: #49AB66;}
.modeShow .main .btn button{width: 376rpx;height: 72rpx; line-height: 72rpx;background: linear-gradient(180deg, #46A2FF 0%, #58DDFF 100%);border-radius: 0;color: #ffffff;font-weight: 500;margin: 0;padding: 0;border-radius: 0;font-size: 32rpx;border: none;font-weight: 600;}
.modeShow .main .close{width: 40rpx;height: 40rpx;position: absolute;right: 40rpx;top: 36rpx;}
/* 未开通客服 */
.customerPop{width: 686rpx;border-radius: 20rpx;}
.customerPop .main{height: 500rpx;display: flex;flex-direction: column;align-items: center;justify-content: center;}
.customerPop .main .imgP{width: 142rpx;height: 142rpx;}
.customerPop .main .text{font-size: 32rpx;padding: 50rpx 0;}
.customerPop .main .btn button{width: 376rpx;height: 72rpx; line-height: 72rpx;background: linear-gradient(180deg, #46A2FF 0%, #58DDFF 100%);border-radius: 0;color: #ffffff;font-weight: 500;margin: 0;padding: 0;border-radius: 0;font-size: 32rpx;border: none;font-weight: 600;}
\ No newline at end of file
// components/loading/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {
"van-loading": "@vant/weapp/loading/index"
}
}
\ No newline at end of file
<view class="loading">
<van-loading size="46rpx" type="spinner" vertical color="#fff"><text style="color: #fff">加载中...</text></van-loading>
</view>
/* components/loading/index.wxss */
.loading{
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
position: fixed;
background: rgba(0,0,0,0.2);
z-index: 3000;
}
\ No newline at end of file
// components/isSignIn/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
noPasswordShow: false, // 没有设置密码弹窗状态
},
/**
* 组件的方法列表
*/
methods: {
async isLogin(){
wx.cloud.init()
const {
data: {
code,
errorMsg,
data
}
} = await wx.cloud.callContainer({
"config": {
"env": "prod-5g1ij4bldaaeb7dd"
},
"path": "/v1/user/login",
"header": {
"X-WX-SERVICE": "springboot-pc42"
},
"method": "get",
"data": {
"action": "inc"
}
})
console.log(code,data)
if (code == 1) {
if(data.needAuth == 0){ // 有数据 登录成功
wx.setStorageSync('userInfo', data.userInfo);
wx.setStorageSync('token', data.userInfo.mobile);
wx.setStorageSync('openId', data.openId);
wx.setStorageSync('clientList', data.clientList);
}else{
this.setData({ noPasswordShow: true })
}
} else {
}
return false
let that = this
wx.cloud.callContainer({
    config: {
      env: 'prod-5g1ij4bldaaeb7dd', 
    },
    path: '/v1/user/login', 
    method: 'GET',
    header: {
      'X-WX-SERVICE': 'springboot-u96b', 
    }
  }).then(res => {
let userInfo = res.data.data.userInfo
// wx.setStorageSync('openId', res.data.data.openId);
// wx.setStorageSync('userInfo', userInfo);
// that.setData({userInfo: userInfo,pageStatus: true})
    console.log(res.data.data.userInfo,res,'看看登录')
  })
},
// 关闭
onNoPasswordClose(){
this.setData({ noPasswordShow: false })
},
// 去登录
goLogin(){
this.setData({ noPasswordShow: false })
wx.navigateTo({
url: '/pages/my/personalData/index/index',
})
},
}
})
{
"component": true,
"usingComponents": {
"van-popup": "@vant/weapp/popup/index",
"van-button": "@vant/weapp/button/index",
"van-icon": "@vant/weapp/icon/index"
}
}
\ No newline at end of file
<!--components/isSignIn/index.wxml-->
<van-popup custom-class="noPasswordPop" show="{{ noPasswordShow }}" bind:close="onNoPasswordClose" closeable>
<view class="main">
<image class="mainImg" src="https://image.nuomayun.com/img/loginPop.png"></image>
<text class="mainTitle">授权登录挪码生活平台</text>
<text class="mainTips">登录后即可购买商品,享受精致服务。</text>
<van-button bindtap="goLogin" class="setUp" type="default">去登录</van-button>
</view>
</van-popup>
/* components/isSignIn/index.wxss */
.noPasswordPop{width: 579rpx;border-radius: 20rpx;}
.noPasswordPop .main{display: flex;flex-direction: column;align-items: center;justify-content: center;padding: 0 0 54rpx;}
.noPasswordPop .main .mainImg{width: 579rpx;height: 389rpx;}
.noPasswordPop .main .mainTitle{font-size: 32rpx;font-weight: 900;}
.noPasswordPop .main .mainTips{font-size: 28rpx;color: #9F9F9F;padding: 24rpx 0 40rpx;}
.noPasswordPop .main .setUp button{padding: 0;background: #00549e;border-radius: 10rpx;color: #ffffff;width: 440rpx;height: 72rpx;}
// components/loading/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment