Commit ad92ab88 authored by 华国豪's avatar 华国豪 🙄

新增部分代码

parent 969be357
......@@ -75,6 +75,9 @@
.commonF .c99{
color:#999999;
}
.commonF .c29{
color:#292929;
}
.commonF .c55{
color:#5597FF;
}
......@@ -274,4 +277,7 @@ image{
}
.t-left{
text-align: left;
}
.felx2{
flex: 2;
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ let md5 = require('utils/md5.js')
let javaUrl = 'https://efficient.oytour.com/';
// let javaUrl = 'http://47.96.12.235:9001/';
// let netUrl = 'https://reborn.oytour.com/api/common/post';
let netUrl = 'http://192.168.2.16:8083/api/Common/Post';
let netUrl = 'http://192.168.2.214:8082/api/Common/Post';
App({
// 小程序初始化时
onLaunch: function(options) {
......@@ -34,7 +34,7 @@ App({
secretKey: wx.getStorageSync('admin') ? wx.getStorageSync('admin').secretKey :'',
token: wx.getStorageSync('admin') ? wx.getStorageSync('admin').token :'',
customerName: wx.getStorageSync('admin') ? wx.getStorageSync('admin').customerName : '',
id: wx.getStorageSync('admin') ? wx.getStorageSync('admin').id : ''
id: wx.getStorageSync('admin') ? wx.getStorageSync('admin').id : 5
},
site:{
companyId: wx.getStorageSync('site') ? wx.getStorageSync('site').companyId : 0,
......@@ -63,7 +63,7 @@ App({
timestamp: timestamp,
token: getApp().state.admin.token,
sign: sign,
uid: 5
uid: getApp().state.admin.id
},
success(res) {
wx.hideLoading()
......
......@@ -3,8 +3,13 @@
"pages/Home/home",
"pages/Product/ProductDetails/ProductDetails",
"pages/Product/classify/classify",
"pages/Product/ProductList/ProductList",
"pages/mine/mine",
"pages/ShoppingCart/ShoppingCart"
"pages/ShoppingCart/ShoppingCart",
"pages/Product/Settlement/Settlement",
"pages/mine/mineAddrEdit/mineAddrEdit",
"pages/mine/mineAddrList/mineAddrList",
"pages/mine/mineOrder/mineOrder"
],
"permission": {
"scope.userLocation": {
......
This diff is collapsed.
/* ---=*--*=*-=*-=-*-=* 🌹 *---=*--*=*-=*-=-*-=*
Lizus核心库
Author: lizus.com
---=*--*=*-=*-=-*-=* 🌹 *---=*--*=*-=*-=-*-=* */
//用于获取x的类型
//getType :: a -> string
var getType = function getType(x) {
var type=Object.prototype.toString.call(x);
return type.slice(8,-1);
};
//用于切换谓词函数的返回值
//not :: () -> ( a -> boolean )
var not = function not(fn) {
return function () {
return !fn.apply(null,[].slice.apply(arguments,[0]));
}
};
//用于判断x是否存在
// isExist :: a -> boolean
var isExist=function isExist(x) {
return x!=null;
};
//判断x是否为真,使用Boolean的结果
// isTrue :: a -> boolean
var isTrue = Boolean;
//判断x是否为空,此处判断空对象不算empty
//isEmpty :: a -> boolean
var isEmpty = function isEmpty(x) {
if (isTrue(x) && Math.abs(Number(x)) != 0) return false;
return true;
};
//生成返回自身的函数
//of :: x -> () -> x
var of=function (x) {
return function () {
return x;
};
};
//用于生成只接受len个参数的fn
//arity :: number -> () -> ()
var arity = function arity(len,fn) {
if (len<1) len=1;
if (typeof fn != 'function') return null;
return function () {
var args=[].slice.apply(arguments,[0,len]);
return fn.apply(null,args);
}
};
//生成反转参数的函数
//reverseArg :: () -> ()
var reverseArg = function reverseArg(fn) {
if (typeof fn != 'function') return null;
return function () {
var args=[].slice.apply(arguments,[0]).reverse();
return fn.apply(null,args);
}
};
//curry函数
//curry :: () -> ()
var curry=function curry(fn) {
if (typeof fn != 'function') return null;
return function curryMe() {
var args=[].slice.apply(arguments,[0]);
if (args.length >= fn.length) return fn.apply(null,args);
return function () {
return curryMe.apply(null,args.concat([].slice.apply(arguments,[0])));
}
}
};
//用于调试,tag用于标识调试信息,x为调试项,最终返回x不阻止程序运行
//trace :: string -> a -> a
var trace=curry(function trace(tag,x) {
if (isExist(console)) {
console.log(tag,x);
}else{
alert(tag);
alert(opt);
}
return x;
});
//compose函数,用于组合函数,从右至左执行
//compose :: () -> a
var compose=function compose() {
var args=[].slice.apply(arguments,[0]).reverse();
return function () {
var result=[].slice.apply(arguments,[0]);
for (var i=0;i<args.length;i++) {
if (typeof args[i] != 'function') return trace('the arguments is not a function',args[i]);
result=args[i].apply(null,[].concat(result));
}
return result;
}
};
//同compose,但是从左至右执行
//flow:: () -> a
var flow=reverseArg(compose);
//用于判断两个参数是否相等
//e :: a -> b -> boolean
var e = curry(function e(a,b) {
return a == b;
});
//用于判断b < a
//lt :: a -> b -> boolean
var lt = curry(function lt(a,b) {
return b < a;
});
//用于判断b > a
//gt :: a -> b -> boolean
var gt = curry(function (a,b) {
return b > a;
});
//用于判断x是否是a类型
//isType :: a -> x -> boolean
var isType = curry(function isType(a,x) {
return e(a,getType(x));
});
//判断a是否是数组
//isArray :: a -> boolean
var isArray = isType('Array');
//判断a是否是对象
//isObject :: a -> boolean
var isObject = isType('Object');
//判断a是否是字符串
//isString :: a -> boolean
var isString = isType('String');
//判断a是否是数字
//isNumber :: a -> boolean
var isNumber = isType('Number');
//判断a是否是函数
//isFunction :: a -> boolean
var isFunction = isType('Function');
//判断a是否是正则表达式
//isRegExp :: a -> boolean
var isRegExp = isType('RegExp');
//判断a是否是布尔值
//isBoolean :: a -> boolean
var isBoolean = isType('Boolean');
//判断a是否是日期对象
//isDate :: a -> boolean
var isDate = isType('Date');
//curry化的Array重要函数,并将fn放在第一个参数位置上
//map :: () -> array -> array
var map = curry(function map(fn,col) {
return Array.prototype.map.call(col,fn);
});
//filter :: () -> array -> array
var filter = curry(function filter(fn,col) {
return Array.prototype.filter.call(col,fn);
});
//reduce :: () -> array -> array
var reduce = curry(function reduce(fn,col) {
return Array.prototype.reduce.call(col,fn);
});
//深度复制,主要解决数组和对象的引用问题,通过深度复制去除引用
//deepCopy :: a -> b
var deepCopy=function (sth) {
var re;
if (isObject(sth)) {
re={};
for (var key in sth) {
if (sth.hasOwnProperty(key)) {
re[key]=deepCopy(sth[key]);
}
}
}else if(isArray(sth)){
re=map(deepCopy,sth);
}else{
re=sth;
}
return re;
};
//转变为数组
//toArray :: a -> b
var toArray = function (sth) {
var re=[];
if (isObject(sth)) {
for (var key in sth) {
if (sth.hasOwnProperty(key)) {
if (isObject(sth[key])) {
re.push([key,toArray(sth[key])]);
}else{
re.push([key,sth[key]]);
}
}
}
}else{
re=re.concat(deepCopy(sth));
}
return re;
};
module.exports={
trace:trace,
arity:arity,
reverseArg:reverseArg,
curry:curry,
compose:compose,
flow:flow,
not:not,
of:of,
e:e,
lt:lt,
gt:gt,
getType:getType,
isType:isType,
isArray:isArray,
isObject:isObject,
isString:isString,
isDate:isDate,
isNumber:isNumber,
isBoolean:isBoolean,
isFunction:isFunction,
isRegExp:isRegExp,
isExist:isExist,
isTrue:isTrue,
isEmpty:isEmpty,
map:map,
filter:filter,
reduce:reduce,
deepCopy:deepCopy,
toArray:toArray
};
\ No newline at end of file
const lizus = require('./lizus');
/**
* 用于查询匹配,正确返回匹配数组,错误返回false
*/
lizus.match=lizus.curry(function (q,str) {
if (lizus.isEmpty(str)) return false;
return String.prototype.match.call(str,q) || false;
});
module.exports=lizus;
/** ---=*--*=*-=*-=-*-=* ^.^ *---=*--*=*-=*-=-*-=*
* 省市县三联picker选择组件
*
* @author lizus.com
* @updated 20190429
*
* @数据源 https://docs.alipay.com/isv/10327
*
* @使用范例:
<region-picker bind:change="regionChange" province="浙江省" city="台州市" county="天台县"></region-picker>
* @获取到的数据示例:
e.detail={
province:'浙江省',
city:'台州市',
county:'天台县'
};
---=*--*=*-=*-=-*-=* ^.^ *---=*--*=*-=*-=-*-=* */
const area = require('./area');
const orz = require('./orz');
const areaArr=area.data;//省市县数据数组
/** provinces,cities,counties以数组的形式存储省市区数据,单位数组格式为[地方名称,地方名称在areaArr中的索引号] */
let provinces=[];//所有省,ready设定后不变
let cities=[];//城市数据,根据省的选择而变
let counties=[];//县区数据,根据市的选择而变
const matchProvince=orz.match(/([1-9]\d|\d[1-9])0000/);//省的编号特征
const matchCity=orz.match(/\d\d([1-9]\d|\d[1-9])00/);//市的编号特征
const matchCounty=orz.match(/\d\d\d\d([1-9]\d|\d[1-9])/);//县的编号特征
const notCounty=orz.not(matchCounty);
/** 用于获取某索引后符合fn条件的索引,fn为谓词函数 */
const getNextIndex=orz.curry(function (fn,index) {
let n=areaArr.length;
for (let i=index+1;i<n;i++) {
if(fn(areaArr[i][0])) {
n=i;
break;
}
}
return n;
});
const getNextCountyIndex=getNextIndex(notCounty);
const getNextCityIndex=getNextIndex(matchProvince);
/** 用于获取省市区各数据数组中的地区名称 */
const getName=function (arr,index) {
if (index>=arr.length) return '';
return arr[index][0];
};
/** 用于获取某数组中元素的索引号 */
const getIndex=orz.curry(function (arr,name) {
let idx=Array.prototype.indexOf.call(arr,name);
return (idx< 1) ? 0 : idx;
});
/** 用于获取省份数据,并传递给全局provinces,此函数只在ready中执行一次就可以了 */
const getProvinces=function () {
let col=[];
areaArr.forEach(function (item,index) {
let num=item[0];
let val=item[1];
if(matchProvince(num)){
provinces.push([val,index]);
col.push(val);
}
});
return col;
};
/**
* 用于获取某一省份下市的数据,返回市名称的列表数组,同时重写全局cities数组
* @param provinceIndex 省份在provinces数组中索引值
* @returns {Array}
*/
const getCities=function (provinceIndex) {
cities=[];
let targetProvince=provinces[provinceIndex];
let targetIndex=targetProvince[1];
let nextIndex=getNextCityIndex(targetIndex);
let col=[];
for (let i=targetIndex;i<nextIndex;i++) {
let item=areaArr[i];
let num=item[0];
let val=item[1];
if(matchCity(num)){
cities.push([val,i]);
col.push(val);
}
}
return col;
};
const getCounties=function (cityIndex) {
counties=[];
let targetCity=cities[cityIndex];
let targetIndex=targetCity[1];
let nextIndex=getNextCountyIndex(targetIndex);
let col=[];
for (let i=targetIndex+1;i<nextIndex;i++) {
let item=areaArr[i];
let val=item[1];
counties.push([val,i]);
col.push(val);
}
return col;
};
Component({
properties:{
province:{ type: String },
city:{ type: String },
county:{ type: String }
},
data:{
province:'北京',//省
city:'北京市',//市
county:'东城区',//县区
value:[0,0,0],//省,市,县在pickArr中的索引值
pickArr:[[],[],[]]//省,市,县
},
methods:{
colChange:function (e) {
let col=e.detail.column;
let val=e.detail.value;
let pickArr=this.data.pickArr;
let value=this.data.value;
if (col==0) {//用户更换第一列数据,联动二三列,并重置二三列索引为0
pickArr[1]=getCities(val);
pickArr[2]=getCounties(0);
value=[val,0,0];
this.setData({
value:value
});
}
if (col==1) {//用户更换第二列数据,联动第三列,并重置第三列索引为0
pickArr[2]=getCounties(val);
value[1]=val;
value[2]=0;
this.setData({
value:value
});
}
this.setData({
pickArr:pickArr,
});
},
valChange:function (e) {
let val=e.detail.value;
let obj={
province:getName(provinces,val[0]),
city:getName(cities,val[1]),
county:getName(counties,val[2])
};
this.setData(obj);
this.triggerEvent('change',obj);
},
},
ready: function () {
let col1=getProvinces();
let provinceIndex=getIndex(col1,this.data.province);
let col2=getCities(provinceIndex);
let cityIndex=getIndex(col2,this.data.city);
let col3=getCounties(cityIndex);
let countyIndex=getIndex(col3,this.data.county);
let value=[provinceIndex,cityIndex,countyIndex];
let pickArr=[col1,col2,col3];
this.setData({
pickArr:pickArr,
value:value
});
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<picker value="{{value}}" mode="multiSelector" range="{{pickArr}}" bindcolumnchange="colChange" bindchange="valChange">
<view class="region-picker ">
<block wx:if="{{province.length>0}}">
<text class="province">{{province}}</text>
</block>
<block wx:if="{{city.length>0}}">
<text class="line"> - </text>
<text class="city">{{city}}</text>
</block>
<block wx:if="{{county.length>0}}">
<text class="line"> - </text>
<text class="county">{{county}}</text>
</block>
<block wx:if="{{county.length<1 && city.length<1 && province.length<1}}">
<text class="empty-region">请选择所在地</text>
</block>
</view>
</picker>
\ No newline at end of file
.region-picker {
color: #999;
white-space: nowrap;
overflow: hidden;
}
\ No newline at end of file
......@@ -15,7 +15,52 @@ Page({
typeList: [],
newList: [],
hotList: [],
imgList: [],
},
jumpPage: function (e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: "/pages/Product/ProductList/ProductList?id=" + id,
})
},
addGwc: function (e){
let id = e.currentTarget.dataset.id
app.$api('Shop_post_SetCommodityShopInfo', {
CommodityId: id,
GuestId: app.state.admin.id,
CustomerId: 0,
Number: 1,
}).then(res => {
console.log(res)
wx.showToast({
title: '添加成功',
icon: 'none',
duration: 2000
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
getImgList: function () {
app.$api('ShopAd_get_GetAdManageListService', {}).then(res => {
console.log(res)
this.setData(
{
imgList: res
}
)
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
getNewList: function (){
app.$api('Shop_post_GetPageList', {
pageSize: 50,
......@@ -89,7 +134,6 @@ Page({
wx.navigateTo({
url: '/pages/Product/ProductDetails/ProductDetails?id=' + id,
})
},
/**
* 生命周期函数--监听页面加载
......@@ -112,6 +156,7 @@ Page({
this.getTypeList()
this.getNewList()
this.getHotList()
this.getImgList()
},
/**
......
......@@ -9,16 +9,16 @@
<view class="page-section page-section-spacing swiper">
<swiper indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{background}}" wx:key="*this">
<block wx:for="{{imgList}}" wx:key="index">
<swiper-item>
<view class="swiper-item {{item}}"></view>
<image src="{{item.ShowImage}}"></image>
</swiper-item>
</block>
</swiper>
</view>
<scroll-view class="scroll-view_H" scroll-x="true" style="width: 100%">
<view class="top-fenlei">
<view class="top-fenlei-item" wx:for="{{typeList}}" wx:key="index">
<view class="top-fenlei-item" wx:for="{{typeList}}" wx:key="index" data-id="{{item.Id}}" bindtap="jumpPage">
<view class="img">
<image src="{{item.Image}}"></image>
</view>
......@@ -58,7 +58,7 @@
<text class="f22">¥</text>
<text class="f28 bold">{{item.SellPrice}}</text>
</view>
<view class="gouwuche">
<view class="gouwuche" catchtap="addGwc" data-id="{{item.Id}}">
<image src="/images/tarbar/gouwuche1.png"></image>
</view>
</view>
......
......@@ -15,7 +15,34 @@ Page({
currentIndex: 1,
number: 1,
taocanBoxShow: false,
details: {}
details: {},
proId: ''
},
goShoppingCart: function (e) {
wx.navigateTo({
url: '/pages/ShoppingCart/ShoppingCart',
})
},
addGwc: function (e) {
app.$api('Shop_post_SetCommodityShopInfo', {
CommodityId: this.data.proId,
GuestId: app.state.admin.id,
CustomerId: 0,
Number: 1,
}).then(res => {
console.log(res)
wx.showToast({
title: '添加成功',
icon: 'none',
duration: 2000
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
setBoxShow: function (e) {
this.setData({
......@@ -67,8 +94,14 @@ Page({
*/
onLoad: function (options) {
console.log(options)
wx.setNavigationBarTitle({
title: '商品详情'
})
let id = options.id
this.init(id)
this.setData({
proId: id
})
},
/**
......
......@@ -22,8 +22,8 @@
<view class="product-info-price">
<text class="f24 cee">¥</text>
<text class="f36 bold cee">11.90</text>
<text class="f24 c66 padding-left-20">进口税:包税</text>
<image src="/images/product/beizhu.png"></image>
<!-- <text class="f24 c66 padding-left-20">进口税:包税</text>
<image src="/images/product/beizhu.png"></image> -->
</view>
<view class="product-tit f32 c11">
{{details.Name}}
......@@ -188,15 +188,15 @@
</view>
<view class="f18 c11">联系客服</view>
</view>
<view>
<view bindtap="goShoppingCart">
<view class="left-btn-img">
<image src="/images/tarbar/gouwuche.png"></image>
</view>
<view class="f18 c11">购物车</view>
<view class="f18 c11" >购物车</view>
</view>
</view>
<view class="right-btn">
<view class="jiagouwu">加入购物车</view>
<view class="jiagouwu" bindtap="addGwc">加入购物车</view>
<view class="goumai">立即购买</view>
</view>
</view>
......
// pages/Product/ProductList/ProductList.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
wx.setNavigationBarTitle({
title: '商品列表'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--pages/Product/ProductList/ProductList.wxml-->
<text>pages/Product/ProductList/ProductList.wxml</text>
/* pages/Product/ProductList/ProductList.wxss */
\ No newline at end of file
let app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
wxPay: false,
},
changePayway: function () {
this.setData({
wxPay: !this.data.wxPay
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
title: '确认订单'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="Settlement commonF">
<view class="Settlement-addr">
<view class="sar-tit f28 c11">李思思 <text>13800138000</text></view>
<view class="sar-info">
<image src="/images/mine/dingwei2.png"></image>
<view class="text2 f28 c22">四川省成都市高新区天晖路曙光国际B座1503(美豪丽致)酒店楼上</view>
<view class="edit-btn f28">修改</view>
</view>
</view>
<image class="se-line" src="/images/mine/line.png"></image>
<view class="Gray30"></view>
<view class="shenfenz f24 c11">
<view>身份证号</view>
<view>5139**********1234</view>
</view>
<view class="Gray30"></view>
<scroll-view class="Settlement-scroll-view" scroll-y>
<view class="sett-pro-item">
<view class="left">
<image mode="aspectFit" src="/images/home/bizi.png"></image>
</view>
<view class="right c11 bold">
<view class="f26 text2">日本进口 黛珂 (Cosme Decorte) 高妆水日本进口 黛珂 (Cosme Decorte) 高妆水...</view>
<view class="price">
<view class="f28">¥ 561.00</view>
<view class="f22 c88">x1</view>
</view>
</view>
</view>
<view class="sett-pro-item">
<view class="left">
<image mode="aspectFit" src="/images/home/chaozhi.png"></image>
</view>
<view class="right c11 bold">
<view class="f26 text2">日本进口 黛珂 (Cosme Decorte) 高妆水日本进口 黛珂 (Cosme Decorte) 高妆水...</view>
<view class="price">
<view class="f28">¥ 561.00</view>
<view class="f22 c88">x1</view>
</view>
</view>
</view>
<view class="sett-pro-item">
<view class="left">
<image mode="aspectFit" src="/images/home/demo2.jpg"></image>
</view>
<view class="right c11 bold">
<view class="f26 text2">日本进口 黛珂 (Cosme Decorte) 高妆水日本进口 黛珂 (Cosme Decorte) 高妆水...</view>
<view class="price">
<view class="f28">¥ 561.00</view>
<view class="f22 c88">x1</view>
</view>
</view>
</view>
</scroll-view>
<view class="peisong-allprice">
<view class="peisong">
<view class="f28 c11">配送方式 <text class="f24 c99">快递</text> </view>
<view class="f24 c11">免运费</view>
</view>
<view class="allprice">
<text class="f24 c99">共2件 </text>
<text class="f24 c11">小计: <text class="f30 cee">¥600.00</text></text>
</view>
</view>
<view class="Gray30"></view>
<view class="pay-way" bindtap="changePayway">
<view class="left">
<image src="/images/mine/wechat.png"></image>
<text class="f30 c11">微信支付</text>
</view>
<view class="right">
<view class="raduis" wx:if="{{!wxPay}}"></view>
<image src="/images/product/xuanzhong.png" wx:else></image>
</view>
</view>
<view class="tips f22 c99">点击支付则表示您同意 <text class="c11">《用户购买须知》</text></view>
<view class="pay-box">
<view class="f24">
总计: <text class="cee bold f30">¥600.00</text>
</view>
<view class="pay-btn f30 cff">
立即支付
</view>
</view>
</view>
\ No newline at end of file
.Settlement-scroll-view {
height: calc(100vh - 820rpx);
}
.Settlement-addr{
height: 190rpx;
padding: 30rpx;
}
.sar-info{
display: flex;
align-items: center;
}
.sar-info .text2{
flex: 2;
}
.sar-info image{
width: 28rpx;
height: 34rpx;
margin-right: 18rpx;
}
.sar-tit{
padding: 0 0 15rpx 46rpx;
}
.sar-tit text{
padding-left: 30rpx;
}
.edit-btn{
padding: 4rpx 18rpx;
color: #E21436;
border: 1px solid #E21436;
border-radius:28rpx;
margin-left: 24rpx;
}
.se-line{
height: 6rpx;
width: 100%;
}
.shenfenz{
display: flex;
padding: 30rpx;
justify-content: space-between;
align-items: center;
}
.sett-pro-item {
display: flex;
align-items: center;
padding: 30rpx 30rpx 0 30rpx;
}
.sett-pro-item .left{
width: 170rpx;
height: 170rpx;
display: flex;
justify-content: center;
align-items: center;
margin-right: 18rpx;
}
.sett-pro-item .left image{
max-height: 150rpx;
}
.sett-pro-item .right{
flex: 2;
}
.sett-pro-item .right .price{
display: flex;
justify-content: space-between;
align-content: center;
margin-top: 50rpx;
}
.peisong-allprice{
padding: 0 30rpx 30rpx 30rpx;
}
.peisong{
display: flex;
justify-content: space-between;
}
.allprice {
text-align: right;
}
.pay-way{
display: flex;
align-content: center;
justify-content: space-between;
padding: 25rpx 30rpx;
}
.pay-way view.left image {
width: 30rpx;
height: 30rpx;
margin-right: 30rpx;
}
.pay-way view.right{
display: flex;
justify-content: center;
align-items: center;
}
.pay-way view.right image {
width: 36rpx;
height: 36rpx;
}
.pay-way .raduis {
width: 36rpx;
height: 36rpx;
background: rgba(255,255,255,1);
border: 2px solid rgba(159, 160, 164, 1);
border-radius: 50%;
}
.Settlement .tips{
padding: 20rpx 30rpx;
background-color: #F4F4F4;
}
.pay-box{
width: 100%;
height: 100rpx;
position: fixed;
bottom: 0;
left: 0;
background-color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 30rpx;
}
.pay-btn {
width: 220rpx;
height: 70rpx;
background: linear-gradient(90deg,rgba(226,20,54,1),rgba(253,78,107,1));
border-radius: 35rpx;
color: white;
line-height: 70rpx;
text-align: center;
}
// pages/Product/classify/classify.js
let app = getApp();
Page({
/**
......@@ -6,49 +6,56 @@ Page({
*/
data: {
active: 0,
classList: [
{
name: '护肤'
},
{
name: '彩妆'
},
{
name: '个人护理'
},
{
name: '保健品'
},
{
name: '母婴'
},
{
name: '包包'
},
{
name: '家居'
},
{
name: '家电数码'
},
{
name: '服饰'
},
{
name: '美食'
},
{
name: '运动'
},
{
name: '轻奢'
}
]
classList: [],
classList2: [],
},
jumpPage: function (e) {
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: "/pages/Product/ProductList/ProductList?id=" + id,
})
},
changeleft: function (e){
let index = e.currentTarget.dataset.index
let Id = e.currentTarget.dataset.id
this.setData({
active: index
active: Id
})
this.getList2(Id)
},
getList2: function (id){
app.$api('Shop_post_GetCommodityCategoryList', {
Name: '',
ParentId: id,
}).then(res => {
console.log(res)
this.setData({
classList2: res
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
getList: function () {
app.$api('Shop_post_GetCommodityCategoryList', {
Name: '',
ParentId: 0,
}).then(res => {
console.log(res)
this.setData({
classList: res,
active: res[0].Id
})
this.getList2(res[0].Id)
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
/**
......@@ -69,7 +76,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getList()
},
/**
......
<view class="classify commonF">
<scroll-view class="left-scroll-view" scroll-y>
<view wx:for="{{classList}}" wx:key="index" class="class-left-item c00 f28 {{active===index ? 'active' : ''}}" bindtap="changeleft" data-index="{{index}}">
{{item.name}}
<view wx:for="{{classList}}" wx:key="index" class="class-left-item c00 f28 {{active===item.Id ? 'active' : ''}}" bindtap="changeleft" data-id="{{item.Id}}">
{{item.Name}}
</view>
</scroll-view>
<scroll-view class="right-scroll-view" scroll-y>
<view class="right-class-box">
<view class="right-tit">
<!-- <view class="right-tit">
<view class="f28 c00">热门分类</view>
<view>
<text class="f24 c99">查看更多</text><image src="/images/product/right.png"></image>
</view>
</view>
</view> -->
<view class="right-class-item-box">
<view class="right-class-item" >
<view class="img-box">
<image mode="widthFix" src="http://imgfile.oytour.com/Upload/DMC/20190910052706945.jpg"></image>
</view>
<view class="f26 c99 center item-name">洁面</view>
</view>
<view class="right-class-item" >
<view class="img-box">
<image mode="widthFix" src="http://imgfile.oytour.com/Upload/activity/20190614112541237.png"></image>
</view>
<view class="f26 c99 center item-name">洁面</view>
</view>
<view class="right-class-item" >
<view class="img-box">
<view class="right-class-item" wx:for="{{classList2}}" wx:key="index" data-id="{{item.Id}}" bindtap="jumpPage">
<!-- <view class="img-box">
<image mode="widthFix" src="http://imgfile.oytour.com/Upload/DMC/20190910052706945.jpg"></image>
</view>
<view class="f26 c99 center item-name">洁面</view>
</view>
<view class="right-class-item" >
<view class="img-box">
<image mode="widthFix" src="http://imgfile.oytour.com/Upload/DMC/20190910051612373.jpg"></image>
</view>
<view class="f26 c99 center item-name">洁面</view>
</view>
<view class="right-class-item" >
<view class="img-box">
<image mode="widthFix" src="http://imgfile.oytour.com/Upload/DMC/20190910052706945.jpg"></image>
</view>
<view class="f26 c99 center item-name">洁面</view>
</view>
<view class="right-class-item" >
<view class="img-box">
<image mode="widthFix" src="http://imgfile.oytour.com/Upload/activity/20190614112541237.png"></image>
</view>
<view class="f26 c99 center item-name">洁面</view>
</view>
<view class="right-class-item" >
<view class="img-box">
<image mode="widthFix" src="http://imgfile.oytour.com/Upload/DMC/20190910051612373.jpg"></image>
</view>
<view class="f26 c99 center item-name">洁面</view>
</view>
<view class="right-class-item" >
<view class="img-box">
<image mode="widthFix" src="http://imgfile.oytour.com/Upload/DMC/20190910052706945.jpg"></image>
</view>
<view class="f26 c99 center item-name">洁面</view>
</view> -->
<view class="f26 c99 center item-name">{{item.Name}}</view>
</view>
</view>
<view class="right-tit bt1e9">
<!-- <view class="right-tit bt1e9">
<view class="f28 c00">人气品牌</view>
<view>
<text class="f24 c99">查看更多</text><image src="/images/product/right.png"></image>
......@@ -99,7 +57,7 @@
</view>
<view class="f26 c99 center item-name">珂润</view>
</view>
</view>
</view> -->
</view>
</scroll-view>
</view>
\ No newline at end of file
......@@ -6,6 +6,7 @@
.classify .left-scroll-view{
width: 25%;
height: 100%;
padding-top: 20rpx;
}
.classify .right-scroll-view{
width: 75%;
......@@ -40,13 +41,14 @@
.right-class-item{
width: 33.33%;
text-align: center;
height: 90rpx;
}
.right-class-item image{
max-width: 80%;
max-height: 90rpx;
}
.item-name{
padding-bottom: 24rpx;
padding: 24rpx 0;
}
.img-box{
height: 140rpx;
......@@ -54,4 +56,8 @@
display: flex;
align-items: center;
justify-content: center;
}
.right-class-box{
height: calc(100vh);
background-color: white;
}
\ No newline at end of file
// pages/ShoppingCart/ShoppingCart.js
let app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
dataList: [
{
id: 1,
name: "日本珂润(Curel)润浸保湿洁颜泡沫 150ml(补水保湿洁面乳 不刺激 深层清洁...",
shuifei: 5,
price: 28,
number: 1,
guige: "单瓶",
select: false,
image: "http://imgfile.oytour.com/Upload/DMC/20190910051612373.jpg",
right: 0,
}, {
id: 2,
name: "日本珂润(Curel)润浸保湿洁颜泡沫 150ml(补水保湿洁面乳 不刺激 深层清洁...",
shuifei: 5,
price: 28,
number: 1,
guige: "单瓶",
select: false,
image: "https://gss2.bdstatic.com/9fo3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike80%2C5%2C5%2C80%2C26/sign=48566c781e178a82da3177f2976a18e8/902397dda144ad3493f21133d0a20cf431ad8531.jpg",
right: 0,
}, {
id: 3,
name: "日本珂润(Curel)润浸保湿洁颜泡沫 150ml(补水保湿洁面乳 不刺激 深层清洁...",
shuifei: 5,
price: 28,
number: 1,
guige: "箱",
select: false,
image: "http://imgfile.oytour.com/Upload/DMC/20190910051612373.jpg",
right: 0,
}, {
id: 4,
name: "日本珂润(Curel)润浸保湿洁颜泡沫 150ml(补水保湿洁面乳 不刺激 深层清洁...",
shuifei: 5,
price: 28,
number: 1,
guige: "单瓶",
select: false,
image: "https://gss2.bdstatic.com/9fo3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike80%2C5%2C5%2C80%2C26/sign=48566c781e178a82da3177f2976a18e8/902397dda144ad3493f21133d0a20cf431ad8531.jpg",
right: 0,
}, {
id: 4,
name: "日本珂润(Curel)润浸保湿洁颜泡沫 150ml(补水保湿洁面乳 不刺激 深层清洁...",
shuifei: 5,
price: 28,
number: 1,
guige: "单瓶",
select: false,
image: "https://gss2.bdstatic.com/9fo3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike80%2C5%2C5%2C80%2C26/sign=48566c781e178a82da3177f2976a18e8/902397dda144ad3493f21133d0a20cf431ad8531.jpg",
right: 0,
},
],
dataList: [],
delBtnWidth: 160,
isScroll: true,
selectAll: false,
allMoney: 0,
allShuiMoney: 0,
selectNum: 0,
msg: {
pageIndex: 1,
pageSize: 10,
CustomerId: 0,
GuestId: app.state.admin.id,
}
},
submit: function (){
console.log(1111)
wx.navigateTo({
url: '/pages/Product/Settlement/Settlement',
})
},
checkAll: function (){
let selectAll = this.data.selectAll
......@@ -80,10 +36,15 @@ Page({
})
if (!selectAll) {
this.calculationPrice()
} else {
this.setData({
allMoney: 0,
allShuiMoney: 0,
})
}
},
regNumber: function (e) {
this.data.dataList[e.currentTarget.dataset.index].number = e.detail.value * 1
this.data.dataList[e.currentTarget.dataset.index].ShopNum = e.detail.value * 1
this.setData({
dataList: this.data.dataList
})
......@@ -93,12 +54,12 @@ Page({
let index = e.currentTarget.dataset.index;
let dataList = this.data.dataList
if (type == 1) {
dataList[index].number = dataList[index].number === 1 ? 1 : dataList[index].number - 1
dataList[index].ShopNum = dataList[index].ShopNum === 1 ? 1 : dataList[index].ShopNum - 1
this.setData({
dataList: dataList
})
} else {
dataList[index].number = dataList[index].number + 1
dataList[index].ShopNum = dataList[index].ShopNum + 1
this.setData({
dataList: dataList
})
......@@ -112,8 +73,8 @@ Page({
this.data.dataList.map(x => {
if (x.select) {
selectNum += 1;
allShuiMoney += x.shuifei * x.number;
allMoney += x.price * x.number;
// allShuiMoney += x.shuifei * x.ShopNum;
allMoney += x.SellPrice * x.ShopNum;
}
})
this.setData({
......@@ -195,7 +156,77 @@ Page({
},
delItem: function (e) {
let id = e.currentTarget.dataset.id;
let _this = this;
wx.showModal({
title: '提示',
content: '是否删除?删除后不可恢复!',
success(res) {
if (res.confirm) {
app.$api('Shop_post_DelCommodityShopInfo', {
CommodityId: id,
GuestId: app.state.admin.id
}).then(res => {
wx.showToast({
title: '删除成功',
icon: 'none',
duration: 2000
})
_this.getList()
_this.calculationPrice()
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
} else if (res.cancel) {
}
}
})
},
getList: function (type) {
if (this.data.pageIndex >= this.data.totalPage && type) {
return
}
app.$api('Shop_post_GetCommodityShopPageList', this.data.msg).then(res => {
console.log(res)
let arr = this.data.dataList;
let arr2 = []
res.pageData.map(x=>{
x.select = false;
x.right = 0;
arr2.push(x)
});
if (type) {
for (let i = 0; i < arr2.length; i++) {
arr.push(arr2[i])
}
} else {
arr = arr2
}
console.log(arr)
this.setData({
dataList: arr,
totalPage: res.pageCount ? res.pageCount : 1,
pageIndex: res.pageIndex ? res.pageIndex : 1,
})
wx.hideLoading()
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
scrollGetMore: function () {
this.setData({
'msg.pageIndex': this.data.pageIndex + 1,
})
this.getList(1)
},
/**
* 生命周期函数--监听页面加载
......@@ -215,7 +246,10 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
wx.showLoading({
title: '加载中',
});
this.getList()
},
/**
......
......@@ -2,7 +2,7 @@
<view class="zonghe f24 c11">
共{{dataList.length}}件宝贝
</view>
<scroll-view class="ShoppingCart-scroll-view" scroll-y>
<scroll-view class="ShoppingCart-scroll-view" scroll-y bindscrolltolower="scrollGetMore">
<view class="ShoppingCart-item bb1e9" wx:for="{{dataList}}" wx:key="index" data-index="{{index}}" bindtouchstart="drawStart" bindtouchmove="drawMove" bindtouchend="drawEnd" style="right:{{item.right}}rpx">
<view class="check-box" data-index="{{index}}" bindtap="selectItem">
<view wx:if="{{!item.select}}" class="raduis"></view>
......@@ -10,28 +10,28 @@
</view>
<view class="ShoppingCart-item-info " data-index="{{index}}" bindtap="selectItem">
<view class="img-box">
<image mode="widthFix" src="{{item.image}}"></image>
<image mode="widthFix" src="{{item.FlowImgList[0]}}"></image>
</view>
<view class="ShoppingCart-item-info-r">
<view class="f24 c11 text2">{{item.name}}</view>
<view class="sit-guige">
<view class="f24 c11 text2">{{item.Name}}</view>
<!-- <view class="sit-guige">
<view class="f20 c99">税费预计:¥{{item.shuifei}}</view>
<view class="f20 c11">{{item.guige}}</view>
</view>
</view> -->
<view class="sit-pirce">
<view class="left-price">
<view class="f20 cee">¥</view>
<view class="f30 cee bold">{{item.price}}</view>
<view class="f30 cee bold">{{item.SellPrice}}</view>
</view>
<view class="sit-pirce-count">
<text class="bold f30" catchtap="calculation" data-type="1" data-index="{{index}}">-</text>
<input type="number" value="{{item.number}}" data-index="{{index}}" catchtap bindinput="regNumber"></input>
<input type="number" value="{{item.ShopNum}}" data-index="{{index}}" catchtap bindinput="regNumber"></input>
<text class="bold f30" catchtap="calculation" data-type="2" data-index="{{index}}">+</text>
</view>
</view>
</view>
</view>
<view class="remove" bindtap="delItem">删除 </view>
<view class="remove" bindtap="delItem" data-id="{{item.Id}}">删除 </view>
</view>
</scroll-view>
<view class="btn-info-box">
......@@ -41,8 +41,8 @@
<view class="check-box-text">全选</view>
</view>
<view class="info-price">
<view class="f26 c11">合计(不含税): <text class="bold">¥{{allMoney}}</text></view>
<view class="f22 c33">商品税费: <text class="bold">¥{{allShuiMoney}}</text></view>
<view class="f26 c11">合计: <text class="bold">¥{{allMoney}}</text></view>
<!-- <view class="f22 c33">商品税费: <text class="bold">¥{{allShuiMoney}}</text></view> -->
</view>
<view class="btn-info-box-btn">
<view wx:if="{{selectNum}}" class="f30 cff submit" bindtap="submit">去结算({{selectNum}})</view>
......
......@@ -39,6 +39,7 @@
margin-left: 30rpx;
flex: 2;
display: flex;
align-items: center;
}
.ShoppingCart-scroll-view .ShoppingCart-item .img-box{
height: 170rpx;
......@@ -54,6 +55,10 @@
.ShoppingCart-item-info-r{
flex: 2;
}
.ShoppingCart-item-info-r> view:nth-child(1){
height: 60rpx;
margin-bottom: 20rpx;
}
.sit-guige{
display: flex;
justify-content: space-between;
......@@ -107,7 +112,7 @@
.btn-info-box-btn view{
padding: 21rpx 48rpx;
background-color: rgb(192, 192, 192);
border-radius:35rpx;
border-radius:35px;
text-align: center;
}
.btn-info-box-btn view.submit{
......
......@@ -7,7 +7,12 @@ Page({
data: {
},
jumpPage: function(e){
let url = e.currentTarget.dataset.url
wx.navigateTo({
url: url,
})
},
/**
* 生命周期函数--监听页面加载
*/
......
......@@ -15,30 +15,30 @@
<view class="order-box">
<view class="order-box-tit">
<view class="c30 c11 bold">我的订单</view>
<view>
<view bindtap="jumpPage" data-url="/pages/mine/mineOrder/mineOrder">
<text class="f24 c99">查看更多</text><image src="/images/product/right.png"></image>
</view>
</view>
<view class="order-type">
<view>
<view bindtap="jumpPage" data-url="/pages/mine/mineOrder/mineOrder?type=1">
<view>
<image src="/images/mine/qianbao.png"></image>
</view>
<view>待付款</view>
</view>
<view>
<view bindtap="jumpPage" data-url="/pages/mine/mineOrder/mineOrder?type=2">
<view>
<image src="/images/mine/baoguo.png"></image>
</view>
<view>待发货</view>
</view>
<view>
<view bindtap="jumpPage" data-url="/pages/mine/mineOrder/mineOrder?type=3">
<view>
<image src="/images/mine/che.png"></image>
</view>
<view>待收货</view>
</view>
<view>
<view bindtap="jumpPage" data-url="/pages/mine/mineOrder/mineOrder?type=4">
<view>
<image src="/images/mine/wancheng.png"></image>
</view>
......@@ -48,7 +48,7 @@
</view>
<view class="Gray30"></view>
<view class="gongneng">
<view class="g-row bb1e9">
<view class="g-row bb1e9" bindtap="jumpPage" data-url="/pages/mine/mineAddrList/mineAddrList">
<view class="g-row-left">
<image mode='widthFix' class="icon-img" src="/images/mine/dingwei.png"></image>
<text>收货地址</text>
......
let app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
msg: {
Id: 0,
GuestProvince: '',
GuestCity: '',
GuestDistrictCounty: '',
DetaileAddress: '',
LinkMan: '',
LinkTel: '',
IsDefault: '',
GuestAccountId: app.state.admin.id
},
province: '',
city: '',
county: '',
switch1Checked: false
},
switch1Change: function (e){
console.log(e)
this.setData({
switch1Checked: e.detail.value
})
},
seveMsg: function () {
if (!this.data.msg.LinkMan){
wx.showToast({
title: '请填写收货人',
icon: 'none',
duration: 1000
})
return
}
if (!this.data.msg.LinkTel) {
wx.showToast({
title: '请填写手机号',
icon: 'none',
duration: 1000
})
return
}
if (!this.data.msg.GuestDistrictCounty) {
wx.showToast({
title: '请选择所在地区',
icon: 'none',
duration: 1000
})
return
}
if (!this.data.msg.DetaileAddress) {
wx.showToast({
title: '请填写详细地址',
icon: 'none',
duration: 1000
})
return
}
this.data.msg.IsDefault = this.data.switch1Checked ? 1 : 0
app.$api('ShopGuest_post_SetGuestAddressService', this.data.msg).then(res => {
wx.showToast({
title: '保存成功',
icon: 'none',
duration: 1000
})
setTimeout(() => {
wx.navigateBack({
delta: 1
})
}, 1000)
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
regionChange: function (e) {
console.log(e)
this.setData({
province: e.detail.province,
city: e.detail.city,
county: e.detail.county,
'msg.GuestProvince': e.detail.province,
'msg.GuestCity': e.detail.city,
'msg.GuestDistrictCounty': e.detail.county,
});
},
inputName: function (e) {
console.log(e)
let id = e.target.id,
value = e.detail.value;
if (id == 'name') {
this.setData({
'msg.LinkMan': value
})
} else if (id == 'phone') {
this.setData({
'msg.LinkTel': value
})
}else if (id == 'details') {
this.setData({
'msg.DetaileAddress': value
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let _this = this
if (options.edit) {
wx.getStorage({
key: 'addrEdit',
success(res) {
let r = res.data;
_this.setData({
'msg.Id': r.Id,
'msg.GuestProvince': r.GuestProvince,
'msg.GuestCity': r.GuestCity,
'msg.GuestDistrictCounty': r.GuestDistrictCounty,
'msg.DetaileAddress': r.DetaileAddress,
'msg.LinkMan': r.LinkMan,
'msg.LinkTel': r.LinkTel,
'msg.IsDefault': r.IsDefault,
province: res.data.GuestProvince,
city: res.data.GuestCity,
county: res.data.GuestDistrictCounty,
switch1Checked: r.IsDefault ? true : false
})
console.log(_this.data.msg)
}
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
//修改title
wx.setNavigationBarTitle({
title: '修改收货地址'
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {
"region-picker": "../../../component/region-picker/region-picker"
}
}
\ No newline at end of file
<view class='edit mineAddrEdit commonF'>
<view class="mineAddrEdit-info">
<view class='edit-item'>
<text class="f24 c33">收货人</text>
<view class="c11">
<input bindinput='inputName' id="name" placeholder='请填写收货人' value='{{msg.LinkMan}}'></input>
</view>
</view>
<view class='edit-item'>
<text class="f24 c33">手机号码</text>
<view class="c11">
<input bindinput='inputName' id="phone" placeholder='请输入手机号码' value='{{msg.LinkTel}}'></input>
</view>
</view>
<view class='edit-item section-box'>
<text class="f24 c33">所在地区</text>
<view class="c11">
<region-picker bind:change="regionChange" province="{{province}}" city="{{city}}" county="{{county}}"></region-picker>
</view>
</view>
<view class='edit-item'>
<text class="f24 c33">详细地址</text>
<view class="c11">
<input bindinput='inputName' id="details" placeholder='详细地址:如街道、门牌号和小区单元等' value='{{msg.DetaileAddress}}'></input>
</view>
</view>
<view class='edit-item switch'>
<view class="c33">
<view class="f24">设置默认地址</view>
<view class="f20">提醒:每次下单会默认推荐使用该地址</view>
</view>
<view>
<switch color="#E21436" checked="{{switch1Checked}}" bindchange="switch1Change"/>
</view>
</view>
</view>
<view class='save-btn cff' bindtap='seveMsg'>
保存
</view>
</view>
\ No newline at end of file
page {
width: 100%;
height: 100VH;
background:#f8f5f5;
overflow: hidden;
}
.edit{
font-size: 28rpx;
color: #999999;
padding: 40rpx 0;
}
.edit .edit-item{
padding: 34rpx 28rpx;
border-bottom: 1px solid #E8E8E8;
display: flex;
align-content: center;
}
.edit .edit-item>text{
width: 125rpx;
}
.edit .edit-item>view.c11{
flex: 2
}
input{
width: 100%;
}
.save-btn{
position: fixed;
left: 30rpx;
bottom: 30rpx;
width: calc(100vw - 60rpx);
padding: 23rpx 0;
display: flex;
justify-content: center;
align-items: center;
height: 74rpx;
background:linear-gradient(90deg,rgba(226,20,54,1),rgba(253,78,107,1));
border-radius:37rpx;
}
.section-box{
display: flex;
}
.mineAddrEdit-info{
height: calc(100vh - 100rpx);
}
.edit-item.switch{
display: flex;
justify-content: space-between;
align-items: center;
}
.edit-item.switch switch{
height: 56rpx;
zoom: .8;
}
\ No newline at end of file
let app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
dataList: [],
delBtnWidth: 160,
isScroll: true,
selectAll: false,
},
jumpPage: function (e){
let url = "/pages/mine/mineAddrEdit/mineAddrEdit"
if (e.currentTarget.dataset.index >= 0) {
url = url + '?edit=1'
let _this = this;
wx.setStorage({
key: "addrEdit",
data: _this.data.dataList[e.currentTarget.dataset.index]
})
}
wx.navigateTo({
url: url,
})
},
getList: function(){
app.$api('ShopGuest_get_GetGuestAddressListService', {
GuestAccountId: app.state.admin.id
}).then(res => {
let list = [];
res.map(x=>{
x.right = 0
list.push(x)
})
this.setData({
dataList: list
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
},
drawStart: function (e) {
this.data.dataList.map((x, index) => {
if (index !== e.currentTarget.dataset.index * 1 || (index === e.currentTarget.dataset.index * 1 && x.right === 160)) {
x.right = 0
}
})
var touch = e.touches[0]
for (var index in this.data.data) {
var item = this.data.dataList[index]
item.right = 0
}
this.setData({
dataList: this.data.dataList,
startX: touch.clientX,
})
},
drawMove: function (e) {
var touch = e.touches[0]
var item = this.data.dataList[e.currentTarget.dataset.index]
var disX = this.data.startX - touch.clientX
if (disX >= 20) {
if (disX > this.data.delBtnWidth) {
disX = this.data.delBtnWidth
}
item.right = disX
this.setData({
isScroll: false,
dataList: this.data.dataList
})
} else {
item.right = 0
this.setData({
isScroll: true,
dataList: this.data.dataList
})
}
},
drawEnd: function (e) {
var item = this.data.dataList[e.currentTarget.dataset.index]
if (item.right >= this.data.delBtnWidth / 2) {
item.right = this.data.delBtnWidth
this.setData({
isScroll: true,
dataList: this.data.dataList,
})
} else {
item.right = 0
this.setData({
isScroll: true,
dataList: this.data.dataList,
})
}
},
delItem: function (e) {
let id = e.currentTarget.dataset.id;
let _this = this;
wx.showModal({
title: '提示',
content: '是否删除?删除后不可恢复!',
success(res) {
if (res.confirm) {
app.$api('ShopGuest_post_RemoveGuestAddressService', {
Id: id
}).then(res => {
wx.showToast({
title: '删除成功',
icon: 'none',
duration: 2000
})
_this.getList()
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000
})
})
} else if (res.cancel) {
}
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
title: '收货地址'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="mineAddrList commonF">
<scroll-view class="add-list">
<view class="add-item" wx:for="{{dataList}}" wx:key="index" data-index="{{index}}" bindtouchstart="drawStart" bindtouchmove="drawMove" bindtouchend="drawEnd" style="right:{{item.right}}rpx">
<view class="top f28 c11">
<text>{{item.LinkMan}}</text>
<text>{{item.LinkTel}}</text>
<text class="f18 cff" wx:if="{{item.IsDefault === 1}}">默认</text>
</view>
<view class="bottom">
<view class="f22 c29 text2 felx2">{{item.DetaileAddress}}</view>
<image src="/images/mine/edit.png" data-index="{{index}}" bindtap="jumpPage"></image>
</view>
<view class="remove" bindtap="delItem" data-id="{{item.Id}}">删除 </view>
</view>
<view wx:if="{{dataList.length < 1}}" class="f26 c88 center">
暂无收货地址
</view>
</scroll-view>
<view class="add-btn cff f30" bindtap="jumpPage">
<image src="/images/mine/add.png"></image>
<text>新建收货地址</text>
</view>
</view>
\ No newline at end of file
.mineAddrList {
height: calc(100vh);
padding: 30rpx;
background-color: #F7F7F7;
}
.mineAddrList .add-list{
height: calc(100vh - 134rpx);
}
.add-item{
padding: 30rpx;
background:rgba(255,255,255,1);
box-shadow:0px 4px 5px 1px rgba(76,76,76,0.05);
border-radius:16px;
margin-bottom: 30rpx;
position: relative;
transition: all linear .2s;
}
.add-item .top{
display: flex;
align-items: center;
}
.add-item .top text:nth-child(1){
width: 140rpx;
display: inline-block;
}
.add-item .top text:nth-child(2){
padding: 0 13rpx 0 48rpx;
}
.add-item .top text:nth-child(3){
padding: 3rpx 7rpx;
background: linear-gradient(90deg,rgba(226,20,54,1),rgba(253,78,107,1));
border-radius: 4rpx;
}
.add-item .bottom{
display: flex;
}
.add-item .bottom image{
width: 24rpx;
height: 24rpx;
margin: 10rpx 0 0 40rpx;
}
.add-btn{
position: fixed;
left: 30rpx;
bottom: 30rpx;
width: calc(100vw - 60rpx);
padding: 23rpx 0;
display: flex;
justify-content: center;
align-items: center;
height: 74rpx;
background:linear-gradient(90deg,rgba(226,20,54,1),rgba(253,78,107,1));
border-radius:37rpx;
}
.add-btn image{
width: 22rpx;
height: 22rpx;
margin-right: 10rpx;
}
.remove{
width: 160rpx;
height: 100%;
background-color: red;
color: white;
position: absolute;
top: 0;
right: -160rpx;
display: flex;
justify-content: center;
align-items: center;
}
\ No newline at end of file
// pages/mine/mineOrder/mineOrder.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
wx.setNavigationBarTitle({
title: '我的订单'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="mineOrder commonF">
</view>
\ No newline at end of file
/* pages/mine/mineOrder/mineOrder.wxss */
\ No newline at end of file
......@@ -82,6 +82,28 @@
"id": -1,
"name": "购物车",
"pathName": "pages/ShoppingCart/ShoppingCart",
"query": "",
"scene": null
},
{
"id": -1,
"name": "下订单",
"pathName": "pages/Product/Settlement/Settlement",
"query": "",
"scene": null
},
{
"id": -1,
"name": "收货地址",
"pathName": "pages/mine/mineAddrList/mineAddrList",
"query": "",
"scene": null
},
{
"id": -1,
"name": "新增收货地址",
"pathName": "pages/mine/mineAddrEdit/mineAddrEdit",
"query": "",
"scene": null
}
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment