Commit 824bc89b by 张立顺

初始化

1 parent 81e04b0e
Showing 765 changed files with 4503 additions and 0 deletions
.DS_Store
node_modules
/dist
/.history
cache
/cache
/.svn
.svn
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
File mode changed
{
"pages": [
"pages/tab/index/index",
"pages/tab/personal/personal",
"pages/auth/userInfo/userInfo",
"pages/auth/phone/phone",
"pages/route/to",
"pages/webpage/webpage",
"pages/upgrade/upgrade",
"pages/auth/login/login",
"pages/auth/index/index",
"pages/tab/logout/logout"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "我的智慧微店",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#333333",
"backgroundColor": "#FFFFFF",
"list": [
{
"pagePath": "pages/tab/index/index",
"text": "首页",
"iconPath": "images/home.png",
"selectedIconPath": "images/home_active.png"
},
{
"pagePath": "pages/tab/personal/personal",
"text": "我的",
"iconPath": "images/mine.png",
"selectedIconPath": "images/mine_active.png"
}
]
},
"usingComponents": {
"navigation-bar": "components/navigationBar/navigationBar",
"share": "components/share/share",
"list": "components/list/list",
"activity-list": "components/activityList/activityList",
"shop-order": "components/shopOrder/shopOrder",
"servicer-list": "components/servicerList/servicerList",
"coupon": "components/coupon/coupon",
"marquee": "components/marquee/marquee",
"auth-setting": "components/authSetting/authSetting",
"copy-wx": "components/copyWx/copyWx",
"my-mileage": "components/myMileage/myMileage",
"date-picker": "components/datePicker/datePicker",
"dropdown": "components/dropdown/dropdown",
"modal": "components/modal/modal",
"cell": "components/cell/cell",
"gl-textarea": "components/glTextarea/glTextarea",
"my-swiper": "components/mySwiper/mySwiper",
"label": "components/icon/label/label",
"order-list": "components/orderList/orderList",
"nav-tab": "components/navTab/navTab",
"left-nav-tab": "components/leftNavTab/leftNavTab",
"cmd-list": "components/cmdList/cmdList",
"star-score": "components/starScore/starScore",
"star-score-res": "components/starScoreRes/starScoreRes",
"error-msg": "components/errorMsg/errorMsg",
"err-msg-no-icon": "components/errMsgNoIcon/errMsgNoIcon",
"gl-tab": "components/glTab/glTab",
"calendar": "/components/Calendar/Calendar"
},
"permission": {
"scope.userLocation": {
"desc": "您的位置信息将用于小程序服务"
}
},
"plugins": {
"live-player-plugin": {
"version": "1.2.7",
"provider": "wx2b03c6e691cd7370"
}
},
"sitemapLocation": "sitemap.json",
"subpackages": [
{
"name": "homeindex",
"root": "packageIndex",
"pages": [
"pages/servicerAdviser/index/index",
"pages/servicerAdviser/detail/detail",
"pages/servicerAdviser/share/share",
"pages/servicerAdviser/merchant/merchant",
"pages/servicerAdviser/servicers/servicers",
"pages/servicerAdviser/viewActivity/viewActivity",
"pages/servicerAdviser/servicersInfo/servicersInfo",
"pages/remindService/index/index",
"pages/remindService/activity/activity",
"pages/remindService/activityDetail/activityDetail",
"pages/remindService/couponList/couponList",
"pages/quote/index/index",
"pages/quote/quoteRes/quoteRes",
"pages/index/index"
]
},
{
"name": "smartplus",
"root": "packageSmartPlus",
"pages": [
"pages/vehicleTracking/index/index",
"pages/vehicleTracking/share/share",
"pages/cloudSecurity/index/index",
"pages/cloudSecurity/setting/setting",
"pages/journey/index/index",
"pages/journey/detail/detail",
"pages/journey/share/share",
"pages/live/livePlay/livePlay",
"pages/live/reviewPlayList/reviewPlayList",
"pages/bindingDevice/bind/bind",
"pages/bindingDevice/index/index",
"pages/bindingDevice/devices/devices",
"pages/device/bindDevice/index",
"pages/device/boughtDevice/index"
]
},
{
"name": "personal",
"root": "packagePersonal",
"pages": [
"pages/vehicle/vehicle",
"pages/carBrandList/carBrandList",
"pages/coupon/list/list",
"pages/coupon/detail/detail",
"pages/order/order",
"pages/paid/paid",
"pages/message/message",
"pages/equity/equity",
"pages/address/address",
"pages/addOrEditAddress/addOrEditAddress",
"pages/refund/refund",
"pages/deliveryInfo/deliveryInfo",
"pages/successPay/successPay",
"pages/boutique/boutique",
"pages/boutiqueDetail/boutiqueDetail",
"pages/boutiqueMore/boutiqueMore",
"pages/boutiqueComment/boutiqueComment",
"pages/error/error",
"pages/boutiquePages/boutiquePay/boutiquePay",
"pages/boutiquePages/boutiquePaySuccess/boutiquePaySuccess",
"pages/boutiquePages/boutiqueInstall/boutiqueInstall",
"pages/boutiquePages/gift/gift",
"pages/boutiquePages/evaluation/evaluation",
"pages/boutiquePages/receiveSuccess/receiveSuccess",
"pages/smartplus/smartplus",
"pages/boutiqueList/boutiqueList",
"pages/boutiquePages/invite/invite",
"pages/boutiquePages/inviteSuccess/inviteSuccess"
]
}
],
"preloadRule": {
"pages/tab/index/index": {
"network": "all",
"packages": [
"homeindex"
]
},
"pages/tab/personal/personal": {
"network": "all",
"packages": [
"personal"
]
},
"packagePersonal/pages/smartplus/smartplus": {
"network": "all",
"packages": [
"smartplus"
]
}
}
}
\ No newline at end of file
const restapi = require('/utils/restapi.js')
const utilapi = require('/utils/util.js')
let app_timer = null
import router from './router/index.js'
//app.js
App({
// 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
onLaunch: function(option) {
wx.$router = router
var self = this;
// 获取用户登录场景值
console.log("onLaunch.option", option)
// 初始化本地会话信息
self.initSession();
self.globalData.app = this;
self.globalData.scene = option.scene;
self.globalData.appId = wx.getAccountInfoSync().miniProgram.appId;
self.globalData.initAppInfo((option.query.merchantId | option.query.m), function(res){
console.log("App onLaunch", res);
});
/**
* 获取自定义导航栏信息
*/
let padding = 6
let ios = true
wx.getSystemInfo({
success(res) {
console.log(res)
if (res.platform == "android") {
padding = 8
ios = false
}
self.globalData.systemInfo = {
statusBarPadding: padding,
ios: ios,
statusBarHeight: res.statusBarHeight,
phoneHeight: res.screenHeight - res.statusBarHeight
}
}
})
// 打开调试
// wx.setEnableDebug({
// enableDebug: true
// })
},
/**
* 初始化本地会话
*/
initSession: function(){
var sessionId = wx.getStorageSync(this.globalData.sessionKey);
if(!sessionId){
sessionId = utilapi.sessionId();
// 从cookie中获取sessionId存储到本地
console.log("sessionId:", sessionId);
wx.setStorageSync(this.globalData.sessionKey, sessionId);
}
},
initAppInfo: function(merchantId, callback){
let self = this;
if(merchantId == 0){
merchantId = '';
}
console.log("initAppInfo merchantId:", merchantId);
restapi.getAppInfo(merchantId, function (res) {
console.log('getAppInfo',res)
if(res.returnCode == 0){
self.globalData.extConfig = res.data;
wx.setStorageSync('EXT_CONFIG', res.data);
if (callback){
callback(res.data);
}
}
});
},
// 当小程序启动,或从后台进入前台显示,会触发
onShow: function(option) {
let self = this;
console.log("onShow.option ", option);
self.globalData.sceneData = option;
self.globalData.scene = option.scene;
self.globalData.initAppInfo((option.query.merchantId | option.query.m), function(res){
console.log("App onShow", res);
});
//获取转发场景下携带的参数
if (option.shareTicket) {
let shareInfo = wx.getShareInfo(option.shareTicket);
console.log("shareInfo", shareInfo);
}
//我的活动栏,首次进入小程序点击“我的活动”(小程序删除后再使用也算首次),显示使用提示“如何使用做活动”,yes:显示,no:不显示
let showDoActivity = wx.getStorageSync("showDoActivity");
if (!showDoActivity){
wx.setStorageSync("showDoActivity", "yes");
}
},
onHide: function() {
let that = this
that.globalData.clearMarqueeTime = true
if (app_timer) clearInterval(app_timer)
},
login: function() {
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
var self = this;
self.globalData.code = res.code;
restapi.jscodeLogin(res.code, self.globalData.appId, function(response) {
switch (response.returnCode) {
case '0': // 获取微信用户信息成功
self.globalData.userInfo = response.data;
if (response.data.accountId) { // 已获取手机号
// 登录成功回调
self.loginSuccessCallback(response.data);
} else { // 未获取手机号,授权获取
wx.navigateTo({
url: '/pages/auth/phone/phone'
});
}
break;
case '-1':
// 获取微信用户信息为空,授权获取
if (response.errId == '200205') {
self.userAuth();
}
break;
default:
wx.showToast({
title: response.message
})
}
});
}
})
},
userAuth: function() {
var self = this;
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserProfile({
desc: '用于完善会员资料',
lang: 'zh_CN',
success: res => {
wx.checkSession({
success() {
//session_key 未过期,并且在本生命周期一直有效
self.authLogin(res);
},
fail() {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success: response => {
appInstance.globalData.code = response['code'];
self.authLogin(res);
}
})
}
})
},
fail: res => {
console.log(res);
}
});
},
authLogin: function(wechatAuthSetting) {
var self = this;
wechatAuthSetting['code'] = self.globalData.code;
wechatAuthSetting['appId'] = self.globalData.appId;
wechatAuthSetting['merchantId'] = self.globalData.extConfig.merchantId;
console.log("wechatAuthSetting", wechatAuthSetting)
restapi.authLogin(wechatAuthSetting, function(response) {
console.log("authLogin", response)
switch (response.returnCode) {
case '0':
self.globalData.userInfo = response.data;
if (response.data.accountId) { // 已获取手机号
// 登录成功回调
self.loginSuccessCallback(response.data);
} else { // 未获取手机号,授权获取
wx.navigateTo({
url: '/pages/auth/phone/phone'
});
}
break;
default:
wx.showToast({
title: response.message
})
}
}, function() {
console.log("authLogin request fail!")
});
},
/**
* 提示框
*/
showMessage: function(title) {
wx.showToast({
title: title,
icon: 'none',
duration: 2000
})
},
getCustomerMessageNew(accountId) {
if(!accountId){
return;
}
restapi.getCustomerMessageNew({
accountId: accountId,
sendType: 'B'
}, res => {
console.log(res)
if (res.returnCode == 0) {
if (res.data.length > 0) {
wx.showTabBarRedDot({
index: 1
})
}
}
})
},
/**
* 登录成功回调
*/
loginSuccessCallback: function(userInfo) {
console.log(userInfo);
this.globalData.userInfo = userInfo;
this.globalData.accountId = userInfo.accountId;
// this.getCustomerMessageNew(userInfo.accountId)
// if (!app_timer) {
// app_timer = setInterval(() => {
// this.getCustomerMessageNew(userInfo.accountId)
// }, 1000 * 600)
// }
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(userInfo)
}
},
globalData: {
sessionKey: 'DJ_S_',
clearMarqueeTime:false,
extConfig: {
appId: null,
appName: '我的智慧门店',
merchantId: null,
merchantName: ''
},
scene: null,
app: null,
userInfo: null,
code: null,
accountId: null,
unionId: '',
authUserInfo: false,
authPhone: false,
curUserId:'',
nobindAppear:false,
deviceName:'',
smartCarAppList:[],
deviceStatusVO:{},
myMileageVO:{},
// 精品交付单需要的用户手机号
phoneNumber: '',
loginSuccessCallback: function(userInfo) {
this.app.loginSuccessCallback(userInfo);
},
login: function() {
this.app.login();
},
selectedDevice: {
userId: '',
typeNmae: '',
typeId: ''
},
systemInfo: null,
//我的活动栏需要的用户id
systemUserId:null,
employeeId:null,
smartCarMapKey: 'ZEJBZ-LVNRG-EXMQH-I74N6-EHNIS-WHF6E',
sceneData: null,
appId: null,
// 初始化应用信息
initAppInfo: function(merchantId, callback) {
var extConfig = wx.getStorageSync('EXT_CONFIG');
if (extConfig) {
this.extConfig = extConfig;
if (merchantId && extConfig.merchantId != merchantId) {
this.app.initAppInfo(merchantId, callback);
} else if (extConfig.merchantId) {
callback(extConfig);
}
} else {
this.app.initAppInfo((merchantId | null), callback);
}
}
}
})
\ No newline at end of file
{
"pages": [
"pages/tab/index/index",
"pages/tab/personal/personal",
"pages/auth/userInfo/userInfo",
"pages/auth/phone/phone",
"pages/route/to",
"pages/webpage/webpage",
"pages/upgrade/upgrade",
"pages/auth/login/login",
"pages/auth/index/index",
"pages/tab/logout/logout"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "我的智慧微店",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#999999",
"selectedColor": "#333333",
"backgroundColor": "#FFFFFF",
"list": [
{
"pagePath": "pages/tab/index/index",
"text": "首页",
"iconPath": "images/home.png",
"selectedIconPath": "images/home_active.png"
},
{
"pagePath": "pages/tab/personal/personal",
"text": "我的",
"iconPath": "images/mine.png",
"selectedIconPath": "images/mine_active.png"
}
]
},
"usingComponents": {
"navigation-bar": "components/navigationBar/navigationBar",
"share": "components/share/share",
"list": "components/list/list",
"activity-list": "components/activityList/activityList",
"shop-order": "components/shopOrder/shopOrder",
"servicer-list": "components/servicerList/servicerList",
"coupon": "components/coupon/coupon",
"marquee": "components/marquee/marquee",
"auth-setting": "components/authSetting/authSetting",
"copy-wx": "components/copyWx/copyWx",
"my-mileage": "components/myMileage/myMileage",
"date-picker": "components/datePicker/datePicker",
"dropdown": "components/dropdown/dropdown",
"modal": "components/modal/modal",
"cell": "components/cell/cell",
"gl-textarea": "components/glTextarea/glTextarea",
"my-swiper": "components/mySwiper/mySwiper",
"label": "components/icon/label/label",
"order-list": "components/orderList/orderList",
"nav-tab": "components/navTab/navTab",
"left-nav-tab": "components/leftNavTab/leftNavTab",
"cmd-list": "components/cmdList/cmdList",
"star-score": "components/starScore/starScore",
"star-score-res": "components/starScoreRes/starScoreRes",
"error-msg": "components/errorMsg/errorMsg",
"err-msg-no-icon": "components/errMsgNoIcon/errMsgNoIcon",
"gl-tab": "components/glTab/glTab",
"calendar": "/components/Calendar/Calendar"
},
"permission": {
"scope.userLocation": {
"desc": "您的位置信息将用于小程序服务"
}
},
"sitemapLocation": "sitemap.json",
"subpackages": [
{
"name": "homeindex",
"root": "packageIndex",
"pages": [
"pages/servicerAdviser/index/index",
"pages/servicerAdviser/detail/detail",
"pages/servicerAdviser/share/share",
"pages/servicerAdviser/merchant/merchant",
"pages/servicerAdviser/servicers/servicers",
"pages/servicerAdviser/viewActivity/viewActivity",
"pages/servicerAdviser/servicersInfo/servicersInfo",
"pages/remindService/index/index",
"pages/remindService/activity/activity",
"pages/remindService/activityDetail/activityDetail",
"pages/remindService/couponList/couponList",
"pages/quote/index/index",
"pages/quote/quoteRes/quoteRes",
"pages/index/index"
]
},
{
"name": "smartplus",
"root": "packageSmartPlus",
"pages": [
"pages/vehicleTracking/index/index",
"pages/vehicleTracking/share/share",
"pages/cloudSecurity/index/index",
"pages/cloudSecurity/setting/setting",
"pages/journey/index/index",
"pages/journey/detail/detail",
"pages/journey/share/share",
"pages/live/livePlay/livePlay",
"pages/live/reviewPlayList/reviewPlayList",
"pages/bindingDevice/bind/bind",
"pages/bindingDevice/index/index",
"pages/bindingDevice/devices/devices",
"pages/device/bindDevice/index",
"pages/device/boughtDevice/index"
]
},
{
"name": "personal",
"root": "packagePersonal",
"pages": [
"pages/vehicle/vehicle",
"pages/carBrandList/carBrandList",
"pages/coupon/list/list",
"pages/coupon/detail/detail",
"pages/order/order",
"pages/paid/paid",
"pages/message/message",
"pages/equity/equity",
"pages/address/address",
"pages/addOrEditAddress/addOrEditAddress",
"pages/refund/refund",
"pages/deliveryInfo/deliveryInfo",
"pages/successPay/successPay",
"pages/boutique/boutique",
"pages/boutiqueDetail/boutiqueDetail",
"pages/boutiqueMore/boutiqueMore",
"pages/boutiqueComment/boutiqueComment",
"pages/error/error",
"pages/boutiquePages/boutiquePay/boutiquePay",
"pages/boutiquePages/boutiquePaySuccess/boutiquePaySuccess",
"pages/boutiquePages/boutiqueInstall/boutiqueInstall",
"pages/boutiquePages/gift/gift",
"pages/boutiquePages/receiveSuccess/receiveSuccess",
"pages/smartplus/smartplus",
"pages/boutiqueList/boutiqueList",
"pages/boutiquePages/invite/invite",
"pages/boutiquePages/inviteSuccess/inviteSuccess"
]
},
{
"name": "payment",
"root": "packagesPayment",
"pages": [
"pages/payment/index",
"pages/QRPayment/QRPayment"
]
}
],
"preloadRule": {
"pages/tab/index/index": {
"network": "all",
"packages": [
"homeindex"
]
},
"pages/tab/personal/personal": {
"network": "all",
"packages": [
"personal"
]
},
"packagePersonal/pages/smartplus/smartplus": {
"network": "all",
"packages": [
"smartplus"
]
}
}
}
\ No newline at end of file
This diff is collapsed. Click to expand it.
// components/Calendar/Calendar.js
import Calendar from './Calendar_Function'
import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
Component({
/**
* 组件的属性列表
*/
properties: _component_.properties,
/**
* 组件的初始数据
*/
data: _component_.data,
/**
* 组件的方法列表
*/
methods: {
noScroll(){},
setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
let type = e && e.currentTarget && e.currentTarget.dataset.type || ''
let result = type === 'show'
if (!result) {
this.setData({
hideCalendar: true
})
setTimeout(() => {
this.setData({
show: result,
hideCalendar: false
})
}, 300)
} else {
this.setData({
show: result
})
if (!this.data.calenderBodyHeight) this[CalendarFunction].setCalenderBodyHeight()
}
},
dateChange(e) {
let {
current
} = e.detail
this.setData({
current
})
},
choose(e) {
let {
dateType,
minDate,
maxDate
} = this.data
let {
data,
invitestat
} = e.currentTarget.dataset
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data)) || invitestat !== 1) return
this[CalendarFunction][dateType](e)
},
// handleShow() {
// this.setData({
// isShow: !this.data.isShow
// })
// },
done() {
let {
dateType
} = this.data
this[CalendarFunction].done(dateType)
},
changeDate(e){
let {value} = e.detail
this.setData({
current:value
})
},
showShortcutPicker(){
this.setData({
showShortcut:!this.data.showShortcut
})
},
},
ready() {
this[CalendarFunction] = new Calendar(this)
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!-- <view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot></slot>
</view> -->
<!-- 弹框模式 -->
<!-- <view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar"></view>
<view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{isFullSucreen&&!showConfirm?"isFullSucreen":""}}' style="height:{{height}}"> -->
<view class='calender-header' style="height:{{height}}">
<view class='calender-title' wx:if='{{showTitle}}'>
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image src="../images/close.png" class='calender-close-image'> </image>
</view>
</view>
<block wx:if='{{showSubTitle}}'>
<picker class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}"
range="{{dateList}}" wx:if='{{shortcut}}'>
<view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}}
<view class='arrow {{showShortcut}}'></view>
</view>
</picker>
<view class='calender-subtitle' wx:else>{{dateList[current]}}</view>
</block>
<view class='calendar-weekdays'>
<block wx:for='{{weekdays}}' wx:key='index'>
<view class='calendar-weekday'>{{item}}</view>
</block>
</view>
</view>
<!-- <view class='calender-body' style="height:calc(100% - {{calenderBodyHeight}})"> -->
<view class="calender-body-layout">
<view class='calender-body' style="height:{{calenderHeight}}">
<swiper class='calender-swiper' bindchange='dateChange' current='{{current}}' vertical='{{vertical}}'>
<block wx:for='{{monthList}}' wx:key='index'>
<swiper-item>
<!-- <view class='calender-mark box-center' wx:if="{{!hideMark}}">{{item.mark}}月</view> -->
<view class='calender-month'>
<block wx:for='{{item.data}}' wx:for-item='i' wx:for-index='ind' wx:key='ind'>
<view class='calender-day {{ind == 0?i.week:""}} {{i.active?"active":""}} {{i.disable?"disable":""}}'
style="background:{{i.active?calenderColor:''}};color:{{i.middle?calenderColor:''}}" bindtap="choose"
data-index='{{index}}' data-ind='{{ind}}' data-data='{{i.data}}' data-inviteStat='{{i.inviteStat}}'>
<view class='calender-middle' style="background:{{calenderColor}};" wx:if='{{i.middle}}'></view>
<view class='box-center text'>
<view>{{i.day}}</view>
<view wx:if="{{!i.disable}}" class="invite-txt {{i.inviteStat == 1 ? '' : 'full'}}">
<span wx:if="{{i.inviteStat==1}}">可预约</span>
<span wx:if="{{i.inviteStat==1}}"></span>
<span wx:if="{{i.inviteStat==3}}">已满</span>
</view>
<view wx:if='{{dateType==="range"}}' class='calender-tips'>
<view wx:if='{{i.start}}'>{{rangeText.start}}</view>
<view wx:if='{{i.end}}'>{{rangeText.end}}</view>
</view>
</view>
</view>
</block>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
<!-- <view class="arrow-ico" bindtap="handleShow">
<image class="{{isShow ? 'open-icon' : ''}}" src="./images/open.png"></image>
</view> -->
<view class='calender-footer {{isFullSucreen}}' wx:if='{{showConfirm}}'>
<view
class='calender-btn {{dateType === "range" && !rangeDate.end ?"disable":""}} {{dateType === "multiple" && multipleDate.length < 1 ?"disable":""}}'
style="background:{{calenderColor}}" bindtap="done">{{confirmText||'确定'}}</view>
</view>
<!-- </view>
</view> -->
\ No newline at end of file
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 99;
}
.calender-bg {
position: absolute;
background: rgba(0, 0, 0, .5);
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.calender-view {
position: absolute;
left: 0;
width: 100%;
background: #fff;
animation: show-calender .5s forwards;
color: #333;
}
.calender-view.true {
border-radius: 40rpx 40rpx 0 0;
}
.calender-view.isFullSucreen {
box-sizing: border-box;
padding-bottom: 34px !important;
}
@keyframes show-calender {
from {
bottom: -100%;
}
to {
bottom: 0;
}
}
.calender-view.hideCalendar {
animation: hide-calender .5s forwards;
}
@keyframes hide-calender {
from {
bottom: 0;
}
to {
bottom: -100%;
}
}
.calender-header {
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.10);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: 88rpx;
text-align: center;
position: relative;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: 28rpx;
}
.calender-subtitle .arrow {
width: 14rpx;
height: 14rpx;
border-top: 2rpx solid transparent;
border-right: 2rpx solid #ccc;
border-bottom: 2rpx solid #ccc;
border-left: 2rpx solid transparent;
transform: rotate(45deg) translateY(-4rpx);
margin-left: 16rpx;
transition: all .3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(-4rpx);
}
.calender-close {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: 24rpx;
height: 24rpx;
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: 24rpx;
line-height: 60rpx;
}
.calendar-weekday {
text-align: center;
}
.calender-body-layout {
height: 100%;
/* transition: all 0.3s;
overflow: hidden; */
}
/* .calender-body-layout.open {
height: 100%;
} */
.calender-body {
width: 100%;
padding: 20rpx 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: rgba(0, 0, 0, .1);
text-shadow: 0 4rpx 20rpx rgba(0, 0, 0, .1);
font-size: 320rpx;
width: 100%;
text-align: center;
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.calender-day .invite-txt {
font-size: 24rpx;
color: #1979F1;
}
.calender-day.active .invite-txt {
color: #ffffff;
}
.calender-day .invite-txt.full {
color: #999999;
}
.calender-month {
height: 100%;
position: relative;
z-index: 1;
display: grid;
grid-row-gap: 10rpx;
grid-column-gap: 4rpx;
grid-template-rows: repeat(minmax(5, 6), 1fr);
grid-template-columns: repeat(7, 1fr);
}
.calender-day {
position: relative;
font-size: 32rpx;
display: flex;
border: 2rpx solid #D8D8D8;
}
.calender-day.active {
color: #fff;
border-radius: 8rpx;
}
.calender-day.disable {
opacity: .25;
}
.calender-day .calender-middle {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0.1;
}
.calender-day .text {
text-align: center;
width: 100%;
}
.calender-tips {
font-size: 14rpx;
}
.week-1 {
grid-column-start: 2;
}
.week-2 {
grid-column-start: 3;
}
.week-3 {
grid-column-start: 4;
}
.week-4 {
grid-column-start: 5;
}
.week-5 {
grid-column-start: 6;
}
.week-6 {
grid-column-start: 7;
}
/* .arrow-ico {
text-align: center;
}
.arrow-ico image {
width: 28rpx;
height: 22rpx;
transition: all .3s;
} */
.arrow-ico .open-icon {
transform: rotate(180deg);
}
.calender-footer {
position: absolute;
width: 100%;
left: 0;
bottom: 0;
padding: 14rpx 32rpx;
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: 72rpx;
font-size: 28rpx;
color: #fff;
border-radius: 999rpx;
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: .3;
}
\ No newline at end of file
export default {
properties: {
calenderHeight: {
// type: [String, Number]
// 兼容新版本不能使用type 改用optionalTypes 属性避免提示错误
type: String,
optionalTypes: [Number]
// optionalTypes: [String]
},
title: String, // 标题名称
hasRadius: {
type: Boolean,
value: true
}, // 是否圆角
showTitle: {
type: Boolean,
value: true
}, // 是否弹窗展示
isPopup: {
type: Boolean,
value: true
}, // 是否显示标题
showSubTitle: {
type: Boolean,
value: true
}, // 是否显示副标题
confirmText: String, // 确定按钮文本
showConfirm: {
type: Boolean,
value: true
}, // 是否显示确定按钮
calenderColor: {
type: String,
value: '#00A479'
}, // 日历主题色
previous: {
type: Number,
value: 3
}, // 当前月的前几个月 ,默认3个月
next: {
type: Number,
value: 3
}, // 当前月的后几个月 , 默认3个月
vertical: Boolean, //是否纵向滑动
dateType: {
type: String,
value: 'single'
},
/** 选择类型默认单选,single单选, multiple多个日期,range日期范围 */
value: String, //单选绑定数据
shortcut: Boolean, //日期快捷切换 默认为false
/** 分隔符,默认为 "-" */
separator: {
type: String,
value: '-'
},
/** 日期范围-开始结束文本 */
rangeText: {
type: Object,
value: {
start: '开始',
end: '结束'
}
},
/** 是否允许日期范围的起止时间为同一天, 默认为false */
allowSameDay: Boolean,
/** 周起始日,默认周日 */
firstDayOfWeek: {
// type: [Number, String],
// 新版本不能使用type 改用optionalTypes 属性避免提示错误
type: Number,
optionalTypes: [Number],
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark: Boolean,
/** 预约信息 */
dayInviteStatList: {
type: Array,
value: []
}
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: []
// isShow: false
}
}
// components/activityList/activityList.js
const debounce = (fn, delay) => {
let timer = null
return function () {
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(fn, delay)
}
}
Component({
/**
* 组件的属性列表
*/
properties: {
activityList: {
type: Array,
valeu: [],
observer:function(n,o) {
}
}
},
/**
* 组件的初始数据
*/
data: {
_activityList: []
},
ready(){
},
/**
* 组件的方法列表
*/
methods: {
jumpActivity(e) {
debounce(this.jump(e),1000)
},
jump(e) {
let btnData = {
item: e.currentTarget.dataset.item
}
this.triggerEvent('myevent', btnData)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='activity-list' wx:for='{{activityList}}' data-item='{{activityList[idx]}}' bindtap='jumpActivity' wx:for-index="idx" wx:key="index" wx:for-item="item">
<image src='{{item.thumbnailUrl}}'></image>
<view class='list-info'>
<view class='activity-name'>{{item.shopName}}</view>
<view wx:if='{{item.marketType == 0}}' class='activity-type'>
【秒杀活动】
<text wx:if='{{!item.isBegin}}' class='activity-time'>{{item.countDown}}</text>
<text wx:if='{{item.isBegin}}' class='activity-time'>{{item.countDown}}</text>
</view>
<view class="demo" wx:if='{{item.demo}}'>
厂商指导价 ¥2482
</view>
<view class='tags'>
<block wx:for='{{item.shopTags}}' wx:key='index' wx:for-item='i'>
<view class='tags-item' wx:if='{{i}}'>{{i}}</view>
</block>
</view>
<view class='activity-price'>
<block wx:if='{{item.marketType == 0}}'>
<block wx:if='{{item.flashSalePrice}}'>
<view class='new-price'>
<text>{{item.flashSalePrice}}</text>元</view>
</block>
<block wx:if='{{item.interval}}'>
<view class='new-price'>
<text>{{item.interval}}</text>元</view>
</block>
<view class='old' wx:if='{{item.retailPrice}}'>¥{{item.retailPrice}}</view>
</block>
<view class='new-price' wx:if='{{item.showPrice&&item.marketType == 1}}'>
<text>{{item.showPrice}}</text>元
</view>
</view>
<view class='activity-btn'>立即参与</view>
</view>
</view>
\ No newline at end of file
/* components/activityList/activityList.wxss */
.activity-list {
width: 94.7%;
height: 216rpx;
background: #fff;
border: 1rpx solid #eee;
box-shadow: 0 2px 5px 0 rgba(51, 51, 51, 0.10);
border-radius: 8rpx;
margin: 0 auto 20rpx;
}
.activity-list image {
width: 256rpx;
height: 100%;
float: left;
}
.list-info {
float: left;
width: 454rpx;
box-sizing: border-box;
padding: 16rpx 6rpx 16rpx 0;
position: relative;
height: 100%;
}
.activity-name {
font-size: 32rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: bold;
line-height: 44rpx;
}
.activity-name {
padding-left: 24rpx;
margin-bottom: 8rpx;
}
.activity-type {
font-size: 24rpx;
padding-left: 14rpx;
line-height: 34rpx;
color: #f24724;
}
.activity-time {
color: #999;
font-size: 24rpx;
line-height: 34rpx;
}
.activity-price {
font-size: 24rpx;
color: #999;
position: absolute;
left: 24rpx;
bottom: 8rpx;
line-height: 50rpx;
}
.old {
text-decoration: line-through;
display: inline-block;
}
.new-price {
display: inline-block;
color: #f24724;
margin-right: 32rpx;
}
.new-price text {
font-size: 36rpx;
font-weight: bold;
}
.activity-btn {
position: absolute;
right: 32rpx;
bottom: 16rpx;
border: 1rpx solid #f24724;
border-radius: 30rpx;
width: 118rpx;
height: 42rpx;
text-align: center;
font-size: 20rpx;
color: #f24724;
line-height: 42rpx;
}
.demo {
font-size: 24rpx;
color: #999;
padding-left: 24rpx;
}
.tags{
padding-left: 6rpx;
}
.tags-item {
float: left;
background: rgb(246, 84, 44, 0.1);
border-radius: 20rpx;
font-size: 20rpx;
color: #f17b28;
padding: 0 16rpx;
height: 36rpx;
line-height: 36rpx;
margin-left: 20rpx;
margin-bottom: 12rpx;
}
// components/authSetting/authSetting.js
const restapi = require('../../utils/restapi.js')
var appInstance = getApp();
Component({
/**
* 组件的属性列表
*/
properties: {
auth: {
type: Boolean,
value: true,
observer: function (newVal, oldVal) {
this.getHeadImage()
}
},
type: {
type: Boolean,
value: true
},
special: {
type: Boolean,
value: false
},
index: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
auth: true,
type: true,
appLogo: '',
appName: '',
merchantName: '',
gender: 1
},
ready() {
this.getHeadImage()
},
/**
* 组件的方法列表
*/
methods: {
choose() {
this.setData({
agree: !this.data.agree,
})
},
jump(e) {
console.log(e)
var globalData = appInstance.globalData.extConfig
let {
url
} = e.currentTarget.dataset
restapi.getMerchantBussiness(globalData.merchantId, function (res) {
// console.log(res);
if (res.returnCode == '0') {
let path = `https://dj.glsx.com.cn/agreement/djUserPolicy.html?merchantName=${globalData.merchantName}&phone=${res.data.phone}`
wx.navigateTo({
url: `/pages/webpage/webpage?path=${encodeURIComponent(path)}`
})
}
}, function (res) {
console.log(res);
})
},
// 获取小程序头像
getHeadImage() {
},
noScroll() {},
/**
* 获取授权用户信息
*/
getUserProfile: function (e) {
var self = this;
wx.getUserProfile({
desc: '用于完善会员资料',
lang: 'zh_CN',
success: res => {
console.log("res", res)
self.data.gender = res.userInfo.gender
wx.checkSession({
success() {
//session_key 未过期,并且在本生命周期一直有效
self.authLogin(res);
},
fail() {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success: response => {
appInstance.globalData.code = response['code'];
self.authLogin(res);
}
})
}
})
},
fail: res => {
console.log(res);
}
});
},
/**
* 获取授权手机号
*/
getPhoneNumber: function (e) {
var self = this;
var sceneData = appInstance.globalData.sceneData;
console.log(appInstance.globalData.sceneData)
if (e.detail.encryptedData) {
var wechatAuthSetting = {
'encryptedData': e.detail.encryptedData,
'iv': e.detail.iv,
'gender': self.data.gender,
'sceneUrl': sceneData.path
};
if (sceneData.query.id) {
wechatAuthSetting['sceneParam'] = sceneData.query.id.trim();
}
if (sceneData.query.employeeId) {
wechatAuthSetting['sceneParam'] = sceneData.query.employeeId;
}
wechatAuthSetting['merchantId'] = appInstance.globalData.extConfig.merchantId;
restapi.authPhone(wechatAuthSetting, function (response) {
if (response.returnCode == '0') {
var resData = response.data;
appInstance.globalData.authPhone = true;
appInstance.globalData.phoneNumber = resData.phone;
// 登录成功回调
appInstance.loginSuccessCallback(resData);
// 关闭授权窗口
self.setData({
auth: false
});
self.triggerEvent('success', false)
} else {
wx.showToast({
title: response.message,
success: function () {
self.setData({
auth: false
});
}
})
}
});
}
},
/**
* 授权用户信息登录
*/
authLogin: function (wechatAuthSetting) {
var sceneData = appInstance.globalData.sceneData;
console.log(appInstance.globalData.sceneData);
var self = this;
wechatAuthSetting['code'] = appInstance.globalData.code;
wechatAuthSetting['appId'] = appInstance.globalData.appId;
wechatAuthSetting['gender'] = self.data.gender;
wechatAuthSetting['sceneUrl'] = sceneData.path;
if (sceneData.query.employeeId) {
wechatAuthSetting['sceneParam'] = sceneData.query.employeeId;
}
wechatAuthSetting['merchantId'] = appInstance.globalData.extConfig.merchantId;
restapi.authLogin(wechatAuthSetting, function (response) {
switch (response.returnCode) {
case '0':
appInstance.globalData.authUserInfo = true;
appInstance.globalData.userInfo = response.data;
if (response.data.accountId) { // 已获取手机号
appInstance.globalData.authPhone = true;
// 登录成功回调
appInstance.globalData.loginSuccessCallback(response.data);
// 关闭授权窗口
self.setData({
auth: false
});
} else {
// 未获取手机号,授权获取
self.setData({
type: false
});
}
break;
default:
wx.showToast({
title: response.message
})
}
}, function () {
wx.showToast({
title: '授权用户信息失败'
})
});
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<block wx:if='{{auth}}'>
<block wx:if='{{index}}'>
<view class="authSetting-index">
<view class="authSetting-index-box">
<image src="./images/authSetting.png"></image>
<block>
<block wx:if='{{type}}'>
<view class='authSetting-tip'>授权可获取个性化推荐活动</view>
<view class="login" wx:if="{{!agree}}">点击授权</view>
<button class="login agree" wx:else bindtap="getUserProfile">点击授权</button>
</block>
<block wx:else>
<view class='authSetting-tip'>登录后即刻开启养车之旅</view>
<view class="login" wx:if="{{!agree}}">点击登录</view>
<button wx:else class="login agree" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">点击登录</button>
</block>
</block>
</view>
<view class='tips' >
<view class='choose-box' bindtap="choose" >
<view class='icon'>
<image src="{{agree?'./images/ok.png':'./images/box.png'}}" class='check-img'></image>
</view>
</view>
阅读并同意以下协议
<!-- <text catchtap="jump" data-url="agree">《服务协议》</text> -->
<text catchtap="jump" data-url="private">《隐私政策》</text>
</view>
</view>
</block>
<block wx:else>
<view class='authSetting'>
<block wx:if='{{type}}'>
<text>登录后即刻开启养车之旅</text>
<button class="login agree" open-type="getUserInfo" bindgetuserinfo="getUserInfo">点击登录</button>
</block>
<block wx:else>
<text>授权手机号可获取个性化推荐活动</text>
<button class="login agree" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">点击授权</button>
</block>
</view>
</block>
</block>
\ No newline at end of file
/* components/authSetting/authSetting.wxss */
.authSetting-index {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
height: calc(100%);
background-color: #fff;
z-index: 999;
}
.authSetting-index-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.authSetting-index-box image {
width: 490rpx;
height: 292rpx;
display: block;
margin: 0 auto;
}
.authSetting-index-box .authSetting-tip {
margin: 40rpx 0 122rpx;
font-size: 14px;
color: #333;
}
.authSetting-index-box .login {
display: inline-block;
width: 200rpx;
height: 64rpx;
line-height: 60rpx;
font-size: 28rpx;
background-color: #ddd;
color: #fff;
margin: 0;
/* box-shadow: 0 4rpx 10rpx 0 rgba(51, 51, 51, 0.10); */
border-radius: 40rpx;
padding: 0;
}
.authSetting-index-box .login.agree {
background: #1979f1;
}
.authSetting {
position: fixed;
bottom: 0;
left: 0;
z-index: 99999;
width: 100vw;
height: 120rpx;
background-color: #fff;
font-size: 28rpx;
color: #333;
}
.authSetting text {
position: absolute;
top: 50%;
left: 40rpx;
transform: translateY(-50%);
}
.authSetting button {
display: inline-block;
width: 160rpx;
height: 60rpx;
line-height: 60rpx;
background: #1979f1;
font-size: 28rpx;
color: #fff;
margin: 0;
box-shadow: 0 2px 5px 0 rgba(51, 51, 51, 0.10);
position: absolute;
right: 40rpx;
top: 50%;
transform: translateY(-50%);
border-radius: 40rpx;
padding: 0;
}
.authSetting-index-box .merchant {
font-size: 28rpx;
color: #31418b;
margin-bottom: 82rpx;
font-weight: bold;
height: 48rpx;
line-height: 48rpx;
}
.merchant image {
width: 48rpx;
height: 48rpx;
display: inline-block;
margin-right: 20rpx;
vertical-align: middle;
}
.tips {
position: fixed;
width: 100%;
left: 0;
bottom: 60rpx;
font-size: 24rpx;
color: #999;
letter-spacing: 2rpx;
padding-left: 28rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
}
.tips text {
color: #ff600f;
}
.tips .icon {
position: absolute;
top: 50%;
left: 50%;
width: 24rpx;
height: 24rpx;
border-radius: 2rpx;
box-sizing: border-box;
transform: translate(-50%, -50%);
}
.tips .icon .check-img {
vertical-align: top;
width: 100%;
height: 100%;
}
.tips .choose-box {
width: 80rpx;
height: 80rpx;
position: relative;
}
\ No newline at end of file
// components/cell/cell.js
import {
haveEmoji,
replaceEmoji
} from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
label: String,
required: Boolean,
type: null,
maxlength: Number,
pickerData: Array,
placeholder: String,
value: {
type: String,
value: '',
observer: function(n, o) {
this.setData({
value: n
})
}
},
hideArrow: Boolean,
inputAlign: {
type: String,
value: 'left'
},
disabled: Boolean,
pickerFlag: {
type: Boolean,
value: true
},
labelSelf:null,
inputType:null,
iconSlot:null
},
/**
* 组件的初始数据
*/
data: {
typeIndex: 0,
subTypeIndex: 0,
pickerValue: [0, 0],
},
/**
* 组件的方法列表
*/
methods: {
change(e) {
let index = e.detail.value
this.setData({
pickerValue: index
})
this.triggerEvent('click', {
type: this.data.type,
value: index
})
},
click(e) {
if(this.properties.type == 'input') {
this.setData({
focus:true
})
} else{
this.triggerEvent('click')
}
},
input(e) {
let value = e.detail.value
if (haveEmoji(value)) value = replaceEmoji(value)
this.triggerEvent('input', {
type: this.data.type,
value: value
})
},
blur(){
this.setData({
focus:false
})
},
bindcolumnchange(e) {
console.log(e)
if (e.detail.column == 0) {
wx.showLoading({
title: '',
})
}
this.triggerEvent('pickerchange', e.detail)
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='cell-box'>
<block wx:if='{{type=="picker"}}'>
<picker range='{{pickerData}}' disabled="{{disabled}}" value='{{pickerValue}}' bindchange='change' range-key='name' mode='multiSelector' bindcolumnchange='bindcolumnchange'>
<view class='cell {{inputAlign=="right"?"inputRight":"inputLeft"}}'>
<view class='label {{required?"required":""}}' wx:if='{{label}}'>{{label}}</view>
<view class='value {{value?"":"no-value"}}'>
{{value ||'请选择'}}
<image wx:if='{{!hideArrow}}' class='arrow' src="./images/arrow.png"></image>
</view>
</view>
</picker>
</block>
<block wx:else>
<view class='cell {{inputAlign=="right"?"inputRight":"inputLeft"}} {{!label?"left":""}}' bindtap="click">
<view class='label {{required?"required":""}} {{labelSelf}}' wx:if='{{label}}'>{{label}}</view>
<block wx:if='{{type=="input"}}'>
<input class='input' type='{{inputType}}' focus="{{focus}}" bindblur="blur" placeholder="{{placeholder}}" disabled="{{disabled}}" bindinput="input" placeholder-class="no-value" maxlength="{{maxlength}}" value='{{value}}'></input>
</block>
<block wx:elif='{{type=="slot"}}'>
<slot></slot>
</block>
<block wx:else>
<view class='value {{value?"":"no-value"}}'>
<text class='text'>{{value||'请选择'}}</text>
<block wx:if='{{iconSlot}}'>
<slot></slot>
</block>
<block wx:else>
<image wx:if='{{!hideArrow}}' class='arrow' src="./images/arrow.png"></image>
</block>
</view>
</block>
</view>
</block>
</view>
\ No newline at end of file
/* components/cell/cell.wxss */
.cell-box {
padding-left: 40rpx;
background: #fff;
}
.cell {
min-height: 100rpx;
position: relative;
border-bottom: 2rpx solid #eee;
font-size: 28rpx;
color: #151515;
display: flex;
align-items: center;
box-sizing: border-box;
padding-right: 40rpx;
}
.cell.inputRight{
justify-content:space-between;
}
.cell.inputRight .input {
text-align: right;
}
.required::before{
content: '*';
color: red;
display: inline-block;
}
.value{
width: 75%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.value .text{
display: inline-block;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
width: 90%;
}
.no-value{
color: #999;
}
.cell.cellInput .input {
text-align: right;
width: 70%;
}
.cell .input{
width: 75%;
text-align: left;
}
.cell.inputLeft .label{
width: 25%;
}
.cell .label.flex-start{
align-self: flex-start;
margin-top: 20rpx;
}
.arrow{
width: 28rpx;
height: 28rpx;
vertical-align: middle;
transform: translateY(2rpx);
margin-left:20rpx;
}
// components/orderList/orderList.js
const util = require('../../utils/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
cmdData: {
type: Array
},
cmdImgHeight: {
type: String
},
addStyle: {
type: Object
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的生命周期
*/
lifetimes: {
ready() {
let self = this;
util.getViewInfo('.cmd-item', res => {
if(res) {
let { height, bottom } = res;
wx.getSystemInfo({
success: function(res) {
// margin-bottom: 11px;
let itemHeight = height + 11;
self.triggerEvent('itemHeight', { itemHeight });
}
})
} else {
self.triggerEvent('itemHeight', { itemHeight: null });
}
}, this)
}
},
/**
* 组件的方法列表
*/
methods: {
tap(e) {
let { goodscode } = e.currentTarget.dataset;
util.throttle(() => {
this.triggerEvent('toDetailPage', { goodscode });
}, 1000)()
},
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='cmd-list-group flex-row' style="height: {{scrollHeight}}px">
<block wx:for='{{cmdData}}' wx:key='index'>
<view class="cmd-item" bindtap='tap' data-id="{{item.id}}" data-goodsCode="{{item.goodsCode}}">
<view class="cmd-img" style="height: {{cmdImgHeight}}px">
<image class="img" src="{{item.thumbUrl}}"></image>
</view>
<view class="cmd-text-box">
<view class="cmd-text text-two-line">{{item.goodsName}}</view>
<view class="cmd-price text-two-line" style="font-size:{{addStyle.priceFontSize ? addStyle.priceFontSize :'24'}}rpx" wx:if="{{item.upgradePrice}}">升级价:¥{{item.upgradePrice}}</view>
</view>
</view>
</block>
</view>
\ No newline at end of file
/* components/orderList/orderList.wxss */
@import '../../style/common.wxss';
.cmd-list-group {
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
}
.cmd-item {
position: relative;
box-sizing: border-box;
border: 1rpx solid #EEEEEE;
border-radius: 8rpx;
-webkit-border-radius: 8rpx;
margin-bottom: 22rpx;
width: 48%;
color: #333;
background-color: #fff;
box-shadow: 0 2rpx 6rpx 0 rgba(215,215,215,0.30);
}
.cmd-item .cmd-img {
overflow: hidden;
border-radius: 8rpx 8rpx 0 0;
-webkit-border-radius: 8rpx 8rpx 0 0;
width: 100%;
/* height: 342rpx; */
}
.cmd-img .img {
width: 100%;
height: 100%;
}
.cmd-item .cmd-text-box {
position: relative;
box-sizing: border-box;
padding: 0 20rpx 20rpx 20rpx;
height: 160rpx;
}
.cmd-item .cmd-text {
margin-top: 20rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
height: 80rpx;
font-size: 28rpx;
line-height: 40rpx;
word-break: break-all;
}
.cmd-item .cmd-price {
font-size: 24rpx;
white-space: nowrap;
color: #FF6601;
}
\ No newline at end of file
// components/copyWx/copyWx.js
Component({
/**
* 组件的属性列表
*/
properties: {
show:{
type:Boolean,
value:false
}
},
/**
* 组件的初始数据
*/
data: {
pages: [
{
src: './images/page1.png',
active: true
},
{
src: './images/page2.png',
active: false
}
]
},
/**
* 组件的方法列表
*/
methods: {
noScroll() { },
change(e) {
let pages = this.data.pages
let index = e.detail.current
pages.forEach(e => e.active = false)
pages[index].active = true
this.setData({
pages: pages
})
},
iKnow(){
this.triggerEvent('close')
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='box' wx:if='{{show}}' catchtouchmove='noScroll'>
<view class='content'>
<view class='content-box'>
<swiper bindchange='change'>
<block wx:for='{{pages}}' wx:key='*this'>
<swiper-item>
<image src='{{item.src}}'></image>
</swiper-item>
</block>
</swiper>
</view>
<view class='dots-box'>
<view class='dot {{item.active?"active":""}}' wx:for='{{pages}}' wx:key='*this'></view>
</view>
<view class='tips'>微信号已复制,粘贴可添加顾问为微信好友</view>
<view class='btn' bindtap='iKnow'>知道啦</view>
</view>
</view>
\ No newline at end of file
/* components/copyWx/copyWx.wxss */
.box {
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
width: 100vw;
height: 100vh;
z-index: 9999999;
}
.box .content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 540rpx;
height: 758rpx;
background-color: #fff;
border-radius: 8rpx;
z-index: 9999999;
}
.content-box {
padding: 20rpx;
height: 514rpx;
width: 502rpx;
}
.content-box swiper {
height: 100%;
}
.content-box swiper image{
height: 514rpx;
width: 502rpx;
}
.dots-box {
text-align: center;
font-size: 0;
padding-top: 8rpx;
}
.dots-box .dot {
display: inline-block;
border: 2rpx solid #d8d8d8;
width: 10rpx;
height: 10rpx;
border-radius: 100%;
box-sizing: border-box;
margin-right: 12rpx;
overflow: hidden;
}
.dots-box .active {
border-color: #333;
background: #333;
}
.tips {
text-align: center;
color: #333;
font-size: 24rpx;
padding: 26rpx 0 20rpx;
border-bottom: 1rpx solid #ddd;
}
.btn {
text-align: center;
height: 100rpx;
line-height: 100rpx;
font-size: 32rpx;
color: #1979f1;
letter-spacing: 0.52rpx;
}
// components/coupon/coupon.js
Component({
/**
* 组件的属性列表
*/
properties: {
data: {
type: Object
},
type: {
type:Number,
value: 1,
observer: function (newVal, oldVal) {
}
},
showBtn: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
touch(e) {
let id = e.currentTarget.dataset.id;
let index = e.currentTarget.dataset.index;
let activityId = e.currentTarget.dataset.activityid;
if(index == 1) {
this.triggerEvent('toUse', {id, activityId})
} else {
this.triggerEvent('receive', {id, activityId})
}
},
goDetail(e) {
let id = e.currentTarget.dataset.id
let receiveStatus = e.currentTarget.dataset.status
this.triggerEvent('goDetail', { id, receiveStatus})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='alertItem {{type==3?"lose":""}}' wx:for='{{data}}' wx:key='*this' style='margin-top:{{index != 0 ?"20rpx":""}}'>
<view class='alertTips' wx:if='{{item.reminderName}}'>{{item.reminderName}}</view>
<!-- 优惠券 -->
<view class='coupon clearfix coupon-bg' data-id="{{item.id}}" data-status='{{item.receiveStatus}}' bindtap='goDetail'>
<view class='couponLeft pull-left'>
<view class='couponMain'>
<view wx:if='{{item.discountType != 4}}' class='couponRebate in-block'>{{item.denomination}}</view>
<view wx:if='{{item.discountType == 4}}' class='discountType'>实物券</view>
<view class='couponName in-block'>{{(item.discountType == 1 || item.discountType == 3)?'元':item.discountType == 2?'折':''}}</view>
<view wx:if='{{item.discountType != 4}}' class='couponUseDescription'>{{item.useBarriers == 1?'无限制':'满'+ item.full +'元可用'}}</view>
<view wx:if='{{item.discountType == 4 && item.denomination != null}}' class='discountType_price' >价值{{item.denomination}}元</view>
</view>
</view>
<view class='couponRight pull-left'>
<view class='couponName'>{{item.couponName}}<text wx:if='{{item.amount>0}}'>({{item.amount}}张)</text></view>
<view class='couponType'>适用项目:{{item.couponType}}</view>
<view class='couponTime' wx:if='{{item.receiveStatus == 2}}'>有效期:{{item.receiveStartTime}}-{{item.receiveEndTime}}</view>
<view class='couponTime' wx:else>有效期:{{item.effectiveEndTime}}</view>
<!-- <view class='couponType' wx:else>
有效期:{{item.receiveEndTime}}
</view> -->
<view class='couponUseBtn {{type==2?"used":type==3?"outDate":""}}' wx:if='{{item.receiveStatus == 2 && showBtn}}'>
{{type==1?"去使用":type==2?"已使用":"已失效"}}
</view>
<!-- <view class="couponUseBtn-hide" wx:if='{{item.receiveStatus == 2 && showBtn}}' data-id="{{item.id}}" bindtap='touch' data-index='1'></view> -->
<view wx:if='{{item.receiveStatus == 1 && showBtn}}' class='couponUseBtn' data-id="{{item.id}}" data-activityid="{{item.activityId}}" catchtap='touch' data-index='2'>领取</view>
<!-- <view wx:if='{{item.receiveStatus == 1 && showBtn}}' class="couponUseBtn-hide" data-id="{{item.id}}" data-activityid="{{item.activityId}}" catchtap='touch' data-index='2'></view> -->
</view>
</view>
</view>
\ No newline at end of file
/* components/coupon/coupon.wxss */
@import "../../app.wxss";
/* 优惠券 */
.clearfix::after {
content: '';
display: block;
clear: both;
}
.pull-left {
float: left;
}
.tips {
text-align: center;
color: #999;
font-size: 28rpx;
margin: 30rpx 0;
}
.alertTips {
color: #999;
margin: 20rpx 0;
font-size: 24rpx;
}
.coupon {
font-size: 24rpx;
width: 670rpx;
height: 160rpx;
color: #fff;
box-shadow: 0 8rpx 12rpx 0 rgba(215, 215, 215, 0.5);
}
.lose .coupon {
-webkit-filter: grayscale(1);
}
.coupon .couponLeft {
width: 27%;
height: 100%;
box-sizing: border-box;
position: relative;
}
.coupon .couponLeft .couponMain {
text-align: center;
padding: 20rpx 0;
}
.coupon .couponLeft .couponRebate {
font-size: 60rpx;
line-height: 84rpx;
letter-spacing: 0;
font-weight: bold;
margin-bottom: 10rpx;
}
.coupon .couponLeft .discountType {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 40rpx;
width: 100%;
}
.discountType_price{
width: 100%;
position: absolute;
left: 0;
bottom: 20rpx;
font-size: 20rpx;
}
.coupon .couponLeft .couponName {
font-size: 24rpx;
letter-spacing: 0;
}
.coupon .couponLeft .couponUseDescription {
font-size: 20rpx;
}
.m-l-14 {
margin-left: 14rpx;
}
.coupon .couponLeft .couponType {
letter-spacing: 0;
opacity: 0.8;
margin-top: 8rpx;
}
.coupon .couponLeft .couponLine {
width: 1rpx;
height: 20rpx;
margin-left: 20rpx;
margin-right: 21rpx;
opacity: 0.5;
background-color: #fff;
}
.in-block {
display: inline-block;
}
.coupon .couponRight {
width: 73%;
height: 100%;
color: #333;
position: relative;
box-sizing: border-box;
padding: 16rpx 20rpx;
}
.coupon .couponRight .couponName {
font-size: 28rpx;
font-weight: bold;
line-height: 40rpx;
margin-bottom: 20rpx;
}
.coupon .couponRight .couponType, .coupon .couponRight .couponTime {
font-size: 24rpx;
color: #999;
line-height: 34rpx;
}
.coupon .couponRight .couponTime {
font-size: 20rpx;
}
.coupon .couponRight .couponUseBtn {
position: absolute;
top: 50%;
right: 40rpx;
transform: translateY(-50%);
border: 2rpx solid #ff634e;
border-radius: 25rpx;
width: 116rpx;
height: 40rpx;
line-height: 40rpx;
font-size: 24rpx;
text-align: center;
color: #ff634e;
}
.coupon .couponRight .couponUseBtn-hide {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
background: #096;
width: 156rpx;
height: 80rpx;
z-index: 9999;
opacity: 0;
}
.coupon .couponRight .used {
border-color: #333;
color: #333;
}
.coupon .couponRight .outDate {
border-color: #999;
color: #999;
}
// components/datePicker/datePicker.js
const util = require('../../utils/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
dateList: {
type: Array,
value: [],
observer: function(newVal, oldVal) {
if (newVal) {
this.setData({
time: this.pushDay(this.data.today.getMonth() + 1)
})
}
}
},
show: {
type: Boolean,
value: false,
observer: function(newVal, oldVal) {
if (newVal) {
this.open()
}
}
},
count: {
type: Number,
value: 3
},
date: {
type: String,
value: new Date().format('yyyy-MM-dd'),
observer: function(newVal, oldVal) {
let today = this.data.date.split('-');
if(today[0] == ""){
today=(new Date()).format('yyyy-MM-dd').split("-")
}
this.setData({
today: new Date(today[0], today[1] - 1, today[2]),
day: `${today[0]}年\n${today[1]}月`
})
wx.canIUse('nextTick') ? wx.nextTick(() => this.setData({
time: this.pushDay(this.data.today.getMonth() + 1)
})) : setTimeout(() => this.setData({
time: this.pushDay(this.data.today.getMonth() + 1)
}), 100)
}
}
},
/**
* 组件的初始数据
*/
data: {
up: false,
height: 0,
day: '',
time: [],
today: null,
cookie: null,
showRight: false,
stop: ''
},
/**
* 组件的方法列表
*/
methods: {
/**
* 禁止滑动
*/
noScroll() {},
/**
* 显示
*/
open() {
const query = wx.createSelectorQuery().in(this)
wx.canIUse('nextTick') ? wx.nextTick(() => this.setHeight(query)) : setTimeout(() => this.setHeight(query), 100)
if (this.data.today.format('yyyy-MM') != new Date().format('yyyy-MM')) this.setData({showRight: true})
let time = new Date()
time.setMonth(time.getMonth() - (this.data.count - 1))
this.setData({stop: time.format('yyyy-MM')})
},
/**
* 设置日期高度
*/
setHeight(el) {
el.select('.day').boundingClientRect(res => {
this.setData({
up: true,
height: res.width * 2 * 0.84
})
}).exec()
},
/**
* 关闭
*/
close() {
this.triggerEvent('close', false)
this.setData({up: false})
},
/**
* 选中日期
*/
chooseDay(e) {
let dataset = e.currentTarget.dataset
let index = dataset.index
let day = dataset.date.split('-')
let time = this.data.time
let cookie = new Date(day[0], day[1] - 1, day[2])
time.forEach(e => e.active = false)
time[index].active = true
this.setData({
time: time,
cookie: cookie
})
this.triggerEvent('choose',cookie.format('yyyy-MM-dd'))
this.close()
},
/**
* 上个月
*/
left() {
if (this.data.today.format('yyyy-MM') == this.data.stop) {
wx.showModal({
content: `只支持查看近${ this.data.count}个月的记录`,
showCancel:false,
confirmText: '知道了'
})
} else {
this.setData({
day: this.getLastMonth(this.data.today)
})
if (this.data.today.format('yyyy-MM') < new Date().format('yyyy-MM') && this.data.showRight == false) {
this.setData({
showRight: true
})
}
}
},
/**
* 下个月
*/
right() {
let today = this.data.today
let time = new Date()
if (today.format('yyyy-MM') < time.format('yyyy-MM')) {
this.setData({
day: this.getNextMonth(this.data.today),
})
if (this.data.today.format('yyyy-MM') == time.format('yyyy-MM')) this.setData({
showRight: false
})
}
},
/**
* 获取上个月
*/
getLastMonth(date) {
let year = date.getFullYear()
let month = date.getMonth()
if (month == 0) {
year -= 1
month = 12
}
this.setData({
today: new Date(year, month - 1),
})
wx.canIUse('nextTick') ? wx.nextTick(() => this.setData({
time: this.pushDay(month)
})) : setTimeout(() => this.setData({
time: this.pushDay(month)
}), 100)
let m = month
if (m < 10) m = '0' + m
return `${year}年\t${m}月`
},
/**
* 获取下个月
*/
getNextMonth(date) {
let year = date.getFullYear()
let month = date.getMonth() + 1
if (month == 12) {
year += 1
month = 0
}
this.setData({
today: new Date(year, month),
})
wx.canIUse('nextTick') ? wx.nextTick(() => this.setData({
time: this.pushDay(month + 1)
})) : setTimeout(() => this.setData({
time: this.pushDay(month + 1)
}), 100)
let m = month + 1
if (m < 10) m = '0' + m
return `${year}年\t${m}月`
},
/**
* 获取月份天数
*/
getDayNumber(year, time) {
let day = 0
if (time == 2) {
day = year % 4 == 0 ? 29 : 28
} else if (time == 4 || time == 6 || time == 9 || time == 11) {
day = 30
} else {
day = 31
}
return day
},
/**
* 填充数据
*/
pushDay(month, arr = [], day = new Date()) {
let last = null
let next = null
let today = this.data.today
let week = new Date(today.format('yyyy'), today.format('MM') - 1, 1).getDay()
last = today.format('MM') == 1 ? new Date(today.getFullYear() - 1, 11, 1) : new Date(today.getFullYear(), today.getMonth() - 1, 1)
next = today.format('MM') == 12 ? new Date(today.getFullYear() + 1, 0, 1) : new Date(today.getFullYear(), today.format('MM'), 1)
let lastNumber = this.getDayNumber(last, parseInt(last.format('MM')))
for (let i = 1; i <= this.getDayNumber(today, month); i++) {
let d = i
if (d < 10) d = '0' + d
arr.push({
value: i,
date: `${today.format('yyyy')}-${today.format('MM')}-${d}`,
active: false
})
}
if (today.format('yyyy-MM') != this.data.stop) {
for (let i = lastNumber; i > lastNumber - week; i--) {
let item = [{
value: i,
date: `${last.format('yyyy')}-${last.format('MM')}-${i}`,
active: false,
opacity: true
}]
arr = item.concat(arr)
}
}
let length = arr.length
let sum = 42
if (length < 35) sum = 35
for (let i = 1; i <= sum - length; i++) {
let d = i
if (d < 10) d = '0' + d
arr.push({
value: i,
date: `${next.format('yyyy')}-${next.format('MM')}-${d}`,
active: false,
opacity: true
})
}
if (this.data.cookie !== null) {
let cookie = this.data.cookie
arr.forEach((e, index) => {
if (e.date == cookie.format('yyyy-MM-dd')) {
arr[index].active = true
}
})
}
if (this.data.cookie === null) {
arr.forEach((e, index) => {
if (e.date == this.data.date) {
arr[index].active = true
}
})
}
const res = new Map()
let dateList = this.data.dateList
dateList = dateList.filter(a => !res.has(a) && res.set(a, 1))
arr.forEach((e, index) => {
dateList.forEach(i => {
if (e.date == i) arr[index].have = true
})
})
if (today.format('yyyy-MM') == new Date().format('yyyy-MM')) {
arr.forEach((e, index) => {
if (e.date > new Date().format('yyyy-MM-dd')) arr.splice(index, arr.length)
})
}
return arr
}
}
})
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
<view class='picker' catchtouchmove='noScroll' wx:if='{{show}}'>
<view class='bg' bindtap='close'></view>
<view class='box {{up?"show":""}}'>
<view class='title'>
{{day}}
<view class='left' bindtap='left'>
<view class='arrow'></view>
</view>
<view class='right' bindtap='right' wx:if='{{showRight}}'>
<view class='arrow'></view>
</view>
</view>
<view class='time'>
<view wx:for='{{time}}' wx:key='*this' class='day {{item.active?"active":""}} {{item.opacity?"opacity":""}}' bindtap='chooseDay' data-index='{{index}}' data-date='{{item.date}}' style='height:{{height}}rpx'>
<view style='line-height:{{height*0.67}}rpx' class='{{item.have?"have":""}}'>{{item.value}}</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
/* components/datePicker/datePicker.wxss */
.picker{
width: 100vw;
height: 100vh;
z-index: 9999;
position: fixed;
top: 0;
left: 0;
}
.bg{
width: 100vw;
height: 100vh;
z-index: 9999;
position: absolute;
left: 0;
top: 0;
background: rgba(0, 0, 0, 0.5);
}
.box{
width: 100%;
position: absolute;
bottom: -50%;
left: 0;
background: #fff;
z-index: 10000;
}
.show{
bottom: 0;
transition: all 0.35s;
}
.title{
height: 100rpx;
position: relative;
width: 100%;
text-align: center;
line-height: 100rpx;
font-size: 36rpx;
color: #333333;
border-bottom: 2rpx solid #eee;
box-sizing: border-box;
}
.left,.right{
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100rpx;
height: 100rpx;
}
.left .arrow,.right .arrow{
width: 24rpx;
height: 24rpx;
border: 3rpx solid transparent;
position: absolute;
top: 40%;
left: 25%;
}
.left{
left: 0;
}
.left .arrow{
border-left-color: #999;
border-bottom-color: #999;
transform: rotate(45deg);
left: 50%;
}
.right{
right: 0;
}
.right .arrow{
border-bottom-color: #999;
border-right-color: #999;
transform: rotate(-45deg);
}
.time{
box-sizing: border-box;
width: 100%;
height: auto;
}
.day{
display: inline-block;
width: calc(100% / 7);
text-align: center;
font-size: 36rpx;
color: #212B35;
position: relative;
}
.day view{
width: 56%;
height: 67%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.opacity{
color: #C4CDD5;
}
.active view{
color: #fff;
background: #2F8EF0;
border-radius: 4rpx;
}
.have{
position: relative;
}
.have::after{
content: '';
position: absolute;
width: 12rpx;
height: 12rpx;
background: red;
border-radius: 100%;
top: -10rpx;
right: -10rpx;
z-index: 999;
}
\ No newline at end of file
// components/dropdown/dropdown.js
const app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Object,
observer(newVal, oldVal) {
if (newVal) {
this.setData({
width: `${100 / newVal.length}%`
})
}
}
},
hideDropdown:{
type:Boolean,
observer(newVal, oldVal) {
this.setData({
parentCount: null
})
}
},
leave:{
type: Boolean,
observer(newVal, oldVal) {
this.setData({
parentCount: null
})
}
},
clear:{
type:Boolean,
observer(newVal, oldVal) {
this.setData({
value: [],
count:[]
})
}
},
titleValue:{
type:Array,
value:[],
observer(newVal, oldVal) {
if(newVal) {
this.setData({
value: newVal,
})
let list = this.properties.list
if (list[0].type == 'time' && newVal[0]) {
this.setData({
time: newVal[0],
})
}
}
}
}
},
/**
* 组件的初始数据
*/
data: {
width: null,
count: null,
btnFixed:0,
value: [],
parentCount: null,
childCount: null,
searchValue: '',
startDate: '',
endDate: '',
today: '',
dateData: null,
time: null,
_time_:null,
hideMore:true,
productIndex:null,
statusIndex:null,
salesmanIndex:null,
hideSearch:false,
dropdownName:"",
type: null
},
/**
* 组件的方法列表
*/
methods: {
/**
* 禁止滑动
*/
noScroll() {},
showDropdown(e) {
let index = e.currentTarget.dataset.parentIndex
let targetName = e.currentTarget.dataset.targetName
this.setData({
dropdownName:targetName,
[targetName]: this.data[targetName] == index ? null : index,
})
if (this.data.parentCount == null) this.triggerEvent('close')
},
close(e) {
this.showDropdown(e)
this.triggerEvent('close')
},
choose(e) {
let value = e.currentTarget.dataset.value
let parentIndex = e.currentTarget.dataset.parentIndex
let name = e.currentTarget.dataset.name
this.setData({
[`count[${parentIndex}]`]: value,
[`value[${parentIndex}]`]: name
})
this.showDropdown(e)
this.triggerEvent('choose', {
parentIndex: parentIndex,
value: value,
name:name,
titleValue: this.data.value
})
},
focus() {
this.setData({
hideSearch:true
})
},
blur() {
this.setData({
hideSearch: false
})
},
input(e) {
let value = e.detail.value
this.setData({
searchValue: value
})
},
confirm(e) {
let value = e.currentTarget.dataset.type ? '' : e.detail.value
this.setData({
searchValue: value
})
let data={
value:value,
index:this.data[this.data.dropdownName]
}
this.triggerEvent('search',data)
},
radio(e) {
let value = e.currentTarget.dataset.value
let name = e.currentTarget.dataset.name
this.setData({
dateData: name,
startDate: null,
endDate: null
})
},
pickerChange(e) {
let date = e.detail.value
let target = `${e.currentTarget.dataset.target}Date`
this.setData({
[target]: date
})
this.setData({
dateData: `${this.data.startDate}—${this.data.endDate}`,
})
},
clearTime() {
this.setData({
dateData: null,
startDate: null,
endDate: null,
})
},
clearData(){
this.setData({
salesmanIndex: null,
statusIndex: null,
productIndex: null,
})
},
submit(e) {
let value = this.data.dateData
let parentIndex = e.currentTarget.dataset.parentIndex
if(value) {
this.setData({
[`value[${parentIndex}]`]: value.length > 5 ? `${value.substring(0, 10)}...` : value
})
} else{
this.setData({
value: null
})
}
this.showDropdown(e)
this.properties.list[parentIndex].data.forEach(el =>{
if(el.name == value) value = el.value
})
this.triggerEvent('choose', {
parentIndex: parentIndex,
value: value,
titleValue: this.data.value
})
},
chooseTime(e) {
let date = e.detail.value
let arr = date ? date.split('-') : []
let parentIndex = e.currentTarget.dataset.parentIndex
if(date) {
this.setData({
time: `${arr[0]}${arr[1]}`,
_time_: date
})
}
this.showDropdown(e)
console.log(date)
let val = this.data.value
val[0] = this.data.time
this.triggerEvent('choose', {
parentIndex: parentIndex,
value: this.data.time,
titleValue: val,
time2:date
})
},
cancel(e) {
this.showDropdown(e)
},
showMore() {
this.setData({
hideMore: !this.data.hideMore
})
},
chooseMore(e) {
let target = e.currentTarget.dataset.target
let value = e.currentTarget.dataset.value
this.setData({
[target]:value
})
},
sumbitMore(e){
let parentIndex = e.currentTarget.dataset.parentIndex
this.showDropdown(e)
this.triggerEvent('choose', {
parentIndex: parentIndex,
value: {
status: this.data.statusIndex,
product: this.data.productIndex,
salesman: this.data.salesmanIndex
},
titleValue: this.data.value
})
}
},
ready() {
let now = new Date()
this.setData({
today: now.format('yyyy-MM-dd'),
time: !this.data.time ? now.format('yyyyMM') : this.data.time,
_time_: !this.data._time_ ? now.format('yyyy-MM') : this.data._time_,
type: app.globalData.type
})
},
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='dropdown'>
<view class='dropdown-box' style="width:{{width}}" wx:for='{{list}}' wx:key='index'>
<picker bindchange="chooseTime" bindcancel='cancel' wx:if='{{item.type == "time"}}' mode='date' fields='month' start="2020-01-01" end="{{today}}" value='{{_time_}}' data-target-name='parentCount' data-parent-index='{{index}}'>
<view class="dropdown-title {{index == parentCount?'dropdown-title-active':''}}" bindtap="showDropdown" data-parent-index='{{index}}' data-target-name='parentCount'>{{time ||item.title}}
<view class="dropdown-title-icon"></view>
</view>
</picker>
<view wx:else class="dropdown-title {{index == parentCount?'dropdown-title-active':''}}" bindtap="showDropdown" data-parent-index='{{index}}' data-target-name='parentCount'>{{value[index]||item.title}}
<view class="dropdown-title-icon"></view>
</view>
<view class="dropdown-bg-box" hidden="{{index != parentCount}}" style='left:-{{index*100 + (2.8*list.length)}}%' bind>
<view class="dropdown-bg" bindtap="close" data-parent-index='{{index}}' data-target-name='parentCount' catchtouchmove='noScroll'></view>
<view class="dropdown-list" style="padding-right:{{item.type =='more'?0:'40rpx'}}">
<view class="dropdown-item dropdown-search" wx:if='{{item.havaSearch}}'>
<view class="dropdown-input {{hideSearch?'w90':''}}">
<input bindfocus='focus' bindblur='blur' bindinput='input' value='{{searchValue}}' bindconfirm='confirm' confirm-type='search'></input>
<view class="search" wx:if='{{!searchValue}}'>
<image src="./images/search.png"></image>
<text>搜索</text>
</view>
<view class="clear" bindtap="confirm" data-type='clear'>
<image src="../../images/status-2.png" hidden="{{!searchValue}}"></image>
</view>
</view>
<view class='dropdown-cancel' bindtap="confirm" data-type='clear'>取消</view>
</view>
<block wx:if='{{item.type == "date"}}'>
<view class='dropdown-radio-group'>
<block wx:for='{{item.data}}' wx:for-index='ind' wx:for-item='i' wx:key='ind'>
<view class='dropdown-radio {{i.name == dateData ? "active":""}}' bindtap="radio" data-value='{{i.value}}' data-name='{{i.name}}'>{{i.name}}</view>
</block>
</view>
<view class='dropdown-picker-group'>
<picker class='dropdown-picker' data-target='start' bindchange="pickerChange" mode="date" value="{{startDate}}" start="2020-01-01" end="{{today}}">
<text style='color:{{startDate?"":"#999"}}'>{{startDate||'请选择'}}</text>
</picker>
<picker disabled='{{!startDate}}' data-target='end' class='dropdown-picker' bindchange="pickerChange" mode="date" value="{{endDate}}" start="{{startDate}}" end="{{today}}">
<text style='color:{{endDate?"":"#999"}}'>{{endDate||'请选择'}}</text>
</picker>
</view>
<view class="dropdown-btn-group">
<view class='dropdown-btn btn-default' bindtap="clearTime">重置</view>
<view class='dropdown-btn btn-primary' bindtap="submit" data-target-name='parentCount' data-parent-index='{{index}}'>确定</view>
</view>
</block>
<block wx:elif='{{item.type == "more"}}'>
<view class="dropdown-more-title">任务状态</view>
<view class='dropdown-more-group clearfix'>
<view class='dropdown-more-item {{statusIndex == i.value?"active":""}}' wx:for='{{item.status}}' wx:for-index='ind' wx:for-item='i' wx:key='ind' bindtap="chooseMore" data-target="statusIndex" data-value='{{i.value}}' data-variable='{{i.variable}}'>
{{i.name}}
</view>
</view>
<view class="dropdown-more-title">产品</view>
<view class='dropdown-more-group clearfix'>
<view class='dropdown-more-item {{productIndex == i.value?"active":""}}' wx:for='{{item.product}}' wx:for-index='ind' wx:for-item='i' wx:key='ind' bindtap="chooseMore" data-target="productIndex" data-value='{{i.value}}' data-variable='{{i.variable}}'>
{{i.name}}
</view>
</view>
<block wx:if='{{type == 2}}'>
<view class="dropdown-more-title">业务员
<view class='more-btn' bindtap="showMore" wx:if='{{item.salesman.length > 3}}'>更多
<view class="dropdown-title-icon"></view>
</view>
</view>
<view class='dropdown-more-group clearfix'>
<view class='dropdown-more-item {{salesmanIndex == i.value?"active":""}}' wx:for='{{item.salesman}}' wx:for-index='ind' wx:for-item='i' wx:key='ind' hidden='{{ind>2&&hideMore}}' bindtap="chooseMore" data-target="salesmanIndex" data-value='{{i.value}}'
data-variable='{{i.variable}}'>
{{i.name}}
</view>
</view>
</block>
<view class="dropdown-btn-group" style="margin-right: 0">
<view class='dropdown-btn btn-default' bindtap="clearData">重置</view>
<view class='dropdown-btn btn-primary' bindtap="sumbitMore" data-target-name='parentCount' data-parent-index='{{index}}'>确定</view>
</view>
</block>
<block wx:else>
<block wx:for='{{item.data}}' wx:for-index='ind' wx:for-item='i' wx:key='ind'>
<view class="dropdown-item" wx:if='{{!i.data}}' data-target-name='parentCount' bindtap="choose" data-value='{{i.value}}' data-parent-index='{{index}}' data-name='{{i.name}}'>
{{i.name}}
<image src="./images/choose.png" class="{{i.value === count[index] || (item.title == i.name && !count[index])?'active':''}}"></image>
</view>
<view class="dropdown-item {{ ind == childCount ?'dropdown-item-child':''}}" wx:else bindtap="showDropdown" data-parent-index='{{ind}}' data-target-name='childCount'>
<view class="dropdown-item-child-title">
{{i.name}}
<view class="dropdown-item-arrow"></view>
</view>
<view hidden='{{ind != childCount}}' class="dropdown-item" wx:for='{{i.data}}' wx:for-index='childIndex' wx:for-item='x' wx:key='childIndex' bindtap="choose" data-target-name='parentCount' data-value='{{x.value}}' data-parent-index='{{index}}' data-name='{{x.name}}'>
{{x.name}}
<image src="./images/choose.png" class="{{x.value == count[index]?'active':''}}"></image>
</view>
</view>
</block>
</block>
</view>
</view>
</view>
</view>
\ No newline at end of file
/* components/dropdown/dropdown.wxss */
@import '../../style/common.wxss';
.dropdown {
width: 100%;
height: 84rpx;
line-height: 84rpx;
box-sizing: border-box;
padding: 0 20rpx;
}
.dropdown-box {
float: left;
position: relative;
}
.dropdown-title {
font-size: 32rpx;
color: #333;
text-align: center;
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
box-sizing: border-box;
font-weight: bold;
}
.dropdown-title-active {
color: #00a479;
}
.dropdown-title-active .dropdown-title-icon {
transform: rotate(180deg);
}
.dropdown-bg-box {
position: absolute;
top: 84rpx;
left: -40rpx;
width: 100vw;
height: 100vh;
overflow: hidden;
font-size: 24rpx;
}
.dropdown-bg {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.dropdown-list {
position: absolute;
left: 0;
top: -100%;
z-index: 2;
width: 100%;
max-height: 804rpx;
padding: 0 40rpx;
overflow-y: scroll;
box-sizing: border-box;
background-color: #fff;
animation: show 0.5s forwards;
}
@keyframes show {
from {
top: -100%;
}
to {
top: 0;
}
}
.dropdown-item {
position: relative;
height: 100rpx;
line-height: 100rpx;
box-sizing: border-box;
border-bottom: 2rpx solid rgba(233, 233, 233, 0.5);
overflow: hidden;
text-overflow: ellipsis;
box-sizing: border-box;
}
.dropdown-item:last-of-type {
border-bottom: none;
}
.dropdown-item>image {
position: absolute;
top: 50%;
right: 0;
width: 28rpx;
height: 28rpx;
transform: translateY(-50%);
display: none;
}
.dropdown-item .active {
display: block;
}
.dropdown-item-arrow {
position: absolute;
top: 50%;
right: 0;
transform: translateY(calc(-50% + 8rpx));
border-top: 8rpx solid #ccc;
border-right: 8rpx solid transparent;
border-bottom: 8rpx solid transparent;
border-left: 8rpx solid transparent;
transition: all 0.5s;
}
.dropdown-item-child {
height: auto;
}
.dropdown-item-child-title {
position: relative;
height: 100rpx;
line-height: 100rpx;
}
.dropdown-item-child-title~.dropdown-item{
margin-left: 40rpx;
color: #666;
}
.dropdown-item-child .dropdown-item-arrow {
transform: translateY(calc(-50%)) rotate(180deg);
}
.dropdown-item-child .dropdown-item:first-of-type{
margin-top: 40rpx;
}
.dropdown-search {
padding: 19rpx 0;
}
.dropdown-input {
position: relative;
float: left;
width: 100%;
height: 60rpx;
background-color: #f8f8f8;
}
.w90 {
width: 90%;
}
.dropdown-input .search {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 100%;
font-size: 24rpx;
color: #999;
line-height: 60rpx;
}
.dropdown-input .search image {
width: 32rpx;
height: 32rpx;
vertical-align: top;
transform: translateY(16rpx);
}
.dropdown-input .search text {
margin-left: 7rpx;
}
.dropdown-input input {
height: 100%;
width: 100%;
padding-left: 40rpx;
box-sizing: border-box;
}
.w90 .search {
display: none;
}
.w90 input {
width: calc(100% - 97rpx);
color: #333;
}
.w90 .clear {
position: absolute;
width: 57rpx;
height: 60rpx;
top: 0;
right: 0;
}
.w90 .clear .image {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 28rpx;
height: 28rpx;
}
.w90~.dropdown-cancel{
display: block;
}
.dropdown-cancel {
display: none;
float: left;
width: 10%;
height: 60rpx;
line-height: 60rpx;
font-size: 24rpx;
color: #666;
text-align: right;
}
.dropdown-radio-group {
display: flex;
flex-direction: row;
margin-bottom: 40rpx;
}
.dropdown-radio-group .active {
border-color: #00a479;
color: #00a479;
}
.dropdown-radio {
flex: 2.5;
height: 60rpx;
line-height: 60rpx;
margin-right: 40rpx;
text-align: center;
border: 1rpx solid #ccc;
border-radius: 4rpx;
font-size: 24rpx;
color: #333;
}
.dropdown-radio:last-of-type {
margin-right: 0;
}
.dropdown-picker-group {
margin-bottom: 60rpx;
position: relative;
height: 60rpx;
}
.dropdown-picker-group::after {
background: #979797;
width: 20rpx;
height: 2rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
content: '';
}
.dropdown-picker {
float: left;
border: 1rpx solid #ccc;
border-radius: 4rpx;
width: 312rpx;
height: 56rpx;
line-height: 56rpx;
font-size: 24rpx;
color: #333;
text-align: center;
}
.dropdown-picker:last-of-type {
float: right;
}
.dropdown-btn-group {
display: flex;
height: 94rpx;
line-height: 94rpx;
margin-left: -40rpx;
margin-right: -40rpx;
}
.dropdown-btn {
flex: 1;
box-sizing: border-box;
text-align: center;
font-size: 28rpx;
letter-spacing: 2rpx;
}
.btn-default {
color: #333;
border-top: 1rpx solid #ccc;
background: #fff;
}
.btn-primary {
color: #fff;
background: #00a479;
}
.dropdown-more-group{
font-size: 24rpx;
color: #333;
}
.dropdown-more-title {
font-size: 24rpx;
color: #333;
height: 30rpx;
line-height: 30rpx;
margin-bottom: 20rpx;
position: relative;
}
.dropdown-more-item {
float: left;
width: 192rpx;
height: 56rpx;
line-height: 56rpx;
border: 1rpx solid #ccc;
border-radius: 4rpx;
text-align: center;
margin: 0 40rpx 35rpx 0;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
.dropdown-more-group .active{
border-color: #00a479;
color: #00a479;
}
.more-btn{
float: right;
color: #666666;
margin-right: 40rpx;
}
.more-btn .dropdown-title-icon{
margin-left: 10rpx;
}
.fixed-bottom{
position: fixed;
left: 0;
width: 100%;
bottom: 0;
margin: 0;
}
.dropdown-title-icon {
display: inline-block;
vertical-align: middle;
width: 20rpx;
height: 20rpx;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAAH6ji2bAAAAAXNSR0IArs4c6QAAAO5JREFUOBFjYMAGMjIyYrGJA8XS0tK+45BCEmaGsUHKTU1NH505c+YSTIxEGuiYMhQtGAIosiRzgE5cj0sTUK4UQw45CEBuwRNaEL3p6ekhGKYMFQGgb91wuRUodwIuB+RMBAaFO1wAygD6/i+6GCgZoShGV8SIrAOkmImJadv///+3zZw5E564kNXA2UCTKuGcUQZ1QwAeLcBQ7gVGRxYwWgJmzJixkxhrQHkFqKcdqDYeGI1LQHrgBsIMAMU1kJ2Gz2CYQYyMjAlAyxfD9IJoDANhktgMxmcQTB9OA2EKoAZnAl3DjM1FMHUjmAYA6cpfiLblGTsAAAAASUVORK5CYII=) no-repeat;
background-size: cover;
transition: all 0.5s;
}
\ No newline at end of file
// components/orderList/orderList.js
const util = require('../../utils/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
errMsg: {
type: String
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='error-msg'>
{{errMsg}}
</view>
\ No newline at end of file
/* components/errorMsg/errorMsg.wxss */
@import '../../style/common.wxss';
.error-msg {
margin-top: 300rpx;
text-align: center;
color: #999;
}
\ No newline at end of file
// components/orderList/orderList.js
const util = require('../../utils/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
errorImg: {
type: String
},
errorText: {
type: String
},
btnText: {
type: String
},
serviceNumber: {
type: String
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
makePhoneCall() {
let { serviceNumber: phoneNumber } = this.properties;
if(phoneNumber) {
wx.makePhoneCall({
phoneNumber
})
}
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='error-msg flex-column'>
<image class="error-img" src="{{errorImg}}"></image>
<view class="error-text">{{errorText}}</view>
<button class="contact-btn boutique-commit-btn" v-if="{{btnText}}" bindtap="makePhoneCall">{{btnText}}</button>
</view>
\ No newline at end of file
/* components/errorMsg/errorMsg.wxss */
@import '../../style/common.wxss';
.error-msg {
align-items: center;
position: absolute;
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 90rpx 90rpx 0 90rpx;
font-size: 28rpx;
color: #333;
background-color: #fff;
}
.error-msg .error-img {
width: 200rpx;
height: 200rpx;
}
.error-msg .error-text {
margin-top: 56rpx;
}
.error-msg .contact-btn {
margin-top: 160rpx;
width: 320rpx;
}
\ No newline at end of file
// components/glTab/glTab.js
import util from '../../utils/util.js'
Component({
/**
* 组件的属性列表
*/
properties: {
tabList: {
type: Array,
value: []
},
activeColor:{
type:String,
value:'#05BAA0'
},
activeDotColor:{
type:String,
value:'#05BAA0'
}
},
/**
* 组件的初始数据
*/
data: {
tabIndex:0
},
/**
* 组件的方法列表
*/
methods: {
change(e) {
let {
index
} = e.currentTarget.dataset
this.setTab(index)
this.triggerEvent('change',index)
},
setTab(index = 0) {
let {
tabIndex,
activeDotColor
} = this.data
util.getViewInfo(`#tab-${tabIndex}`, old => {
let oldLeft = old.left
let oldWidth = old.width
util.getViewInfo(`#tab-${index}`, res => {
let {
left,
width
} = res
if (tabIndex != index) {
let readyLeft = oldLeft > left ? left : oldLeft
let readyWidth = oldLeft > left ? oldLeft - left : left - oldLeft
this.setData({
activeStyle: `width:${readyWidth - oldWidth / 2 + width / 2}px;background-color:${activeDotColor};border-radius:100%;left:${readyLeft + oldWidth / 2}px;transition: all .1s;`
})
}
setTimeout(() => {
this.setData({
activeStyle: `width:${width}px;left:${left}px;background-color:${activeDotColor};`,
tabIndex: index
})
}, 100)
},this)
},this)
},
},
ready(){
this.setTab()
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="tab" style="grid-template-columns:repeat({{tabList.length}},1fr)">
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item" style="color:{{tabIndex==index?activeColor:''}};" bindtap="change"
data-index="{{index}}">
<text class="tab-item-text" id="tab-{{index}}">{{item}}</text>
</view>
</block>
<view class="active-doc" style="{{activeStyle}}"></view>
</view>
\ No newline at end of file
/* components/glTab/glTab.wxss */
.tab {
position: sticky;
top: 0;
left: 0;
z-index: 2;
background-color: #fff;
height: 100rpx;
box-shadow: 0 2rpx 4rpx 2rpx #E9E9E9;
box-sizing: border-box;
display: grid;
align-items: center;
font-size: 32rpx;
color: #333333;
letter-spacing: 0.88rpx;
}
.active-doc{
position: absolute;
bottom: 5rpx;
height: 4rpx;
transition: all .25s;
}
.tab .tab-item{
text-align: center;
}
// components/glTextarea/glTextarea.js
import util from '../../utils/util'
Component({
/**
* 组件的属性列表
*/
properties: {
maxlength: {
type: Number,
value: -1
},
customMaxLength: Boolean,
placeholder: String,
showWordLimit: Boolean,
disabled: Boolean,
value: String,
filterEmoji: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
edit: true,
value: null
},
/**
* 组件的方法列表
*/
methods: {
/**
* 打开文本编辑器
*/
openTextarea() {
if (this.data.disabled) return
this.setData({
edit: false,
textareaFocus: true
})
},
setValue(value) {
let { customMaxLength, maxlength } = this.data
if (this.properties.filterEmoji) {
if (util.haveEmoji(value)) value = util.replaceEmoji(value)
}
if (customMaxLength && maxlength != -1) value = value.substring(0, maxlength)
this.setData({ value })
return value
},
textareaInput(e) {
let {
value
} = e.detail
value = this.setValue(value)
this.triggerEvent('input', {
value
})
},
textareaBlur(e) {
let {
value
} = e.detail
this.setData({
edit: true
})
value = this.setValue(value)
this.triggerEvent('blur', {
value
})
},
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='textarea-box {{maxlength>0&&showWordLimit?"showWordLimit":""}}'>
<block wx:if='{{edit}}'>
<text class='textarea' bindtap="openTextarea"
style="color:{{value?'#282829':'#B1B1B3'}}">{{value||placeholder||'请输入'}}</text>
</block>
<block wx:else>
<textarea class='_textarea_' maxlength="{{customMaxLength?-1:maxlength}}" value='{{value}}'
bindinput='textareaInput' focus='{{textareaFocus}}' bindblur='textareaBlur' bindconfirm='textareaBlur'></textarea>
</block>
<block wx:if='{{maxlength>0&&showWordLimit}}'>
<view class='wordLimit'>
{{value.length||0}} / {{maxlength}}
</view>
</block>
</view>
\ No newline at end of file
/* components/glTextarea/glTextarea.wxss */
.textarea-box {
width: 100%;
min-height: 120rpx;
position: relative;
height: 100%;
}
.textarea-box .textarea {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: scroll;
line-height: 32rpx;
word-break: break-all;
}
._textarea_ {
width: 100%;
height: calc(100% - 40rpx);
}
.textarea-box.showWordLimit .textarea {
height: calc(100% - 40rpx);
}
.wordLimit {
position: absolute;
bottom: 0;
right: 0;
color: #999;
}
// components/navigationBar/navigationBar.js
const util = require('../../../utils/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
labelProps: {
type: Object /** 设置标签的字体大小、颜色和背景色 */
},
title: {
type: String
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
},
ready() {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="label-wrapper">
<view class="label" style="background-color: {{ labelProps.bgColor }}; color: {{ labelProps.color }}; font-size: {{ labelProps.fontSize }};">
{{title}}
</view>
</view>
\ No newline at end of file
/* components/swiper/swiper.wxss */
.label-wrapper {
position: absolute;
right: 10rpx;
top: 0;
width: 150rpx;
height: 150rpx;
overflow: hidden;
}
.label-wrapper .label {
position: absolute;
right: 0;
top: 0;
z-Index: 2;
padding: 0 40rpx;
font-size: 20rpx;
line-height: 30rpx;
text-indent: 0;
transform-origin: left bottom;
-webkit-transform-origin: left bottom;
transform: translate(23.29%, -100%) rotate(35deg);
-webkit-transform: translate(23.29%, -100%) rotate(35deg);
color: #ffffff;
/* background-color: #ff6207; */
}
\ No newline at end of file
// components/orderList/orderList.js
const util = require('../../utils/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
tabData: {
type: Array
},
tabStyle: {
type: Object
}
},
/**
* 组件的初始数据
*/
data: {
curIndex: 0
},
/**
* 组件的方法列表
*/
methods: {
tap(e) {
let index = e.target.dataset.index;
this.setData({
curIndex: index
})
/** 传index到父组件 */
this.triggerEvent('tabinfo', {
tabIndex: index
});
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='left-nav-tab flex-column'>
<view class="tab-item {{index == curIndex ? 'active':''}}" wx:for='{{tabData}}' wx:key='index' data-index="{{index}}" bindtap='tap'>
{{item.title}}
</view>
</view>
\ No newline at end of file
/* components/leftNavTab/leftNavTab.wxss */
@import '../../style/common.wxss';
.left-nav-tab {
width: 200rpx;
height: 100%;
font-size: 24rpx;
background-color: #f4f4f4;
}
.left-nav-tab .tab-item {
width: 100%;
height: 96rpx;
line-height: 96rpx;
text-align: center;
}
.tab-item.active {
background-color: #fff;
}
// components/list/list.js
const util = require('../../utils/util.js')
const restapi = require('../../utils/restapi.js')
const app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Array
},
margin: {
type: Number,
value: 20
},
flag: {
type: Boolean,
value: false
},
authToast: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
tap(e) {
this.jump(e, this)
},
jump: util.throttle((e, _this) => {
if (!_this.properties.authToast) {
let index = e.currentTarget.dataset.index
let url = _this.properties.list[index].modulePath
let item = e.currentTarget.dataset.item
console.log(item)
let list = _this.properties.list
if (item.moduleName == '我的消息') {
list[index].redDot = false
wx.hideTabBarRedDot({
index: 1
})
}
if (item.moduleName == '隐私政策') {
var globalData = app.globalData.extConfig
restapi.getMerchantBussiness(globalData.merchantId, function (res) {
// console.log(res);
if (res.returnCode == '0') {
let path = `https://dj.glsx.com.cn/agreement/djUserPolicy.html?merchantName=${globalData.merchantName}&phone=${res.data.phone}`
wx.navigateTo({
url: `/pages/webpage/webpage?path=${encodeURIComponent(path)}`
})
}
}, function (res) {
console.log(res);
})
return true
}
if (item.moduleType == 'h5') {
let environment = {
'https://dj.test.glsx.com.cn': 'uat',
'https://dj.glsx.com.cn': 'prod'
}
let path = item.moduleH5Url[environment[restapi.domain]]
if(!path) path = 'https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/'
if(item.moduleParams) {
path = `${path}?${item.moduleParams}`
}
wx.navigateTo({
url: `/pages/webpage/webpage?path=${encodeURIComponent(path)}`
})
return
}
_this.setData({
list: list
})
wx.navigateTo({
url: url
})
} else {
wx.navigateTo({
url: '/pages/auth/index/index'
})
/*
wx.showToast({
title: '请登录查看',
icon: 'none'
})
*/
}
},
1000)
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='group' style='margin-top:{{margin}}rpx'>
<block wx:for='{{list}}' wx:key='*this' >
<block wx:if="{{item.tapsbutton}}">
<view class='arrow'>
<button open-type="{{item.tapsbutton}}" class="btn" bindtap="">{{item.moduleName}}</button>
<image src='{{item.moduleIcon}}'></image>
{{item.moduleName}}
<view class='red-dot' wx:if='{{item.redDot}}'></view>
<view class='tips' wx:if='{{item.moduleName == "开通微信服务" && !flag}}'>未开通</view>
<view class='tips' wx:if='{{item.moduleName == "开通微信服务" && flag}}'>已开通</view>
</view>
</block>
<block wx:else>
<view class='arrow' bindtap='tap' data-index='{{index}}' data-item='{{item}}'>
<image src='{{item.moduleIcon}}'></image>
{{item.moduleName}}
<view class='red-dot' wx:if='{{item.redDot}}'></view>
<view class='tips' wx:if='{{item.moduleName == "开通微信服务" && !flag}}'>未开通</view>
<view class='tips' wx:if='{{item.moduleName == "开通微信服务" && flag}}'>已开通</view>
</view>
</block>
</block>
</view>
\ No newline at end of file
/* components/list/list.wxss */
.group{
background: #fff;
}
.group>view{
height: 100rpx;
line-height: 100rpx;
font-size: 28rpx;
color: #333333;
border-bottom: 1rpx solid #f9f9f9;
position: relative;
display: flex;
align-items: center;
padding-left: 20rpx;
}
.group view image{
width: 40rpx;
height: 44rpx;
margin-right: 28rpx;
}
.red-dot{
display: inline-block;
width: 12rpx;
height: 12rpx;
background: #ff3a3a;
border-radius: 100%;
margin-left: 20rpx;
}
.arrow::after{
content: '';
width: 16rpx;
height: 16rpx;
position: absolute;
top: 50%;
right: 40rpx;
border-right: 2rpx solid #999999;
border-bottom: 2rpx solid #999999;
transform: translateY(-50%) rotate(-45deg);
}
.tips{
font-size: 20rpx;
color: #999;
position: absolute;
top: 50%;
right: 80rpx;
transform: translateY(-50%) ;
}
.btn{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
z-index: 99;
}
\ No newline at end of file
// components/loading/loading.js
Component({
/**
* 组件的属性列表
*/
properties: {
isListEmpty: {
type: Boolean,
value: true
},
isLoading: {
type: Boolean,
value: false
},
hasNext: {
type: Boolean,
value: false
},
pageIndex: {
type: Number,
value: 1
},
/**
* 加载中
*/
searchLoading: {
type: Boolean,
value: false
},
/**
* 已加载全部
*/
searchLoadingComplete: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
images/share.png

656 Bytes

This diff is collapsed. Click to expand it.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!