Authored by 陈峰

init

Showing 100 changed files with 3892 additions and 0 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

.DS_Store
.idea
.vscode
node_modules/
... ...
{
"wxpath": "/Applications/wechatwebdevtools.app/Contents/Resources/app.nw/bin",
"mode": "yoho"
}
\ No newline at end of file
... ...
微信小程序
=========
## 文档地址
https://mp.weixin.qq.com/debug/wxadoc/dev/api/?t=201715
## 开发工具
https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html?t=201715
... ...
//app.js
import promisify from './libs/promisify';
import objectAssign from './vendors/object-assign';
import {WeToast} from './vendors/toast/wetoast';
import { API_HOST, SERVICE_HOST, MINI_APP_TYPE} from './libs/config';
import {GET, POST} from './libs/request';
import {Encrypt,Decrypt} from './libs/aes.js';
let crypto = require('./libs/cryptojs/cryptojs.js').Crypto
import md5 from './vendors/md5';
var mta = require('./vendors/mta_analysis.js')
import { wechatLoginAction } from './utils/login';
import { isStringEmpty, getYHStorageSync} from './utils/util';
import './router/index';
import config from './config';
import event from './utils/event.js';
import { logEvent,
YB_LAUNCH_APP,
YB_EXIT_APP,
YB_ENTER_FOREGROUND,
YB_ENTER_BACKGROUND,
YB_PAGE_OPEN_L,
YB_AWAKE_MP,
YB_SERVICE_PUSH,
YB_WX_SCAN_CODE,
YB_SHARE_UNION_TYPE
} from './libs/analytics.js';
import { appReport } from './libs/appReport.js';
App({
onLaunch: function (options) {
let that = this;
let res = wx.getSystemInfoSync();
if (!res.screenHeight) {
res.screenHeight = res.windowHeight;
}
if (!res.screenWidth) {
res.screenWidth = res.windowWidth;
}
this.globalData.systemInfo = res;
this.checkUDID();
that.getSimplePise()
this.checkNetworkType()
if (options && options.scene){
this.globalData.ch = options.scene
}
if (options && options.query && options.query.union_type){
this.updateUnionType(options.query.union_type)
}
wx.checkSession({
success: function () {
//登录态未过期
that.getWechatThirdSession();
that.getUserInfo();
that.getUnionID();
that.getUser_union_type();
},
fail: function () {
//登录态过期
wx.setStorage({
key: "WXThird_session",
data: ''
});
wx.setStorage({
key: "userInfo",
data: {}
});
wx.setStorage({
key: "unionID",
data: ""
});
wx.setStorage({
key: "user_union_type",
data: ""
});
}
})
this.getSessionkey();
let timestamp = new Date().getTime() + ''
this.globalData.sid = md5(timestamp);
if (options){
let channel = options.query.channel;
let channelType = options.query.type;
let params = { 'CHANNEL': channel, 'TYPE': channelType };
logEvent(YB_LAUNCH_APP, params, this);
}
setTimeout(function () {
wechatLoginAction(function (response) {
that.getShareInfo();
});
}, 1000);
this.mtainit(options);
this.addListener();
},
addListener() {
event.on('anchor-click', params => { // anchor组件中点击时上报楼层点击事件
logEvent('YB_MAIN_EVENT', params);
});
},
//当应用程序进入前台显示状态时触发
onShow(options) {
let that = this
let params = {};
let shareParams = {};
let pathParam = ""
if (options && options.query) {
for (var Key in options.query) {
console.log("key:" + Key + "==value:" + options.query[Key]);
shareParams[Key] = options.query[Key];
if (pathParam.length == 0) {
pathParam = Key + '=' + options.query[Key] + '';
} else {
pathParam = pathParam + '&' + '' + Key + '=' + options.query[Key] + '';
}
}
}
logEvent(YB_SHARE_UNION_TYPE, shareParams, that)
let path = '';
if (options && options.path) {
path = options.path
}
if (pathParam !== "") {
path = path + "?" + pathParam
}
params = {
PAGE_PATH: path
};
logEvent(YB_ENTER_FOREGROUND, params, that)
// logEvent(YB_WX_SCAN_CODE, params, that);
if (that.globalData.hasReportAwakeAction==='false'){
logEvent(YB_AWAKE_MP, params, this);
that.globalData.hasReportAwakeAction = 'true'
}
if (options && options.scene){
appReport('start', "LIFECYCLE", "RESUME", {
'activeWay': options.scene + ""
}, this)
if (+options.scene === 1014 && options.query.msg_id) {
let param = {
MSG_ID: options.query.msg_id
}
logEvent(YB_SERVICE_PUSH, param,that);
}
}else{
appReport('start', "LIFECYCLE", "RESUME", {}, this)
}
let scene = options ? options.scene : '';
this.globalData.currentScene = scene;
this.showYOHOIconCount = 0;
},
//当应用程序进入后台状态时触发
onHide () {
let params = {};
logEvent(YB_ENTER_BACKGROUND,params)
appReport('start', "LIFECYCLE", "STOP", {},this)
},
getUserInfo: function () {
var value = getYHStorageSync('userInfo','app')
if (value) {
this.globalData.userInfo = value;
}
return value;
},
getMobile: function() {
return this.globalData.userInfo.mobile;
},
getUser_union_type: function () {
this.getUnionTypeWithUid(this.getUid());
},
/*
*union_type表示渠道号,在推广阶段通过商品详情页等传入。
* 接收到该参数时,赋值给全局变量时,持久化到本地。
* 在取值时,先从全局变量获取,若未获取到则从本地缓存中获取。
* 时效7天
*/
getUnion_type: function () {
try {
var value = this.checkUnion_type(this.globalData.union_type, this.globalData.union_type_time);
if (!value) {
let union_type = getYHStorageSync('union_type', 'app') ? getYHStorageSync('union_type', 'app'):"";
let union_type_time = getYHStorageSync('union_type_time', 'app') ? getYHStorageSync('union_type_time', 'app'):"";
value = this.checkUnion_type(union_type, union_type_time);
}
return value
} catch (e) {
// console.log(e)
}
},
checkUnion_type: function (union_type, union_type_time) {
if (!union_type)return '';
let time_old = union_type_time;
let time_new = new Date().getTime() + '';
var dayDiff = parseInt ((parseInt(time_new) - parseInt(time_old)) / 1000 );
if (dayDiff > 7 * 24 * 3600) {
return '';
}
return union_type;
},
getUnionID: function () {
var value = getYHStorageSync('unionID','app')
if (value) {
this.globalData.WXUnion_ID = value;
}
},
getWechatThirdSession: function () {
try {
var that = this
var value = this.globalData.WXThird_session
if (!isStringEmpty(value)) {
that.globalData.WXThird_session = value;
}else{
value = getYHStorageSync('WXThird_session','app')
}
return value
} catch (e) {
// console.log(e)
}
},
setUserInfo: function (cb) {
this.globalData.userInfo = objectAssign(this.globalData.userInfo, cb);
wx.setStorage({
key: "userInfo",
data: this.globalData.userInfo
})
if (this.globalData.userInfo.uid) {
this.getUnionTypeWithUid(this.globalData.userInfo.uid);
}
},
setSessionkey: function (sessionkey) {
this.globalData.sessionkey = sessionkey;
wx.setStorage({
key: "sessionkey",
data: this.globalData.sessionkey
})
},
setWechatThirdSession: function (session) {
this.globalData.WXThird_session = session;
wx.setStorage({
key: "WXThird_session",
data: this.globalData.WXThird_session
})
},
setWXUnionID: function (unionID) {
this.globalData.WXUnion_ID = unionID;
wx.setStorage({
key: "unionID",
data: unionID
})
},
setOpenID:function(openID){
if(openID=='') return
this.globalData.openID = openID;
wx.setStorage({
key: "openID",
data: openID
})
},
getOpenID: function () {
let openid = ''
if (!isStringEmpty(this.globalData.openID)){
openid = this.globalData.openID
}else{
openid = getYHStorageSync('openID','app')
this.globalData.openID = openid
}
return openid
},
updateUid: function (uid) {
this.getUserInfo();
this.globalData.userInfo.uid = uid;
wx.setStorage({
key: "userInfo",
data: this.globalData.userInfo
})
this.getUnionTypeWithUid(uid);
},
showYOHOIconCount: 0,
globalData: {
selectedChannel: 'boy',
userInfo: {},
systemInfo: null,
WXThird_session: '',
WXUnion_ID: '',
openID:'',
p2SecretKey: '',
sessionkey: '',
sid: '',
udid:'',
cid:'1',
mobileRegisterState:'',
hasReportAwakeAction: 'false',
defraudurl:'https://activity.yoho.cn/feature/45.html?title=防诈骗提醒',
miniapp_type: MINI_APP_TYPE,
union_type:'',//渠道号,大数据上传用
union_type_time: '',
ch:'',
networkType:'0',
deviceInfo:{},
currentScene: 1001,
user_union_type: '',//用户相关unionType 要与union_type区分开
user_union_type_imageUrl: '',//联盟图片
user_nounion_type_imageUrl:'',//非联盟用户分享banner图片
shareId: '',
shareInfo: {},
},
isLogin: function () {
return this.globalData.userInfo.uid > 0 ? true : false
},
getUid: function () {
let uid = this.globalData.userInfo.uid
if(!uid||uid===0){
this.getUserInfo();
uid = this.globalData.userInfo.uid
}
return uid;
},
getMiniappType:function(){
return MINI_APP_TYPE
},
//获取加签的秘钥
getSimplePise: function () {
let that = this
let data = {
"udid": that.globalData.udid,
"method": 'resources.simple.pice'}
let method = "GET"
let header = {
'Content-Type': 'application/x-www-form-urlencoded'
}
wx.request({
url:API_HOST,
data,
method,
header: header,
success: function (res) {
// console.log("res:", res)
if (res && res.data && res.data.data && res.data.data.sk){
that.globalData.p2SecretKey = res.data.data.sk;
wx.setStorage({
key: "p2SecretKey",
data: res.data.data.sk
});
}
},
fail: function (err) {
// console.log("err:",err)
}
});
},
/*
获取用户相关union_type
*/
getUnionTypeWithUid: function (uid) {
let param = {
method: 'app.union.shareOrder.queryUnionTypeByUid',
uid,
}
let that = this;
GET(API_HOST, param)
.then(data => {
if (data.code == 200) {
that.globalData.user_union_type = data.data.unionType;
that.globalData.user_union_type_imageUrl = data.data.imageUrl;
that.globalData.shareId = data.data.shareId;
that.globalData.user_nounion_type_imageUrl = data.data.applyImageUrl;
that.getShareInfo();
}
})
.catch(error => {
// console.log(error)
});
},
/*
获取分享信息
*/
getShareInfo: function () {
// console.log('getShareInfo');
let param = {
share_id: this.globalData.shareId,
}
let that = this;
GET(API_HOST + '/operations/api/v5/webshare/getShare', param)
.then(data => {
console.log(data)
if (data && data.code == 200) {
that.globalData.shareInfo = data.data;
}
})
.catch(error => {
// console.log(error)
});
},
fastloginSwitch: function () {
let that = this
let param = {
method: 'app.passport.fastloginSwitch',
};
GET(API_HOST, param)
.then(json => {
// if (!json || !json.code || json.code != 200 || !json.data) return;
// if (!json.data || !json.data.sk) return;
// let p2SecretKey = json.data.sk;
// if (!p2SecretKey) return;
// that.globalData.p2SecretKey = p2SecretKey;
// wx.setStorage({
// key: "p2SecretKey",
// data: p2SecretKey
// });
})
.catch(error => {
});
},
checkUDID:function(){
let that = this
try {
var value = getYHStorageSync('udid','app')
if (value) {
that.globalData.udid = value;
}else{
let udidValue = md5(that.getUUID());
that.globalData.udid = udidValue;
try {
wx.setStorageSync('udid', udidValue)
} catch (e) {
}
}
//获取签名秘钥
} catch (e) {
// Do something when catch error
// console.log("checkUDID error: " + e)
}
},
checkNetworkType:function(){
let that = this;
let net = '';
wx.getNetworkType({
success: function (res) {
// 返回网络类型, 有效值:
// wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
var networkType = res.networkType
if (networkType === 'wifi') {
net = '1';
} else if (networkType === '2g') {
net = '2';
} else if (networkType === '3g') {
net = '3';
} else if (networkType === '4g') {
net = '4';
} else {
net = '0';
}
// console.log("network:",net)
},
complete:function(res){
appReport('start', "LIFECYCLE", "START", {}, that)
}
})
that.globalData.networkType = net;
},
getUUID: function () {
let value = "" + Date.now() + '-' + Math.floor(1e7 * Math.random()) + '-' + Math.random().toString(16).replace('.', '') + '-' + String(Math.random() * 31242).replace('.', '').slice(0, 8);
return value;
},
loginCallBack: function (response) {
// console.log(response)
// if (response.code === 10001) {
// this.showRelaunchModal();
// }
},
showRelaunchModal: function () {
wx.showModal({
title: '提示',
content: '使用微信小程序需要微信授权,您已经拒绝了该请求,请删除小程序重新进入。',
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.navigateBack({
delta: 1
})
}
}
})
},
getSessionkey: function () {
if (this.isLogin) {
var value = getYHStorageSync('sessionkey','app')
if (value) {
// console.log(value)
this.globalData.sessionkey = value;
}
}
return undefined;
},
//更新渠道号同时更新时间戳,48小时失效
updateUnionType: function (union_type) {
if (union_type){
let timeS = new Date().getTime() + '';
this.globalData.union_type = union_type;
this.globalData.union_type_time = timeS;
wx.setStorage({
key: "union_type_time",
data: timeS,
});
wx.setStorage({
key: "union_type",
data: union_type
});
}
},
getPvid() {
return md5(`${new Date().getTime()}${this.getUUID()}`).toString();
},
getAppId() {
return config.appid;
},
mtainit(e) {
mta.App.init({
"appID": "500570715",
"eventID": "500570797",
});
// console.log("init mta");
},
WeToast
})
... ...
{
"pages": [
"pages/index/index",
"pages/userCenter/userCenter",
"pages/addressManager/addressManager",
"pages/addressManager/addressEditer/addressEditer",
"pages/orders/orders",
"pages/orders/orderDetail/orderDetail",
"pages/orders/visualOrderDetail/visualOrderDetail",
"pages/search/search",
"pages/goodsList/goodsList",
"pages/goodsList/newArrival",
"pages/goodsList/brand",
"pages/goodsList/PromotionList",
"pages/goodsList/productPool",
"pages/goodsList/alphabetBrandList",
"pages/goodsList/categoryList",
"pages/goodsList/sizesList",
"pages/goodsDetail/goodsDetail",
"pages/statements/statements",
"pages/visualstatements/visualstatements",
"pages/paymentSuccessed/paymentSuccessed",
"pages/classify/category",
"pages/goodsList/activtyDetail",
"pages/activity/activityList",
"pages/shopCart/shopCart",
"pages/shopCart/giftPage",
"pages/orders/defraudtip/defraudtip",
"pages/userCenter/service/service",
"pages/invoice/invoice",
"pages/logisticsDetails/logisticsDetails",
"pages/bindPhoneNumber/bindPhoneNumber",
"pages/envelopesActivity/envelopesActivity",
"pages/orders/groupOrders",
"pages/goodsList/brandStore",
"pages/webview/webview",
"pages/goodsList/ProductListFilterPage",
"pages/assist/assist",
"pages/classify/brands",
"pages/common/webback",
"pages/groupPurchase/groupPurchase",
"pages/groupPurchase/groupPurchaseDetail",
"pages/groupPurchase/groupPurchaseResult",
"pages/groupPurchase/h5Page",
"pages/groupPurchase/groupPurchaseHome"
],
"window": {
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#3a3a3a",
"backgroundColor": "#fff",
"backgroundTextStyle": "dark",
"onReachBottomDistance": 100
},
"tabBar": {
"borderStyle": "black",
"color": "#b0b0b0",
"selectedColor": "#444444",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "images/nav_home_n@2x.png",
"selectedIconPath": "images/nav_home_h@2x.png"
},
{
"pagePath": "pages/classify/category",
"text": "分类",
"iconPath": "images/X_pl_ic_n@3x.png",
"selectedIconPath": "images/X_pl_ic_h@3x.png"
},
{
"pagePath": "pages/shopCart/shopCart",
"text": "购物车",
"iconPath": "images/shopcart_empty@2x.png",
"selectedIconPath": "images/shoppingcart@2x.png"
},
{
"pagePath": "pages/userCenter/userCenter",
"text": "我的",
"iconPath": "images/nav_mine_n@2x.png",
"selectedIconPath": "images/nav_mine_h@2x.png"
}
]
},
"subPackages": [
{
"root": "page/subPackage/",
"pages": [
"pages/couponList/couponList",
"pages/useCoupons/useCoupons",
"pages/unionShare/unionShare",
"pages/limit/limit",
"pages/limit/limitIntroduce",
"pages/guang/typeList",
"pages/guang/tags",
"pages/guang/author",
"pages/guang/detail",
"pages/redEnvelope/redEnvelope",
"pages/zeroSell/index",
"pages/zeroSell/detail",
"pages/zeroSell/myList",
"pages/zeroSell/snapshootShare",
"pages/allowance/allowance",
"pages/allowance/allowanceList",
"pages/allowance/h5page",
"pages/afterSale/afterSale",
"pages/refundOrderProgress/refundOrderProgress",
"pages/refundGoods/refundGoods",
"pages/productReturn/productReturn",
"pages/selectPostCompany/selectPostCompany"
]
},
{
"root": "pagesSecond/",
"pages": [
"pages/antifraud/antifraud",
"pages/inviteFriend/inviteFriend",
"pages/evaluateList/evaluateList",
"pages/goodsCollect/goodsCollect",
"pages/choosecountry/choosecountry"
]
}
],
"navigateToMiniProgramAppIdList": [
"wxed31f9e8705fb8d1",
"wx207f18be42db9028",
"wx7678b61d1e6702fe"
]
}
\ No newline at end of file
... ...
/**app.wxss**/
/*.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
} */
.clearfix:after {
content: '';
display: block;
clear: both;
}
@import "./vendors/toast/wetoast.wxss";
@import "./vendors/zanui/index.wxss";
\ No newline at end of file
... ...
import event from '../../utils/event';
// const router = global.router;
Component({
properties: {
floorData: {
type: Object,
observer: '_dataChange'
},
floorIdx: {
type: Number
}
},
data: {},
attached() {
},
methods: {
checkDetail({currentTarget}) {
const {productSkn, activityId} = currentTarget.dataset;
const {
template_id,
template_name,
} = this.data.floorData;
let reportParams = {
F_ID: template_id || '0',
F_NAME: template_name || '',
F_URL: this.data.url || '',
F_INDEX: (this.data.floorIdx || 0) + 1 ,
I_INDEX: (this.data.itemIdx || 0) + 1
};
event.emit('anchor-click', reportParams);
if (productSkn && activityId) {
wx.navigateTo({
url: `../groupPurchase/groupPurchaseDetail?productSkn=${productSkn}&activityId=${activityId}`
});
// router.go('purchaseDetail', {activityId, productSkn});
}
}
}
});
... ...
{
"component": true,
"usingComponents": {
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<scroll-view wx:if="{{floorData.data.data.prdList && floorData.data.data.prdList.length}}"
class="resource-collage-buy-prd-list" scroll-x="true">
<block wx:for="{{floorData.data.data.prdList}}" wx:key="{{index}}" wx:for-item="item">
<view
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
class="product-item"
bindtap="checkDetail"
data-product-skn="{{item.productSkn}}"
data-activity-id="{{item.activityId}}">
<format-img src="{{item.defaultImages}}" width="188" height="250"></format-img>
<view class="product-name">{{item.brandName}}</view>
<view class='product-price-wrap'>
<text class='product-price'>{{item.formatCollagePrice}}</text>
<text class='product-market-price'>{{item.marketPrice}}</text>
</view>
<view class='product-joinnum'>{{item.collagedPersonNum}} 人已拼</view>
</view>
</block>
</scroll-view>
\ No newline at end of file
... ...
.resource-collage-buy-prd-list {
width: 100%;
height: 440rpx;
padding-top: 20rpx;
white-space: nowrap;
box-sizing: border-box;
}
.resource-collage-buy-prd-list .product-item {
display: inline-block;
margin-left: 30rpx;
font-size: 0;
width: 188rpx;
}
.resource-collage-buy-prd-list .product-item:last-child {
margin-right: 30rpx;
}
.resource-collage-buy-prd-list .product-name {
text-align: center;
font-size: 24rpx;
padding-bottom: 20rpx;
padding-top: 20rpx;
overflow: hidden;
text-overflow: ellipsis;
}
.resource-collage-buy-prd-list .product-price-wrap {
text-align: center;
}
.resource-collage-buy-prd-list .product-price {
font-family: PingFang-SC-Medium, sans-serif;
font-size: 24rpx;
color: #D0021B;
letter-spacing: 0;
font-weight: 500;
}
.resource-collage-buy-prd-list .product-market-price {
font-family: PingFang-SC-Medium, sans-serif;
font-size: 18rpx;
color: #B0B0B0;
letter-spacing: 0;
margin-left: 10rpx;
text-decoration: line-through;
}
.resource-collage-buy-prd-list .product-joinnum {
font-family: PingFang-SC-Medium, sans-serif;
font-size: 18rpx;
color: #B0B0B0;
letter-spacing: 0;
margin-top: 16rpx;
text-align: center;
}
\ No newline at end of file
... ...
import event from '../../../utils/event';
// const router = global.router;
import { jumpByUrl } from '../../../libs/urlRoute';
Component({
properties: {
url: {
type: String,
value: ''
},
hasUrl: {
type: Boolean,
value: true
},
isFloor: {
type: Number,
value: 0
},
floorData: Object,
floorIdx: Number,
itemIdx: Number,
},
methods: {
jumpTo: function() {
if (this.data.isFloor) {
const {
template_id,
template_name,
} = this.data.floorData;
let reportParams = {
F_ID: template_id || '0',
F_NAME: template_name || '',
F_URL: this.data.url || '',
F_INDEX: (this.data.floorIdx || 0) + 1 ,
I_INDEX: (this.data.itemIdx || 0) + 1
};
event.emit('anchor-click', reportParams);
}
// this.data.url && router.goUrl(this.data.url);
if(this.data.hasUrl) {
this.data.url && jumpByUrl(this.data.url, 'home');
} else {
wx.navigateTo({
url: this.data.url
});
}
}
}
});
... ...
{
"component": true
}
... ...
<view class="anchor" bindtap="jumpTo">
<slot></slot>
</view>
... ...
Component({
properties: {
src: {
type: String,
observer: '_dataChange'
},
width: Number,
height: Number,
isExtend: String,
mode: {
type: Number,
value: 2
},
imageMode: {
type: String,
value: 'widthFix'
},
defaultWidth: { // 宽度100%
type: Boolean,
value: false
}
},
data: {
style: ''
},
methods: {
_dataChange() {
let width = `${this.data.width ? `${(+this.data.width > 750 ? 750 : +this.data.width)}rpx; ` : '100%;'}`;
let realHeight = this.data.realHeight;
// 图片宽度100%
this.data.defaultWidth && (width = '100%; ');
if (this.data.width && this.data.height) {
this.data.src = this.formatImageUrl(this.data.src, this.data.width, this.data.height, this.data.mode);
}
this.setData({
src: this.data.src,
style: `width: ${width}`
});
},
formatImageUrl(url, width, height, mode) {
url = url || '';
if(url && url.indexOf('?') === -1) {
url += '?imageView2/{mode}/w/{width}/h/{height}';
}
return url.replace(/{width}/g, width).replace(/{height}/g, height).replace('{mode}', mode || 2);
}
}
});
... ...
{
"component": true
}
\ No newline at end of file
... ...
<image src="{{src}}" style="{{style}}" mode="{{imageMode}}"></image>
\ No newline at end of file
... ...
.swiper-status-1{
width: 750rpx;
height:562rpx;
/* margin-bottom: -6rpx; */
}
.swiper-status-1 .wx-swiper-dots.wx-swiper-dots-horizontal{
margin-bottom: -8rpx;
padding-left: 15rpx;
padding-right: 10rpx;
padding-top: 5rpx;
padding-bottom: 5rpx;
border-radius: 40rpx;
background: rgba(0,0,0,0.2);
}
.swiper-status-1 .wx-swiper-dot{
width:10rpx;
display: inline-flex;
height: 10rpx;
margin-left: -5rpx;
justify-content:space-between;
}
.new-focus-img-1{
width: 100%;
height: 100%;
}
.catgoryContainer-1 {
display: flex;
flex-direction: row;
flex-wrap: wrap;
background-color: white;
border-top: 1rpx solid #ddd;
/* margin-bottom: -6rpx; */
/*border-bottom: 1rpx solid #dddddd;*/
}
.category-1 {
display: flex;
flex-direction: column;
align-items: center;
border-bottom: 1rpx solid #ddd;
}
.categoryImage-1 {
width: 100%;
}
/* .brandContainer-1 {
background-color: white;
height: 236rpx;
white-space: nowrap;
}
.brandItem-1 {
display: inline-block;
height: 236rpx;
width: 203rpx;
margin-right: 16rpx;
align-items: center;
}
.brand-1 {
white-space: wrap;
height: 220rpx;
width: 220rpx;
}
.brandImage-1 {
width: 203rpx;
height: 220rpx;
border-radius: 10rpx;
} */
.activity-container-header-1 {
width: 100%;
height: 324rpx;
}
.singleImg-1{
width: 100%;
height: 100%;
}
.singleImgContainer{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
.fourImageContainer {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
.fourImage-1 {
width: 20%;
height: 20vw;
margin-left: 4%;
margin-top: 4%;
margin-bottom: 4%;
border-radius: 4px;
position: relative;
}
.twoImageContainer{
width: 690rpx;
/* height: 200rpx; */
margin-left: 30rpx;
margin-right:30rpx;
display: flex;
flex-direction: row;
align-items: center;
}
.fourImage-text-container {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
}
.fourImage-text {
font-family: PingFang-SC-Medium;
font-size: 14px;
color: #fff;
}
.activity-container-footer-1 {
white-space: nowrap;
/* height: wrap; */
}
.group-product-item{
width: 188rpx;
height: wrap;
display: inline-block;
margin-left: 30rpx;
padding-bottom: 20rpx;
padding-top: 20rpx;
/* flex-direction: column;
align-items: center; */
}
.group-product-image{
width: 100%;
height: 250rpx;
}
.group-product-name{
font-family: PingFang-SC-Medium;
font-size: 24rpx;
color: #444;
letter-spacing: 0;
text-align: center;
margin-top: 16rpx;
font-weight: bold;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
width: 100%
}
.group-product-price-container{
widows: wrap;
height: 28rpx;
display: flex;
/* flex-direction: row; */
align-items: center;
justify-content: center;
margin-top: 16rpx;
}
.group-product-price{
font-family: PingFang-SC-Medium;
font-size: 24rpx;
color: #d0021b;
letter-spacing: 0;
font-weight: bold
}
.group-product-market-price{
font-family: PingFang-SC-Medium;
font-size: 18rpx;
color: #b0b0b0;
letter-spacing: 0;
margin-left: 10rpx;
text-decoration: line-through
}
.group-product-joinnum{
font-family: PingFang-SC-Medium;
font-size: 9px;
color: #b0b0b0;
letter-spacing: 0;
margin-top: 16rpx;
text-align: center;
width: 100%;
}
.activity-item-1 {
width: 186rpx;
height: 296rpx;
display: inline-block;
margin-top: 30rpx;
margin-left: 32rpx;
}
.activity-item-img-1 {
width: 100%;
height: 77%;
}
.activity-item-price-1 {
width: 100%;
height: 23%;
text-align: center;
line-height: 50rpx;
color: red;
font-size: 24rpx;
font-family: PingFang SC;
}
.horImgContainer{
height: 236rpx;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-end;
background-color: white;
}
.horImgScrollView{
height: 220rpx;
white-space: nowrap;
}
.hor-Item{
display: inline-block;
height: 220rpx;
width: 203rpx;
margin-right: 16rpx;
align-items: center;
}
.hor-itemImage {
width: 203rpx;
height: 220rpx;
border-radius: 10rpx;
}
.newCustomer {
max-height: 360rpx;
}
.newCustomer .pic-banner {
width: 750rpx;
height: 360rpx;
border-radius: 0;
background-size: cover;
}
.newCustomer .pic-banner::after {
display: none;
}
... ...
// component/depositProcess/depositProcess.js
Component({
/**
* 组件的属性列表
*/
properties: {
isShowLeft: {
type: Boolean,
value: true
},
isShowRight: {
type: Boolean,
value: true
},
processText: {
value: '代付定金',
type: String
},
processPrice: {
type: String,
value: ''
},
currentStyle: {
type: String,
value: '',
observer: function(newVal, oldVal) {
let imagePath = this.data.imagePath;
let textClass = this.data.textClass;
if (newVal === 'todo') {
imagePath = "http://img11.static.yhbimg.com/article/2018/10/16/17/0115f72145653f1d16adc4575f986bb9b4.png";
textClass = 'undo'
} else if (newVal === 'doing') {
imagePath = "http://img12.static.yhbimg.com/article/2018/10/16/17/02bd110959f50083b2f7b96eb2e723c05c.png";
}
this.setData({
imagePath,
textClass
})
}
}
},
/**
* 组件的初始数据
*/
data: {
imagePath: '../../pages/statements/images/address_Checked@2x.png',
textClass: ''
},
/**
* 组件的方法列表
*/
methods: {
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--component/depositProcess/depositProcess.wxml-->
<view class="deposit-process">
<view class="process">
<view class="process-line" style="background-color: {{isShowLeft ? '#e0e0e0': 'white'}}">
</view>
<view class="process-image-container">
<image class="process-image" src="{{imagePath}}"></image>
</view>
<view class="process-line" style="background-color: {{isShowRight ? '#e0e0e0': 'white'}}">
</view>
</view>
<view class="content">
<text class="process-text {{textClass}}">{{processText}}</text>
<text class="process-price {{currentStyle === 'doing' ? 'active' : textClass}}">{{processPrice}}</text>
</view>
</view>
... ...
/* component/depositProcess/depositProcess.wxss */
.deposit-process {
margin-top: 60rpx;
margin-bottom: 40rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: white;
}
.content {
display: flex;
flex-direction: column;
flex: 1;
}
.process {
display: flex;
flex-direction: row;
align-items: center;
}
.process-image-container {
display: flex;
}
.process-image {
width: 30rpx;
height: 30rpx;
margin-left: 20rpx;
margin-right: 20rpx;
}
.process-line {
background-color: #e0e0e0;
height: 2rpx;
width: 80rpx;
}
.process-text {
font-size: 24rpx;
margin-top: 10rpx;
text-align: center;
}
.process-price {
font-size: 24rpx;
margin-bottom: 10rpx;
text-align: center;
}
.active {
color: #D0021B;
}
.undo {
color: #e0e0e0;
}
... ...
Component({
properties: {
floorData: Object,
floorIdx: {
type: Number
}
},
methods: {
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="resource-four-image">
<block wx:for="{{floorData.data.list}}" wx:key="{{index}}">
<view class="img-item">
<anchor
is-floor="{{true}}"
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
url="{{item.url}}">
<format-img
width="400"
height="400"
default-width="{{true}}"
src="{{item.src}}"
>
</format-img>
</anchor>
</view>
</block>
</view>
... ...
.resource-four-image {
display: flex;
width: 750rpx;
padding: 20rpx 30rpx;
box-sizing: border-box;
font-size: 0;
}
.resource-four-image .img-item {
flex: 1;
}
\ No newline at end of file
... ...
import event from '../../../utils/event';
// const router = global.router;
import { jumpByUrl } from '../../../libs/urlRoute';
import { getYHStorageSync } from '../../../utils/util';
import { decodePhoneNumber } from '../../../utils/login';
Component({
properties: {
floorData: {
type: Object,
observer: '_dataChange'
},
newCustomer: {
type: Boolean
},
floorIdx: {
type: Number
}
},
data: {
newFloor: {}
},
methods: {
_dataChange(newValue) {
let data = newValue.data.banner_image
data.map((item,index) => {
item.src = item.src.split('?')[0]
})
console.log(data)
this.setData({
newFloor: data
})
},
// 获取storage
getStorage(key) {
return getYHStorageSync(key, 'index');
},
// 设置storage
setStorage(key, value) {
try {
wx.setStorageSync(key, value);
} catch (e) {
// console.error(e);
}
},
jumpByRule: function (e) {
let jumpUrl = e.currentTarget.dataset.jump_rule;
if (!jumpUrl) {
return;
}
let F_ID = e.currentTarget.dataset.f_id;//楼层id
let I_INDEX = e.currentTarget.dataset.f_inindex + 1//楼层内index
let F_INDEX = e.currentTarget.dataset.f_index + 1//楼层序号
let F_NAME = e.currentTarget.dataset.f_name;//楼层名称
let reportParams = {
F_ID, I_INDEX, F_INDEX, F_NAME,
F_URL: jumpUrl,
}
console.log(reportParams)
event.emit('anchor-click', reportParams);
jumpByUrl(jumpUrl, 'home');
},
getPhoneNumber(e) {
if (this.getStorage('newCustomer')) {
this.jumpByRule(e);
return;
}
if (e.detail.errMsg === 'getPhoneNumber:ok') {
decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', (result) => {
if (result.code === 200) { // 首次授权的新人
//新注册用户
if (result.is_register) {
that.showZanToast({
title: '欢迎加入Yoho!Family!新人礼包已发放到个人中心-优惠券,请注意查收', success: function () {
// 新人楼层标示newCustomer
this.setStorage('newCustomer', true);
this.jumpByRule(e);
}
}, 1500);
} else {
// 新人楼层标示newCustomer
this.setStorage('newCustomer', true);
this.jumpByRule(e);
}
} else { // 不是新人,提示
wx.showModal({
title: '提示',
content: '活动仅限新用户参加',
showCancel: false
});
}
})
} else { // 取消手机号授权
wx.navigateTo({
url: '../bindPhoneNumber/bindPhoneNumber',
})
}
},
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="new-customer-content">
<view class="newCustomer" wx:for="{{newFloor}}" wx:key="{{index}}">
<button wx:if="{{newCustomer}}" class="pic-banner" data-jump_rule="{{item.url}}" bindtap="getPhoneNumber" style="background-image: url({{item.src}})"></button>
<button wx:else class="pic-banner" data-jump_rule="{{item.url}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" style="background-image: url({{item.src}})"></button>
</view>
</view>
\ No newline at end of file
... ...
.newCustomer {
max-height: 360rpx;
}
.newCustomer .pic-banner {
width: 750rpx;
height: 360rpx;
border-radius: 0;
background-size: cover;
}
.newCustomer .pic-banner::after {
display: none;
}
... ...
Component({
properties: {
floorData: {
type: Object
},
isGroup: {
type: Boolean,
value: false
},
floorIdx: {
type: Number
},
reportClick: {
type: Boolean,
value: true
}
},
data: {
swiperCurrent: 0
},
methods: {
swiperChange: function (e) {
this.setData({
swiperCurrent: e.detail.current
});
}
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="resource-swiper" style="width: 100%;height: {{isGroup?'280':'562'}}rpx;">
<swiper
bindchange="swiperChange"
class='resource-swiper' indicator-dots='{{false}}' autoplay="true" interval="3500" circular='true'indicator-color='rgba(255,255,255,0.2)' indicator-active-color="rgba(255,255,255,1)">
<block wx:for="{{floorData.data}}" wx:key="{{index}}">
<swiper-item>
<anchor
is-floor="{{reportClick}}"
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
url="{{item.url}}">
<format-img
width="{{750}}"
height="{{280}}"
src="{{item.src}}">
</format-img>
</anchor>
</swiper-item>
</block>
</swiper>
<view class="dots">
<block wx:for="{{floorData.data}}" wx:key="unique">
<view class="dot {{index == swiperCurrent ? ' active' : ''}}"></view>
</block>
</view>
</view>
... ...
.resource-swiper {
position: relative;
height: 562rpx;
width: 100%
}
.resource-swiper .swiper {
height: 100%;
}
.resource-swiper .dots {
position: absolute;
display: flex;
bottom: 10rpx;
left: 50%;
transform: translateX(-50%);
padding: 4rpx 0;
box-sizing: border-box;
font-size: 0;
border-radius: 20rpx;
background-color: rgba(0,0,0,0.2);
}
.resource-swiper .dot {
display: inline-block;
width: 10rpx;
height: 10rpx;
border-radius: 10rpx;
margin: 0 6rpx;
background-color: rgba(255, 255, 255, 0.2);
}
.resource-swiper .dot.active {
display: inline-block;
width: 10rpx;
height: 10rpx;
border-radius: 10rpx;
background-color: rgba(255, 255, 255, 1);
}
... ...
let app = getApp()
const windowWidth = app.globalData.systemInfo.windowWidth;
Component({
properties: {
floorData: Object,
floorIdx: {
type: Number
}
},
data: {
windowWidth
},
methods: {
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="new-horizontal">
<view wx:if="{{!!floorData.data.title}}" class="title">
<view class='line'></view>
<view class='text'>{{floorData.data.title}}</view>
</view>
<view class='new-horizontal-content'>
<scroll-view class='horImgScrollView' scroll-x="true">
<block wx:for="{{floorData.data.list}}" wx:key="{{index}}">
<view class="img-item" style="margin-left:{{index==0?'16rpx':'0'}}" >
<anchor
is-floor="{{true}}"
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
url="{{item.url}}" style="width: 100%">
<image class="horImage" src="{{item.src}}" mode="scaleToFill"/>
</anchor>
</view>
</block>
</scroll-view>
</view>
<view wx:if="{{!floorData.data.title}}" style='width:100%;height:16rpx;background-color:white'></view>
</view>
\ No newline at end of file
... ...
.new-horizontal .title {
background-color: white;
display: flex;
flex-direction: row;
height: 80rpx;
align-items: center;
}
.new-horizontal .line {
width: 4rpx;
height: 30rpx;
background-color: #444444;
margin-left: 20rpx;
}
.new-horizontal .text {
flex: 1;
text-align: left;
color: #444444;
font-family: PingFang SC;
font-size: 30rpx;
margin-left: 16rpx;
font-weight: 600;
}
.new-horizontal-content {
height: 236rpx;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-end;
background-color: white;
}
.horImgScrollView{
height: 220rpx;
white-space: nowrap;
}
.new-horizontal-content .img-item {
display: inline-block;
height: 220rpx;
width: 203rpx;
margin-right: 16rpx;
align-items: center;
}
.horImage {
width: 203rpx;
height: 220rpx;
border-radius: 10rpx;
}
.titleMore{
width: 48rpx;
height: 38rpx;
display: flex;
margin-right: 30rpx;
align-items: center;
justify-content: center;
}
.titleMoreIm{
width: 44rpx;
height: 8rpx;
}
\ No newline at end of file
... ...
let app = getApp()
const windowWidth = app.globalData.systemInfo.windowWidth;
Component({
properties: {
floorData: {
type: Object,
observer: '_dataChange'
},
floorIdx: {
type: Number
}
},
data: {
windowWidth
},
methods: {
_dataChange() {
},
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="new-recommand">
<view wx:if="{{!!floorData.data.title}}" class="title">
<view class='line'></view>
<view class='text'>{{floorData.data.title.title}}</view>
<block wx:if="{{!!floorData.data.more&&floorData.data.more.url}}" class="more">
<view class='titleMore'>
<anchor is-floor="{{flase}}" url="{{floorData.data.more.url}}">
<image class="titleMoreIm" src="/images/more_ic@2x.png" ></image>
</anchor>
</view>
</block>
</view>
<view class='new-recommand-content'>
<block wx:for="{{floorData.data.list}}" wx:key="{{index}}">
<view class="img-item" style="width: {{(windowWidth-3)/4}}px;height: {{(windowWidth-3)/4 + 10}}px;border-right:{{index % 4 == 3 ? '0rpx' : '1rpx #dddddd solid;'}}">
<anchor
is-floor="{{true}}"
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
url="{{item.url}}" style="width: 100%">
<!-- <format-img
src="{{item.src}}"
width="{{floorData.data.imageWidth}}"
height="{{floorData.data.imageHeight}}"
default-width="{{true}}"
></format-img> -->
<image class="categoryImage" src="{{item.src}}" style="height: {{(windowWidth-3)/4 + 10}}px;"/>
</anchor>
</view>
</block>
</view>
</view>
\ No newline at end of file
... ...
.new-recommand {
/* display: flex;
width: 100%;
padding: 0 30rpx;
font-size: 0;
box-sizing: border-box; */
}
.new-recommand .title {
background-color: white;
display: flex;
flex-direction: row;
height: 80rpx;
align-items: center;
}
.new-recommand .line {
width: 4rpx;
height: 30rpx;
background-color: #444444;
margin-left: 20rpx;
}
.new-recommand .text {
flex: 1;
text-align: left;
color: #444444;
font-family: PingFang SC;
font-size: 30rpx;
margin-left: 16rpx;
font-weight: 600;
}
.new-recommand-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
background-color: white;
border-top: 1rpx solid #ddd;
}
.new-recommand-content .img-item {
display: flex;
flex-direction: column;
align-items: center;
border-bottom: 1rpx solid #ddd;
}
.categoryImage {
width: 100%;
}
.titleMore{
width: 48rpx;
height: 38rpx;
display: flex;
margin-right: 30rpx;
align-items: center;
justify-content: center;
}
.titleMoreIm{
width: 44rpx;
height: 8rpx;
}
\ No newline at end of file
... ...
Component({
properties: {
floorData: {
type: Object,
observer: '_dataChange'
},
floorIdx: {
type: Number
}
},
methods: {
_dataChange() {
}
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="resource-single">
<view wx:if="{{!!floorData.data.title}}" class="title">
<view class='line'></view>
<view class='text'>{{floorData.data.title}}</view>
</view>
<anchor
is-floor="{{true}}"
floor-idx="{{floorIdx}}"
item-idx="1"
floor-data="{{floorData}}"
url="{{floorData.data.list[0].url}}">
<format-img
src="{{floorData.data.list[0].src}}"
width="{{floorData.data.imageWidth}}"
height="{{floorData.data.imageHeight}}"
default-width="{{true}}"
></format-img>
</anchor>
</view>
\ No newline at end of file
... ...
.resource-single {
width: 100%;
font-size: 0;
}
.resource-single .title {
height: 80rpx;
line-height: 80rpx;
}
.resource-single .line {
display: inline-block;
width: 4rpx;
height: 30rpx;
background-color: #444444;
margin-left: 20rpx;
margin-top: 25rpx;
}
.resource-single .text {
display: inline-block;
text-align: left;
color: #444444;
font-family: PingFang SC, sans-serif;
font-size: 30rpx;
margin-left: 16rpx;
font-weight: 600;
vertical-align: top;
}
... ...
let app = getApp()
const windowWidth = app.globalData.systemInfo.windowWidth;
Component({
properties: {
floorData: Object,
floorIdx: {
type: Number
}
},
data: {
windowWidth
},
methods: {
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="popular">
<view wx:if="{{!!floorData.data.title}}" class="title">
<view class='line'></view>
<view class='text'>{{floorData.data.title}}</view>
</view>
<view class='popular-content'>
<scroll-view class='popImgScrollView' scroll-x="true">
<block wx:for="{{floorData.data.list}}" wx:key="{{index}}">
<view class="img-item" style="margin-left:{{index==0?'16rpx':'0'}}" >
<anchor
is-floor="{{true}}"
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
url="../goodsDetail/goodsDetail?productSkn={{item.product_skn}}&page_name=home&page_param=" has-url="{{false}}" style="width: 100%">
<image src="{{item.default_images}}" class="pop-item-img"></image>
<block wx:if="{{floorData.template_name == 'popularListFloor'}}">
<view class="pop-item-price" wx:if="{{item.shop_name && item.display_type == 2}}">{{item.shop_name}}</view>
<view class="pop-item-price" wx:if="{{item.sales_price && item.display_type == 1}}">¥{{item.sales_price}}</view>
</block>
<block wx:else>
<view class="pop-item-price">{{item.shop_name}}</view>
</block>
</anchor>
</view>
</block>
</scroll-view>
</view>
<view wx:if="{{!floorData.data.title}}" style='width:100%;height:16rpx;background-color:white'></view>
</view>
\ No newline at end of file
... ...
.popular .title {
background-color: white;
display: flex;
flex-direction: row;
height: 80rpx;
align-items: center;
}
.popular .line {
width: 4rpx;
height: 30rpx;
background-color: #444444;
margin-left: 20rpx;
}
.popular .text {
flex: 1;
text-align: left;
color: #444444;
font-family: PingFang SC;
font-size: 30rpx;
margin-left: 16rpx;
font-weight: 600;
}
.popImgScrollView{
white-space: nowrap;
background-color: white;
}
.popular-content .img-item {
width: 186rpx;
height: 296rpx;
display: inline-block;
margin-top: 30rpx;
margin-left: 32rpx;
}
.img-item:last-child {
margin-right: 32rpx;
}
.pop-item-img {
width: 100%;
height: 228rpx;
}
.pop-item-price {
width: 100%;
height: 23%;
text-align: center;
line-height: 50rpx;
color:#444444;
font-size: 24rpx;
font-family: PingFang SC;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.titleMore{
width: 48rpx;
height: 38rpx;
display: flex;
margin-right: 30rpx;
align-items: center;
justify-content: center;
}
.titleMoreIm{
width: 44rpx;
height: 8rpx;
}
\ No newline at end of file
... ...
Component({
properties: {
floorData: {
type: Object,
observer: '_dataChange'
},
floorIdx: {
type: Number
}
},
data: {
style: ''
},
methods: {
_dataChange() {
let that = this;
let floorData = this.data.floorData;
let width = floorData.image_width;
let height = floorData.image_height;
wx.getSystemInfo({
success: function(res) {
let windowWidth = res.screenWidth;
windowWidth = floorData.is_extend == 1 ? windowWidth : windowWidth - 30;
let realHeight = windowWidth * height / width;
let style = `margin: 0 ${floorData.is_extend == 1 ? 0 : 15}px; height:${realHeight}px`;
that.setData({
style
})
}
})
}
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="split-image" style="{{style}}">
<format-img
src="{{floorData.data.src}}"
width="{{floorData.image_width}}"
height="{{floorData.image_height}}"
default-width="{{true}}"
></format-img>
<view class='urlContent'>
<block wx:for="{{floorData.data.urls}}" wx:key="{{index}}">
<view class="split-item">
<anchor
is-floor="{{true}}"
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
url="{{item}}">
<view class='placeholder'></view>
</anchor>
</view>
</block>
</view>
</view>
\ No newline at end of file
... ...
.split-image {
font-size: 0;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
.split-item {
position: relative;
flex: 1;
}
.urlContent {
position: absolute;
display: flex;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 111;
}
.placeholder {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
\ No newline at end of file
... ...
Component({
properties: {
floorData: Object,
floorIdx: {
type: Number
}
},
methods: {
}
});
... ...
{
"component": true,
"usingComponents": {
"anchor": "/component/common/anchor/anchor",
"format-img": "/component/common/format-image/index"
}
}
\ No newline at end of file
... ...
<view class="resource-two-image">
<block wx:for="{{floorData.data.list}}" wx:key="{{index}}">
<view class="img-item">
<anchor
is-floor="{{true}}"
floor-data="{{floorData}}"
floor-idx="{{floorIdx}}"
item-idx="{{index}}"
url="{{item.url}}">
<format-img
src="{{item.src}}"
width="{{floorData.data.imageWidth}}"
height="{{floorData.data.imageHeight}}"
default-width="{{true}}"
></format-img>
</anchor>
</view>
</block>
</view>
\ No newline at end of file
... ...
.resource-two-image {
display: flex;
width: 100%;
/* padding: 0 30rpx; */
font-size: 0;
box-sizing: border-box;
}
.resource-two-image .img-item {
flex: 1;
}
\ No newline at end of file
... ...
// component/goods-list-cell/goods-list-cell.js
Component({
/**
* 组件的属性列表
*/
properties: {
goods: {
type: Object,
value: {
number: 1
}
},
showSelect: {
type: Boolean,
value: false
},
index: {
type: Number,
value: 0
},
showLine: {
type: Boolean,
value: true
},
returnReason: {
type: Array
}
},
/**
* 组件的初始数据
*/
data: {
selectedImage: '../../pages/addressManager/images/default-select@3x.png',
unSelectedImage: '../../pages/addressManager/images/default-normal@3x.png',
uploadImage: 'http://img12.static.yhbimg.com/article/2018/11/21/18/02381a8df00bf0d6310549f7937f2d8e5c.png',
isShowExample: false,
down: '/images/arrow_down@3x.png',
up: '/images/arrow_up@3x.png',
showInputAndUploadImageArrays: [
4,
6,
8
],
isShowInputAndUploadImage: false,
hasBottomLine: false,
uploadImages: [],
gift: '../../pages/orders/images/zp-lab@2x.png',
price_gift: '../../pages/orders/images/jjg-lab@2x.png',
},
/**
* 组件的方法列表
*/
methods: {
selectedAction(e) {
const index = e.target && e.target.dataset && e.target.dataset.index;
this.triggerEvent('changeSelected', index);
},
bindPickerSelectReason(e) {
this.triggerEvent('pickerselectreason', e.detail);
console.log(e.detail);
let inputAndUploadImage = this.data.showInputAndUploadImageArrays;
let isShowInputAndUploadImage = false;
let hasBottomLine = this.data.hasBottomLine;
// 质量瑕疵、发错货、图片与实物不符这三个时,下方展开"退货原因说明"和上传"照片凭证"
if (inputAndUploadImage.indexOf(e.detail.id) !== -1) {
isShowInputAndUploadImage = true;
hasBottomLine = true;
} else {
hasBottomLine = false;
}
this.setData({
isShowInputAndUploadImage,
hasBottomLine
})
console.log(`${e.detail.id}: ${isShowInputAndUploadImage}`);
},
updateImagesArrays(e) {
this.triggerEvent('updategoodsimage', e.detail);
},
confirmReasonInfo(e) {
this.triggerEvent('confirmreason', e.detail);
}
}
})
... ...
{
"component": true,
"usingComponents": {
"show-picker-bg": "/component/showPickerBg/showPickerBg",
"upload-image-example": "/component/uploadImageExample/uploadImageExample"
}
}
\ No newline at end of file
... ...
<!--component/goods-list-cell/goods-list-cell.wxml-->
<view class="{{index === 0 ? 'goods' : 'goods margin-top'}}">
<block wx:if="{{showSelect}}">
<block wx:if="{{goods.is_limit_skn === 'Y'}}">
<image class="selected-image margin-left" src="{{unSelectedImage}}"></image>
</block>
<block wx:else>
<image class="selected-image margin-left" src="{{goods.selected ? selectedImage : unSelectedImage}}" bindtap="selectedAction" data-index="{{index}}"></image>
</block>
</block>
<!-- 商品图 -->
<!-- <image class="goods-image" src="{{goods.goods_image}}"></image> -->
<view class="goods-images margin-left column margin-top margin-bottom">
<image
class="goods-image"
src="{{goods.goods_image}}">
</image>
<block wx:if="{{goods.goods_type === 'price_gift'}}">
<image class="productTag" mode="aspectFill" src="{{price_gift}}"></image>
</block>
<block wx:if="{{goods.goods_type === 'gift'}}">
<image class="productTag" mode="aspectFill" src="{{gift}}"></image>
</block>
</view>
<!-- 商品详情 -->
<view class="goods-detail margin-left">
<view class="title-color-size">
<text class="product-name product-info">{{goods.product_name}}</text>
<text class="color-size light-gray pingfangsc-regular">颜色:{{goods.color_name}} {{goods.sku_title}}:{{goods.size_name}}</text>
</view>
<view class="price-number">
<text class="product-name">¥{{goods.last_price}}</text>
<text class="color-size light-gray pingfangsc-regular">x{{goods.number ? goods.number : 1}}</text>
</view>
</view>
</view>
<block wx:if="{{showLine || (goods.selected && goods.goods_type !== 'gift')}}">
<view class="light-line"></view>
</block>
<block wx:if="{{goods.selected && goods.goods_type !== 'gift'}}">
<show-picker-bg hasBottomLine="{{hasBottomLine}}" title="退货原因" index="{{index}}" range="{{returnReason}}" rangeKey="name" bindpickerselect="bindPickerSelectReason" reasonIndex="{{goods.reasonIndex}}"></show-picker-bg>
<block wx:if="{{isShowInputAndUploadImage}}">
<upload-image-example
up="{{up}}"
down="{{down}}"
currentIndex="{{index}}"
uploadImage="{{uploadImage}}"
uploadImages="{{uploadImages}}"
isShowExample="{{isShowExample}}"
bindupdateimagearrays="updateImagesArrays"
bindconfirmreason="confirmReasonInfo"
></upload-image-example>
</block>
<block wx:if="{{showLine}}">
<view class="space"></view>
</block>
</block>
... ...
/* component/goods-list-cell/goods-list-cell.wxss */
.margin-left {
margin-left: 20rpx;
}
.margin-bottom {
margin-bottom: 20rpx;
}
.margin-right {
margin-right: 20rpx;
}
.margin-top {
margin-top: 20rpx;
}
.large-margin-left {
margin-left: 32rpx;
}
.large-margin-top {
margin-top: 32rpx;
}
.space {
background-color:#F0F0F0;
height: 20rpx;
}
.goods {
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 30rpx;
}
.selected-image {
width: 40rpx;
height: 40rpx;
}
.goods-image {
width: 100rpx;
height: 125rpx;
}
.goods-detail {
width: 70%;
display: flex;
height:125rpx;
justify-content: space-between;
margin-right: 30rpx;
}
.title-color-size {
display: flex;
flex-direction: column;
}
.product-name {
font-size: 28rpx;
font-family: PingFangSC-Regular;
margin-bottom: 10rpx;
}
.product-info {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
word-break: break-all;
text-overflow:ellipsis;
width: 400rpx;
}
.color-size {
font-size: 24rpx;
}
.light-gray {
color: #B0B0B0;
}
.pingfangsc-regular {
font-family: PingFangSC-Regular;
}
.price-number {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.light-line {
height: 1rpx;
background-color: #E0E0E0;
margin-left: 80rpx;
}
.input-upload-image-bg {
display: flex;
flex-direction: column;
align-items: center;
}
.input-refund-info {
height: 100rpx;
border-radius: 10rpx;
border: 1rpx solid #E0E0E0;
width: 686rpx;
}
.column {
display: flex;
flex-direction: column;
}
.input-refund-info-textarea {
width: 100%;
height: 100%;
}
.input-refund-info-placeholder {
font-size: 28rpx;
padding-left: 32rpx;
padding-top: 32rpx;
color: #E0E0E0;
}
.upload-image-info {
display: flex;
flex-direction: row;
align-items: center;
width: 686rpx;
height: 100rpx;
}
.upload-btn {
width: 100rpx;
height: 100rpx;
}
.border {
border: 1rpx solid #E0E0E0;
border-radius: 10rpx;
}
.example-upload-image {
background-color: #F0F0F0;
width: 686rpx;
height: 50rpx;
display: flex;
align-items: center;
}
.example-text-btn {
display: flex;
flex-direction: row;
align-items: center;
width: 646rpx;
justify-content: space-between;
height: 50rpx;
}
.example-text {
}
.example-arrow {
width: 20rpx;
height: 15rpx;
top:0px;
bottom:0px;
}
.productTag {
margin-top: -20rpx;
width:100rpx;
height:20rpx;
}
\ No newline at end of file
... ...
Component({
options: {
},
properties: {
isShow:{
type: Boolean,
value: true
},
},
data: {
},
methods: {
_backhome(e){
wx.switchTab({
url: '/pages/index/index',
})
},
},
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<block wx:if="{{isShow}}">
<view class='homeContainer'>
<image class='homeIcon' src='images/yoho@3x.png' style='mode: aspectFit;' bindtap='_backhome'></image>
</view>
</block>
\ No newline at end of file
... ...
.homeContainer {
position: fixed;
width: 90rpx;
height: 90rpx;
bottom: 140rpx;
right: 30rpx;
z-index: 1300;
}
.homeIcon {
width: 100%;
height: 100%;
}
\ No newline at end of file
... ...
// component/login-button/login-button.js
import { GET, POST } from '../../libs/request';
import { API_HOST } from '../../libs/config';
Component({
externalClasses: ['login-class'],
/**
* 组件的属性列表
*/
properties: {
openType: {
type: String,
value: '',
observer(newVal) {
if (newVal === 'getPhoneNumber') {
let app = getApp()
let param = {
method: 'app.passport.signinByOpenID',
openId: app.globalData.WXUnion_ID,
nickname: app.globalData.userInfo.nickName || '',
}
POST(API_HOST, param)
.then(data => {
if (data && data.data.is_bind === 'Y') {
this.setData({
myOpenType: '',
goBind: false
})
} else {
this.setData({
myOpenType: newVal,
goBind: true
})
}
}).catch(error => {
this.setData({
myOpenType: newVal,
goBind: true
});
});
} else {
this.setData({
myOpenType: newVal,
goBind: true
})
}
}
},
plain: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
myOpenType: '',
goBind: true
},
/**
* 组件的方法列表
*/
methods: {
getUserInfo(e) {
console.log(e.detail);
this.triggerEvent('getuserinfo', e.detail);
},
wechatBindUnionId() {
if (this.data.goBind) return;
let app = getApp()
let param = {
method: 'app.passport.signinByOpenID',
openId: app.globalData.WXUnion_ID,
nickname: app.globalData.userInfo.nickName || '',
}
POST(API_HOST, param)
.then(data => {
if (data && data.data.is_bind === 'Y') {
let resData = data.data;
let userInfo = app.globalData.userInfo;
userInfo.is_bind = resData.is_bind;
userInfo.mobile = resData.mobile;
userInfo.ssouid = resData.ssouid;
userInfo.uid = resData.uid;
app.setUserInfo(userInfo);
app.setSessionkey(resData.session_key);
this.triggerEvent('updateuserinfo', userInfo);
} else {
this.setData({
myOpenType: 'getPhoneNumber',
goBind: true
});
}
});
},
getPhoneNumber(e) {
console.log(e.detail);
this.triggerEvent('getphonenumber', e.detail);
}
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--component/login-button/login-button.wxml-->
<view class="btn-bg">
<button wx:if="{{plain}}"
class="login-class"
open-type="{{myOpenType}}"
bindgetphonenumber='getPhoneNumber'
bindgetuserinfo='getUserInfo'
bindtap='wechatBindUnionId'
plain>
<slot></slot>
</button>
<button wx:else
class="login-class"
open-type="{{myOpenType}}"
bindgetphonenumber='getPhoneNumber'
bindgetuserinfo='getUserInfo'
bindtap='wechatBindUnionId'>
<slot></slot>
</button>
</view>
... ...
/* component/login-button/login-button.wxss */
.btn-bg {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file
... ...
// component/login-picker/login-picker.js
import { GET, POST } from '../../libs/request';
import { API_HOST } from '../../libs/config';
Component({
/**
* 组件的属性列表
*/
properties: {
isShow: Boolean,
openType: {
type: String,
value: "getUserInfo",
observer: function(newValue, oldValue) {
if (newValue === "getPhoneNumber") {
let app = getApp()
let param = {
method: 'app.passport.signinByOpenID',
openId: app.globalData.WXUnion_ID,
nickname: app.globalData.userInfo.nickName || '',
}
POST(API_HOST, param)
.then(data => {
if (data && data.data.is_bind === 'Y') {
this.setData({
myOpenType: '',
goBind: false,
loginBtnTitle: "微信登录"
})
} else {
this.setData({
myOpenType: newValue,
goBind: true,
loginBtnTitle: "绑定手机号"
})
}
}).catch(error => {
this.setData({
myOpenType: newValue,
goBind: true
});
});
} else {
this.setData({
loginBtnTitle: "微信授权登录",
myOpenType: 'getUserInfo',
goBind: true
})
}
}
}
},
/**
* 组件的初始数据
*/
data: {
logo: "https://feature.yoho.cn/1019/youhuo2.png",
loginBtnTitle: "微信授权登录",
myOpenType: 'getUserInfo',
goBind: true
},
/**
* 组件的方法列表
*/
methods: {
getUserInfo: function(e) {
this.triggerEvent("getuserinfo", e.detail);
},
getPhoneNumber: function (e) {
this.triggerEvent("getphonenumber", e.detail);
},
wechatBindUnionId() {
if (this.data.goBind) return;
let app = getApp()
let param = {
method: 'app.passport.signinByOpenID',
openId: app.globalData.WXUnion_ID,
nickname: app.globalData.userInfo.nickName || '',
}
POST(API_HOST, param)
.then(data => {
if (data && data.data.is_bind === 'Y') {
let resData = data.data;
let userInfo = app.globalData.userInfo;
userInfo.is_bind = resData.is_bind;
userInfo.mobile = resData.mobile;
userInfo.ssouid = resData.ssouid;
userInfo.uid = resData.uid;
app.setUserInfo(userInfo);
app.setSessionkey(resData.session_key);
this.triggerEvent('updateuserinfo', userInfo);
} else {
this.setData({
myOpenType: 'getPhoneNumber',
goBind: true
});
}
});
},
}
})
... ...
{
"component": true,
"usingComponents": {
"login-button": "../login-button/login-button"
}
}
\ No newline at end of file
... ...
<!--component/login-picker/login-picker.wxml-->
<block wx:if="{{isShow}}">
<view class="login-picker-bg" catchtouchmove>
<image class="logo" src="{{logo}}"></image>
<view class='sub-logo-title-view'>
<text class='sub-logo-title-line'>––</text>
<text class='sub-logo-title'>LIVE IN STAY COOL</text>
<text class='sub-logo-title-line'>––</text></view>
<button class="login-btn" bindgetuserinfo="getUserInfo" bindgetphonenumber="getPhoneNumber" open-type="{{myOpenType}}" bindtap="wechatBindUnionId">{{loginBtnTitle}}</button>
<text class='login-text-tips' wx:if="{{openType == 'getPhoneNumber'}}">还差一步,绑定手机号,加入Yoho!Family!</text>
</view>
</block>
... ...
/* component/login-picker/login-picker.wxss */
.login-picker-bg {
position: fixed;
z-index: 10010;
left: 0;
bottom: 0;
width: 100%;
height: 100%;
margin: 0;
background-color:#252222;
display: flex;
flex-direction: column;
align-items: center;
}
.login-btn::after {
border-radius: 0;
border: 0;
}
.login-picker-bg .login-btn {
line-height:88rpx;
color:#fff;
font-size:32rpx;
letter-spacing:8rpx;
text-align:center;
background-color:#A69073;
border-radius:44rpx;
width: 80%;
}
.login-bg {
width: 100%;
}
.login-picker-bg .logo {
width: 366rpx;
height: 312rpx;
margin-top: 242rpx;
}
.login-text-tips {
font-family: PingFang-SC-Light;
font-size: 24rpx;
color: #B0B0B0;
letter-spacing: 0;
text-align: center;
margin-top: 24rpx;
}
.login-picker-bg .sub-logo-title {
font-family: Arial-BoldMT;
font-size: 28rpx;
color: #FFFFFF;
letter-spacing: 0;
text-align: left;
font-weight: 500;
margin-left: 20rpx;
margin-right: 20rpx;
}
.login-picker-bg .sub-logo-title-line {
font-family: Arial-BoldMT;
font-size: 28rpx;
color: #FFFFFF;
letter-spacing: 0;
text-align: left;
font-weight: 500;
padding-bottom: 10rpx;
}
.login-picker-bg .sub-logo-title-view {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 58rpx;
margin-bottom: 216rpx;
}
... ...
// component/productListCell.js
import { shouldDiscardTap} from '../utils/util';
import {
logEvent,
YB_MAIN_EVENT
} from '../libs/analytics.js'
//获取应用实例
let app = getApp();
const screenHeight = app.globalData.systemInfo.screenHeight;
const windowWidth = app.globalData.systemInfo.windowWidth;
const windowHeight = app.globalData.systemInfo.windowHeight;
const DEVICE_WIDTH_RATIO = windowWidth / 320;
let listWidth = Math.ceil(137.5 * DEVICE_WIDTH_RATIO);
let listHeight = Math.ceil(254 * DEVICE_WIDTH_RATIO);
const IMAGE_WIDTH = 145;
const IMAGE_HEIGHT = 193;
const IMAGE_RATIO = IMAGE_HEIGHT / IMAGE_WIDTH;
let listImageTop = 31;
let listImageWidth = listWidth;
let listImageHeight = Math.ceil(listWidth * IMAGE_RATIO);
let listMarginHorizontal = (windowWidth - listWidth * 2) / 3;
let PV_ID = new Date().getTime() + '';
Component({
/**
* 组件的属性列表
*/
properties: {
item:{
type: Object
},
pageName: {
type: String,
value: ""
},
animationType: {
type: String,
value: ""
},
logEvenName: {
type: String,
value: ""
},
index: {
type: Number,
value: 0
},
fIndex: {
type: Number,
value: 0
},
fName: {
type: String,
value: ""
},
pageParam: {
type: String,
value: ""
}
},
/**
* 组件的初始数据
*/
data: {
lastTapTimeStamp: 0,
screenHeight,
windowHeight,
listWidth,
listHeight,
listImageWidth,
listImageHeight,
listImageTop,
listMarginHorizontal,
},
/**
* 组件的方法列表
*/
methods: {
productCellTapped(event) {
if (shouldDiscardTap(event.timeStamp, this.data.lastTapTimeStamp)) {
return;
}
this.setData({ lastTapTimeStamp: event.timeStamp });
let data = event.currentTarget.dataset;
let productSkn = data.productSkn;
// 以下是埋点代码,如果需要埋点请传入相应参数
if (this.properties.logEvenName && this.properties.logEvenName != "") {
let params = {
F_ID: this.properties.fIndex,
F_NAME: this.properties.fName,
F_URL: '/pages/goodsDetail/goodsDetail?productSkn=' + productSkn,
F_INDEX: this.properties.fIndex,
I_INDEX: this.properties.index + 1,
PV_ID: PV_ID,
};
logEvent(this.properties.logEvenName, params);
}
// 根据动画类型来选择动画效果
if (this.properties.animationType && this.properties.animationType == "redirectTo") {
wx.redirectTo({
url: '/pages/goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + this.properties.pageName + '&page_param=' + this.properties.pageParam
})
} else {
wx.navigateTo({
url: '/pages/goodsDetail/goodsDetail?productSkn=' + productSkn + '&page_name=' + this.properties.pageName + '&page_param=' + this.properties.pageParam
});
}
}
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--component/productListCell.wxml-->
<view class="product" style="width:{{listWidth}}px;margin-left:{{listMarginHorizontal}}px" bindtap="productCellTapped" data-product-skn="{{item.product_skn}}">
<image mode="aspectFit" src="{{item.default_images}}" style="width:{{listImageWidth}}px;height:{{listImageHeight}}px;margin-top:{{listImageTop}}px;"/>
<!-- 促销类标签样式如下: -->
<!-- <view class='depositContainer'>
<image mode="aspectFit" src="{{item.default_images}}" style="width:{{listImageWidth}}px;height:{{listImageHeight}}px;" />
<view class='deposit' style="width:{{listImageWidth}}px; height: 40rpx;">
<image class='depositImage' src='../images/product_bottom_deposit_icon@3x.png' ></image>
<view class='depositText'>
<text class='title'></text>
<text class='detail'></text>
</view>
</view>
</view> -->
<text class="productTitle">{{item.product_name}}</text>
<view class='bottomContainerView'>
<view class="priceContainer">
<text class="price1" style="color:{{item.showOriginPrice ? '#d0021b' : '#444444'}}">{{item.salePriceStr}}</text>
<text class="price2">{{item.showOriginPrice ? item.originPriceStr : ''}}</text>
</view>
<!-- 加入购物车按钮需要上层传入是否展示 部分商品由于特殊性 在商品列表不展示购物车按钮 -->
<image wx:if="{{showAddShopCartBtn && (item.is_shop_cart_add == 'Y')}}" class='addToShopCartImage' src='images/jrgwc@2x.png' catchtap='addToShopCartAction' data-item='{{item}}'></image>
</view>
</view>
\ No newline at end of file
... ...
/* component/productListCell.wxss */
.product {
display: flex;
flex-direction: column;
background-color: white;
}
.productImage {
display: block;
}
.depositContainer {
display: flex;
flex-direction: column;
}
.productTitle {
margin-top: 21rpx;
margin-bottom: 1rpx;
color: #444444;
font-family: PingFang SC;
font-size: 24rpx;
/*font-weight: bold;*/
line-height: 30rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
height: 60rpx;
}
.bottomContainerView {
display: flex;
flex-direction: row;
align-items: flex-end;
/* margin-bottom: 20rpx; */
justify-content: space-between;
}
.priceContainer {
display: flex;
flex-direction: row;
width: 236rpx;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient:vertical;
overflow:hidden;
}
.price1 {
font-size: 24rpx;
color: #d0021b;
}
.price2 {
margin-left: 10rpx;
font-size: 24rpx;
color: #b0b0b0;
text-decoration: line-through;
}
.addToShopCartImage {
width: 80rpx;
height: 46rpx;
}
.deposit {
margin-top: -38rpx;
}
.depositImage {
width: 100%;
height: 40rpx;
}
\ No newline at end of file
... ...
// component/showPikerBg/showPikerBg.js
Component({
/**
* 组件的属性列表
*/
properties: {
title: String,
index: {
type: Number
},
range: Array,
rangeKey: {
type: String
},
hasBottomLine: {
type: Boolean,
value: true
},
reasonIndex: {
type: String,
observer(newVal) {
if (newVal) {
this.setData({
defaultValue: this.properties.range[newVal].name
})
}
}
}
},
/**
* 组件的初始数据
*/
data: {
arrows: '../../pages/bindPhoneNumber/images/arrow-down@2x.png',
defaultValue: '请选择'
},
/**
* 组件的方法列表
*/
methods: {
pickerChange(e) {
const value = e.detail.value;
const index = this.data.index;
const selectReason = this.data.range[e.detail.value];
this.setData({
defaultValue: selectReason.name
});
this.triggerEvent('pickerselect', { ...selectReason, index, reasonIndex: value });
}
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--component/showPikerBg/showPikerBg.wxml-->
<view class="{{ hasBottomLine ? 'refund-way border-bottom' : 'refund-way'}}">
<text class="cell-title margin-top margin-bottom large-margin-left">{{title}}</text>
<picker style="flex-grow: 1;" bindchange="pickerChange" value="{{0}}" range="{{range}}" range-key="{{rangeKey}}">
<view class="select-way margin-top margin-bottom light-gray pingfangsc-regular">
<text>{{defaultValue}}</text>
<image class="select-way-arrow margin-left margin-right" src="{{arrows}}"></image>
</view>
</picker>
</view>
... ...
/* component/showPikerBg/showPikerBg.wxss */
.margin-left {
margin-left: 20rpx;
}
.margin-bottom {
margin-bottom: 20rpx;
}
.margin-right {
margin-right: 20rpx;
}
.margin-top {
margin-top: 20rpx;
}
.large-margin-left {
margin-left: 32rpx;
}
.light-gray {
color: #B0B0B0;
}
.pingfangsc-regular {
font-family: PingFangSC-Regular;
}
.refund-way {
background-color: white;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.border-bottom {
border-bottom: 1rpx solid #E0E0E0;
}
.cell-title {
font-size: 28rpx;
font-family: PingFangSC-Semibold;
color: #222222;
letter-spacing: -0.29rpx;
width: 110rpx;
}
.select-way {
display: flex;
flex-direction: row;
align-items: center;
font-size:28rpx;
justify-content: flex-end;
}
.select-way-arrow {
width: 22rpx;
height: 36rpx;
}
... ...
// component/tipdialog/tipdialog.js
Component({
/**
* 组件的属性列表
*/
properties: {
isShow:{
type:Boolean,
value:false,
},
content:{
type:String,
value:'预售商品定金不支持退款,如需取消订单,只退等同于定金30%的有货币,同意后方可下单。'
},
leftText:{
type: String,
value: '取消'
},
rightText:{
type: String,
value:'确认'
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
leftTap(){
this.triggerEvent("leftButtonTap");
},
rightTap(){
this.triggerEvent("rightButtonTap");
}
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--component/tipdialog/tipdialog.wxml-->
<view class='tip-dialog-container' style="display:{{isShow?'flex':'none'}}">
<view class='contentContainer'>
<view class='top-tip'>提示</view>
<view class='middle-content'>
<text class='content'>{{content}}</text>
</view>
<view class='bottom-container'>
<text class='leftText' bindtap='leftTap'>{{leftText}}</text>
<view style='height:100%;width:1rpx;background-color:#e0e0e0'></view>
<text class='rightText' bindtap='rightTap'>{{rightText}}</text>
</view>
</view>
</view>
... ...
/* component/tipdialog/tipdialog.wxss */
.tip-dialog-container {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
justify-content: center;
position: fixed;
top: 0rpx;
left: 0rpx;
align-items: center;
}
.contentContainer {
background: white;
border-radius: 10rpx;
width: 540rpx;
height: wrap;
display: flex;
flex-direction: column;
align-items: center;
z-index: 1000;
}
.contentContainer .top-tip {
margin-top: 40rpx;
font-family: PingFang-SC-Medium;
font-size: 34rpx;
color: #d0021b;
letter-spacing: -0.41px;
text-align: center;
}
.contentContainer .middle-content {
width: 420rpx;
/* padding-left: 60rpx;
padding-right: 60rpx; */
text-align: center;
height: wrap;
margin-top: 16rpx;
}
.contentContainer .middle-content .content {
font-family: PingFang-SC-Regular;
font-size: 28rpx;
color: #444;
letter-spacing: -0.09px;
text-align: center;
line-height: 23px;
}
.contentContainer .bottom-container {
width: 100%;
height: 88rpx;
margin-top: 34rpx;
border-top: 1rpx solid #e0e0e0;
display: flex;
flex-direction: row;
/* justify-content: space-around; */
align-items: center;
}
.contentContainer .bottom-container .leftText {
font-family: PingFang-SC-Regular;
font-size: 17px;
color: #b0b0b0;
letter-spacing: -0.41px;
text-align: center;
flex: 1;
}
.contentContainer .bottom-container .rightText {
font-family: PingFang-SC-Medium;
font-size: 17px;
color: #d0021b;
letter-spacing: -0.41px;
text-align: center;
flex: 1;
}
... ...
// component/uploadImageExample/uploadImageExample.js
import { uploadFile } from '../../libs/request.js'
Component({
/**
* 组件的属性列表
*/
properties: {
currentIndex: {
type: Number,
value: 0
},
uploadImage: {
type: String,
value: ''
},
up: {
type: String,
value: ''
},
down: {
type: String,
value: ''
},
uploadImages: {
type: Array,
value: []
}
},
/**
* 组件的初始数据
*/
data: {
isShowExample: false,
exampleImages: [
{
src: 'http://img10.static.yhbimg.com/article/2018/11/21/15/01312f5ad204d40e0ae7ee9852d0ab942b.png',
title: '瑕疵细节',
style: 'example',
imageStyle: 'example-image'
}, {
src: '/images/and@3x.png',
style: 'and',
imageStyle: 'and-image'
}, {
src: 'http://img10.static.yhbimg.com/article/2018/11/21/15/0181d222be867f9ae182045ca7f99864e0.png',
title: '合格证',
style: 'example',
imageStyle: 'example-image'
}, {
src: '/images/and@3x.png',
style: 'and',
imageStyle: 'and-image'
}, {
src: 'http://img10.static.yhbimg.com/article/2018/11/21/15/01515d77fa41dc25e6bcd3996d0d76dabc.png',
title: '条码标签',
style: 'example',
imageStyle: 'example-image'
}, {
src: '/images/and@3x.png',
style: 'and',
imageStyle: 'and-image'
}, {
src: 'http://img12.static.yhbimg.com/article/2018/11/21/15/02687dd41e9835128bdaa7854629dd60f0.png',
title: '领标',
style: 'example',
imageStyle: 'example-image'
},
],
tempImagePaths: [],
finalImageArray: [],
imageBgWidth: 'upload-image-1'
},
/**
* 组件的方法列表
*/
methods: {
showExample(e) {
const isShowExample = !this.data.isShowExample;
this.setData({
isShowExample
})
},
deleteImageFromUploadImages(e) {
console.log(e);
const index = e.currentTarget.dataset.index;
console.log(index);
let tempImagePaths = this.data.tempImagePaths;
let finalImageArray = this.data.finalImageArray;
tempImagePaths.splice(index, 1);
finalImageArray.splice(index, 1);
this.setData({
tempImagePaths,
finalImageArray
})
this.triggerEvent('updateimagearrays', { currentIndex: this.properties.currentIndex, finalImageArray });
},
previewImages(e) {
const index = e.target.dataset.index;
console.log(index);
let tempImagePaths = this.data.tempImagePaths;
wx.previewImage({
current: tempImagePaths[index],
urls: tempImagePaths,
})
},
selectPhoto(e) {
let tempImagePaths = this.data.tempImagePaths;
let finalImageArray = this.data.finalImageArray;
let count = 4 - tempImagePaths.length;
const that = this;
wx.chooseImage({
count: count,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
// tempFilePath可以作为img标签的src属性显示图片
const tempFilePaths = res.tempFilePaths;
const imagesPromiseArr = [];
tempFilePaths.forEach((item, index) => {
imagesPromiseArr.push(uploadFile(item, index + finalImageArray.length).then((data) => {
console.log('uploadFile.data: ', data);
console.log('uploadFile.then: ', data.index);
return {
index: data.index,
path: data.imagesList[0]
}
}));
});
wx.showLoading({
title: '图片上传中...',
})
Promise.all(imagesPromiseArr).then((res) => {
res.forEach((item) => {
finalImageArray[item.index] = item.path;
});
that.setData({
finalImageArray
})
that.triggerEvent('updateimagearrays', { currentIndex: that.properties.currentIndex, finalImageArray });
console.log(finalImageArray);
wx.hideLoading();
}).catch(error => {
wx.hideLoading();
})
if (tempImagePaths.length < 4) {
tempImagePaths = tempImagePaths.concat(tempFilePaths);
that.setData({
tempImagePaths
})
}
}
})
},
confirmReasonInfo(e) {
this.triggerEvent('confirmreason', { currentIndex: this.properties.currentIndex, reason: e.detail.value});
}
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--component/uploadImageExample/uploadImageExample.wxml-->
<view class="input-upload-image-bg margin-top">
<view class="input-refund-info">
<textarea bindinput="confirmReasonInfo" class="input-refund-info-textarea" placeholder="退货原因说明" placeholder-class="input-refund-info-placeholder"></textarea>
</view>
<view class="upload-image-info margin-top">
<block wx:for="{{tempImagePaths}}" wx:key="{{index}}">
<view class="upload-btn {{index !== 0 ? 'small-margin-left' : ''}}">
<image class="upload-btn-image border" src="{{item}}" mode="aspectFill" bindtap="previewImages" data-index="{{index}}">
</image>
<view class="red-point" bindtap="deleteImageFromUploadImages" data-index="{{index}}">
<text class="red-point-text">x</text>
</view>
</view>
</block>
<block wx:if="{{tempImagePaths.length < 4}}">
<image class="upload-btn-image {{tempImagePaths.length !== 0 ? 'small-margin-left' : ''}}" src="{{uploadImage}}" bindtap="selectPhoto"></image>
</block>
</view>
<view class="example-upload-image margin-top {{ isShowExample ? '' : 'margin-bottom' }}">
<view class="example-text-btn margin-left" bindtap="showExample">
<text class="example-text color-size light-gray">请按照示例图传图</text>
<image class="example-arrow" src="{{ isShowExample ? up : down }}"></image>
</view>
</view>
<block wx:if="{{isShowExample}}">
<view class="example-image margin-bottom">
<block wx:for="{{exampleImages}}" wx:key="{{index}}">
<view class="{{item.style}}">
<image src="{{item.src}}" mode="aspectFill" class="{{item.imageStyle}}"></image>
<text class="small-size margin-top">{{item.title}}</text>
</view>
</block>
</view>
</block>
</view>
... ...
/* component/uploadImageExample/uploadImageExample.wxss */
.margin-left {
margin-left: 20rpx;
}
.small-margin-left {
margin-left: 10rpx;
}
.margin-bottom {
margin-bottom: 20rpx;
}
.margin-right {
margin-right: 20rpx;
}
.margin-top {
margin-top: 20rpx;
}
.large-margin-left {
margin-left: 32rpx;
}
.light-gray {
color: #B0B0B0;
}
.color-size {
font-size: 24rpx;
}
.small-size {
font-size: 20rpx;
}
.pingfangsc-regular {
font-family: PingFangSC-Regular;
}
.input-upload-image-bg {
display: flex;
flex-direction: column;
align-items: center;
}
.input-refund-info {
height: 100rpx;
border-radius: 10rpx;
border: 1rpx solid #E0E0E0;
width: 686rpx;
}
.input-refund-info-textarea {
width: 100%;
height: 100%;
}
.input-refund-info-placeholder {
font-size: 28rpx;
padding-left: 32rpx;
padding-top: 32rpx;
color: #E0E0E0;
}
.upload-image-info {
display: flex;
flex-direction: row;
align-items: center;
width: 686rpx;
height: 150rpx;
}
.upload-image-1 {
width: 167rpx;
}
.upload-image-2 {
width: 340rpx;
}
.upload-image-3 {
width:686rpx;
}
.upload-btn {
width: 167rpx;
height: 150rpx;
display: flex;
}
.upload-btn-image {
width: 150rpx;
height: 150rpx;
display: block;
}
.border {
border: 1rpx solid #E0E0E0;
border-radius: 10rpx;
}
.example-upload-image {
background-color: #F0F0F0;
width: 686rpx;
height: 50rpx;
display: flex;
align-items: center;
}
.example-text-btn {
display: flex;
flex-direction: row;
align-items: center;
width: 646rpx;
justify-content: space-between;
height: 50rpx;
}
.example-text {
}
.example-arrow {
width: 20rpx;
height: 15rpx;
top:0px;
bottom:0px;
}
.example-image {
background-color: #F0F0F0;
width: 686rpx;
height: 180rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-evenly;
}
.example-image .example {
width: 118rpx;
height: 160rpx;
color: #4A4A4A;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.example-image .example .example-image {
width: 100%;
height: 118rpx;
}
.example-image .and {
width: 20rpx;
height: 20rpx;
margin-bottom: 42rpx;
}
.example-image .and .and-image {
width: 100%;
height: 100%;
display: block;
}
.red-point {
background:#d0021b;
margin-top: -10rpx;
margin-left: -20rpx;
height: 34rpx;
width: 34rpx;
font-family: PingFang-SC-Semibold;
font-size: 26rpx;
font-weight: bold;
color: white;
border-style: solid;
border-width: 3rpx;
border-color: #fff;
border-radius: 18rpx;
display: flex;
align-items: center;
justify-content: center;
}
.red-point-text {
margin-top: -6rpx;
text-align: center;
}
\ No newline at end of file
... ...
/* eslint-disable */
export default {
"domains": {
//"api": "https://api.yoho.cn",
"api": 'http://api-test3.yohops.com:9999',
"service": 'http://api-test3.yohops.com:9999',
//"service": "https://api.yoho.cn",
"yas": "https://analysis.yohobuy.com/yas_mobile",
"report": "https://app.yoho.cn/collect/v3"
},
"appid": "wx084ab813d88c594b",
"payment_code": "45",
"private_key": "b43890b0a296ff3c7b8c260ca763980b",
"jump": {
"brand": "go.brand",
"detail": "go.detail",
"productpool": "go.poollist"
},
"mini_app_type": "0",
"client_type": "miniapp",
"business_line": "miniapp",
"os_version": "yohobuy:h5",
"app_version": "2.8.3",
"app_build": "1032"
}
\ No newline at end of file
... ...