diff --git a/app.js b/app.js
index 501454a..08e0a74 100644
--- a/app.js
+++ b/app.js
@@ -21,7 +21,7 @@ App({
unique_key: "wechatxcx"
}).then(res => {
let data = JSON.parse(res.data);
- data.isTest = data.isTest131? true : false;
+ data.isTest = data.isTest132? true : false;
this.globalData.configJson = data
}).then(() => {
// 获取ui配置文件
diff --git a/app.json b/app.json
index 1326c78..340cb02 100644
--- a/app.json
+++ b/app.json
@@ -192,7 +192,8 @@
"index/index",
"techanNew/index",
"techanCart/index",
- "feiyiNew/index"
+ "feiyiNew/index",
+ "postSearch/index"
]
}],
"plugins": {
diff --git a/pages/component/SearchHeader.js b/pages/component/SearchHeader.js
index 642f934..de84749 100644
--- a/pages/component/SearchHeader.js
+++ b/pages/component/SearchHeader.js
@@ -79,6 +79,11 @@ Component({
// wx.uma.trackEvent(this.properties.focusclickid);
// }
},
+ // inputFocus1:function(){
+ // wx.navigateTo({
+ // url: '/subPackages/postSearch/index',
+ // })
+ // },
searchInput:function(e){
this.setData({
keywords:e.detail.value
diff --git a/pages/component/SearchHeader.wxml b/pages/component/SearchHeader.wxml
index 8d84ec0..53f0f6e 100644
--- a/pages/component/SearchHeader.wxml
+++ b/pages/component/SearchHeader.wxml
@@ -3,7 +3,8 @@
-
+
+
|
搜索
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 3c8263c..4ae93c2 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -60,7 +60,7 @@
-
+
非遗专卖
@@ -76,7 +76,7 @@
剧场演出
-
+
文创特产
@@ -173,6 +173,7 @@
+
@@ -233,7 +234,7 @@
数字博物馆
-
+
数字名人馆
@@ -261,7 +262,7 @@
书仓
-
+
e读书
@@ -280,7 +281,7 @@
书仓
-->
-
+
云游苏州
diff --git a/pages/info/postProductInfo/index.js b/pages/info/postProductInfo/index.js
index 45b358c..2ce7d62 100644
--- a/pages/info/postProductInfo/index.js
+++ b/pages/info/postProductInfo/index.js
@@ -340,9 +340,18 @@ Page({
url: '/pages/order/postOrder/index',
})
} else {
+ let tag_id = this.data.info.tag_id,type = ''
+ if (tag_id.includes(20) || tag_id.includes(19)) { //文创
+ type = '1'
+ }else if (tag_id.includes(5)) { //非遗
+ type = '2'
+ }else {
+ type = ''
+ }
commonApi.user_post("cart/add_sku", {
sku_id: this.data.info.sku[this.data.skuIndex].id,
- num: this.data.producNum
+ num: this.data.producNum,
+ type:type
}).then(res => {
if (res.code == 1) {
commonApi.user_post('cart/get_list', {}).then(res => {
diff --git a/subPackages/feiyiNew/index.js b/subPackages/feiyiNew/index.js
index 63e22d3..d7c40cb 100644
--- a/subPackages/feiyiNew/index.js
+++ b/subPackages/feiyiNew/index.js
@@ -10,11 +10,25 @@ Page({
* 页面的初始数据
*/
data: {
+ height: 90,
+ padHeight:0,
+ right:0,
list:[], //获取的产品列表
total:1, //总数
keywords:"", //搜索关键字
navIndex:0, //一级分类选中下标
- navList:['列表样式','宫格样式'],
+ navList:[
+ {
+ title:'列表样式',
+ icon:'https://static.ticket.sz-trip.com/uploads/20240715/1cb81757944dd8523f3786195969266c.png',
+ seldIcon:'https://static.ticket.sz-trip.com/uploads/20240710/62bb38d5f88754e57447a26b14176aa2.png'
+ },
+ {
+ title:'宫格样式',
+ icon:'https://static.ticket.sz-trip.com/uploads/20240717/eebe3e2345a8adb2668bc34cb28cee74.png',
+ seldIcon:'https://static.ticket.sz-trip.com/uploads/20240717/b3e9136ecb05bedcd9d3f59ee4399b62.png'
+ }
+ ],
flag:true, //切换样式,true按分类,false按店铺展示
typeList:[], //左侧的二级分类
typeIndex:0, //二级分类选中下标
@@ -29,13 +43,15 @@ Page({
allSelectedBtn:false, //全选按钮
seachFlag:false, //搜索模式
totalPrice:0, //获取购物车总价
- name:'非遗专卖'
+ name:'非遗专卖',
+ nowAddListId:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
+ app.globalData.nowAddListId = []
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
@@ -59,7 +75,8 @@ Page({
icon: "success"
})
this.setData({
- allSelectedBtn:false
+ allSelectedBtn:false,
+ totalPrice:0
})
this.getCount()
}
@@ -124,6 +141,12 @@ Page({
type:"2"
}).then(res => {
if (res.code == 1) {
+ let sku_id = this.data.showPopup ? item.sku.id :this.data.info.sku[this.data.skuIndex].id
+ let _nowAddListId = this.data.nowAddListId
+ _nowAddListId.push(sku_id)
+ this.setData({
+ nowAddListId: _nowAddListId
+ })
commonApi.user_post('cart_within/get_list', {
type:'2'
}).then(res => {
@@ -134,7 +157,7 @@ Page({
// debugger
if (!this.data.skuFlag && !this.data.showPopup) {
// debugger
- if (val.sku.id == this.data.info.sku[this.data.skuIndex].id) {
+ if (this.data.nowAddListId.includes(val.sku.id)) {
val.selected = 1
}
}else {
@@ -236,10 +259,10 @@ Page({
}
})
if (product.length == 0 && product1.length == 0) {
- wx.showToast({
- title: '请先选择产品',
- icon: 'none'
- })
+ // wx.showToast({
+ // title: '请先选择产品',
+ // icon: 'none'
+ // })
return;
}
if (product.length > 0 && product1.length > 0) {
@@ -272,10 +295,12 @@ Page({
allSelected() {
let gwcList = this.data.gwcList
let totalPrice = 0
+ let nowAddListId = []
if (this.data.allSelectedBtn) {
gwcList.forEach(item=> {
item.selected =0
})
+ nowAddListId = []
} else {
gwcList.forEach(item=> {
item.selected =1
@@ -283,16 +308,20 @@ Page({
gwcList.forEach(item=> {
totalPrice += Number(item.num*item.sku.price)
})
+ gwcList.forEach(item=> {
+ nowAddListId.push(item.sku_id)
+ })
}
this.setData({
gwcList,
allSelectedBtn:!this.data.allSelectedBtn,
- totalPrice
+ totalPrice,
+ nowAddListId
})
},
// 单选一个
selectedIt(e) {
- let item = e.currentTarget.dataset.item,gwcList= this.data.gwcList,totalPrice=0
+ let item = e.currentTarget.dataset.item,gwcList= this.data.gwcList,totalPrice=0,nowAddListId=[]
gwcList.forEach(el=> {
if (el.id == item.id) {
el.selected == 1 ? el.selected =0 : el.selected = 1
@@ -303,18 +332,27 @@ Page({
totalPrice += Number(el.num*el.sku.price)
}
})
+ gwcList.forEach(item=> {
+ if (item.selected == 1) {
+ nowAddListId.push(item.sku_id)
+ }
+ })
let status = gwcList.every(el => el.selected === 1)
this.setData({
gwcList,
allSelectedBtn:status?true:false,
- totalPrice
+ totalPrice,
+ nowAddListId
})
},
// 左侧购物车打开弹窗
openPopup() {
// this.getCount()
let gwcList = this.data.gwcList
- let status = gwcList.every(el => el.selected === 1)
+ let status = false
+ if (gwcList.length>0) {
+ status = gwcList.every(el => el.selected === 1)
+ }
this.setData({
showPopup:!this.data.showPopup,
allSelectedBtn:status?true:false,
@@ -328,14 +366,20 @@ Page({
tag_id:5, //标签的ID
offset:list.length, //起始查询
limit:10, //查询数量
- title:this.data.keywords //搜索产品名称
+ title: this.data.seachFlag ? this.data.keywords : '' //搜索产品名称
}).then(res => {
+ let arr = []
+ if (this.data.seachFlag) {
+ res.data.list.map(obj => {
+ arr = [...arr, ...obj.product]
+ })
+ }
res.data.list.map(item=>{
item.display_tags = item.display_tags?item.display_tags.split(","):[];
item.display_tags = item.display_tags.splice(0,2);
})
this.setData({
- list:list.concat(res.data.list),
+ list:this.data.seachFlag?arr:list.concat(res.data.list),
total:res.data.total
})
})
@@ -356,20 +400,33 @@ Page({
commonApi.user_post('cart_within/get_list', {
type:'2'
}).then(res => {
- let arr = res.data,cartCount=0
- // let arr = res.data,totalPrice = 0,cartCount=0
+ let arr = res.data,totalPrice = 0,cartCount=0
if (arr.length>0) {
arr.forEach(item=> {
// totalPrice += item.num*item.sku.price
cartCount += item.num
})
}
- // console.log(totalPrice);
+ if (app.globalData.nowAddListId.length>0) {
+ arr.map(item=> {
+ app.globalData.nowAddListId.forEach(val=> {
+ if (val == item.sku_id) {
+ item.selected = 1
+ }
+ })
+ })
+ // debugger
+ arr.forEach(item=> {
+ if(item.selected == 1) {
+ totalPrice += item.num*item.sku.price
+ }
+ })
+ }
this.setData({
cartCount: cartCount, //1
gwcList:res.data,
- // totalPrice,
- allSelectedBtn:false
+ allSelectedBtn:false,
+ totalPrice:app.globalData.nowAddListId.length>0?totalPrice:0
})
})
},
@@ -384,6 +441,7 @@ Page({
seachFlag:false
})
this.getList()
+ this.getCount()
},
// 搜索
search:function(e){
@@ -394,7 +452,7 @@ Page({
list:[],
total:1
})
- this.onReload()
+ // this.onReload()
}else {
this.setData({
seachFlag:true,
@@ -402,7 +460,12 @@ Page({
list:[],
total:1
})
- this.getList();
+ // this.getList();
+ }
+ if (!this.data.navIndex == 0) {
+ this.getSupplierTag()
+ } else {
+ this.getList()
}
},
// 去产品详情页
@@ -477,7 +540,7 @@ Page({
tag_id:this.data.seachFlag? '5':this.data.typeList[this.data.typeIndex].id, //标签的ID
offset:list.length, //起始查询
limit: 10, //查询数量
- title:this.data.keywords, //搜索产品名称
+ title:this.data.seachFlag ? this.data.keywords : '', //搜索产品名称
}).then(res=>{
res.data.list.map(item=>{
item.display_tags = item.display_tags?item.display_tags.split(","):[];
@@ -587,18 +650,64 @@ Page({
producNum: this.data.producNum + 1
})
},
+ getHeight() {
+ let systemInfo = wx.getSystemInfoSync(),rect = wx.getMenuButtonBoundingClientRect();
+ let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height;
+ this.setData({
+ height:height,
+ padHeight:systemInfo.statusBarHeight,
+ right:(systemInfo.screenWidth - rect.right) + rect.width
+ })
+ console.log(systemInfo,rect)
+ },
+ back: function () {
+ if(this.properties.clickid){
+ wx.uma.trackEvent(this.properties.clickid);
+ }
+ const pages = getCurrentPages();
+ // wx.showTabBar({})
+ console.log(this.properties.isIndex)
+ if (pages.length<=1){
+ wx.switchTab({
+ url: app.globalData.menuRoute
+ })
+ }
+ else {
+ wx.navigateBack({
+ delta: 1
+ })
+ }
+ },
+ goNewSearch() {
+ wx.navigateTo({
+ // url: "/subPackages/postSearch/index?type_id=2",
+ url: '/subPackages/postSearch/index?type_id=2&ids='+this.data.nowAddListId,
+ })
+ },
+ // lower() {
+ // if (this.data.flag) {
+ // this.getList()
+ // } else {
+ // this.getSupplierTag()
+ // }
+ // },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
-
+ this.getHeight()
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
- this.onReload()
+ if (app.globalData.nowAddListId.length>0) {
+ this.getCount()
+ }else {
+ this.onReload()
+ }
+ this.getHeight()
// this.setData({
// list:[],
// total:1,
diff --git a/subPackages/feiyiNew/index.wxml b/subPackages/feiyiNew/index.wxml
index 4aeb1af..b0ca7c2 100644
--- a/subPackages/feiyiNew/index.wxml
+++ b/subPackages/feiyiNew/index.wxml
@@ -1,130 +1,146 @@
-
+
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
- {{item.name}}
+
+
+
+ {{item.name}}
+
-
-
-
-
-
-
-
-
-
-
- {{item}}
+
+
+
+
+
+
+
+
+
+
+ {{item.title}}
+
-
-
-
-
-
-
-
- {{item.title}}
-
-
-
- {{item.price/100}}
- ¥{{item.market_price/100}}
+
+
+
+
+
+
+ {{item.title}}
+
+
+
+ {{item.price/100}}
+ ¥{{item.market_price/100}}
+
+ +
- +
-
-
+
+
-
-
-
-
-
-
-
-
- {{item}}
+
+
+
+
+
+
+
+ {{item.title}}
+
-
-
-
-
-
-
-
- {{item.shop_name}}
-
-
- {{item}}
+
+
+
+
+
+
+ {{item.shop_name}}
+
+
+ {{item}}
+
+ ¥{{(item.start_price/100)}}起
+
+
+ {{item.address}}
+
+ 进店看看
+
+
- ¥{{(item.start_price/100)}}起
-
- {{item.address}}
-
- 进店看看
+
+
+
+ {{item.title}}
+ ¥{{(item.price/100)}}{{item.market_price/100}}
-
-
-
-
- {{item.title}}
- ¥{{(item.price/100)}}{{item.market_price/100}}
-
-
+
-
-
-
+
-
-
-
- {{item.title}}
-
-
-
- {{item.price/100}}
- {{item.market_price/100}}
+
+
+
+ {{item.title}}
+
+
+
+ {{item.price/100}}
+ {{item.market_price/100}}
+
+
-
-
@@ -147,14 +163,15 @@
总计:{{totalPrice/100}}
-
+
- 去结算
+ 去结算
+ 去结算
@@ -214,8 +231,8 @@
- {{item.product.title}}
- {{item.sku.sku_name}}
+ {{item.product.title}}
+ {{item.sku.sku_name}}
{{item.sku.price/100}}
diff --git a/subPackages/feiyiNew/index.wxss b/subPackages/feiyiNew/index.wxss
index 6004c32..2a0bd5b 100644
--- a/subPackages/feiyiNew/index.wxss
+++ b/subPackages/feiyiNew/index.wxss
@@ -64,6 +64,7 @@ page {
/* min-height: 100vh; */
/* min-height: 950rpx; */
background-color: #F3F3F3;
+ margin-top: 20rpx;
}
.type-two-box {
width: 200rpx;
@@ -138,14 +139,14 @@ page {
text-decoration-line: line-through;
}
.add {
- width: 40rpx;
- height: 40rpx;
+ width: 43rpx;
+ height: 43rpx;
background: #0B898E;
border-radius: 50%;
text-align: center;
line-height: 40rpx;
font-weight: 500;
- font-size: 31rpx;
+ font-size: 34rpx;
color: #FFFFFF;
}
.bottom {
@@ -281,7 +282,7 @@ page {
.supplier-info {
display: flex;
flex-direction: column;
- height: 136rpx;
+ /* height: 136rpx; */
justify-content:space-between;
flex: 1;
margin-right: 20.67rpx;
@@ -719,3 +720,60 @@ page {
.hot-list-item {
width: 337rpx;
}
+
+
+
+.title-box,.title-header{
+ background: #ffff;
+}
+.bg-box,.bg-box .title-header {
+ background: transparent;
+ color: #ccc;
+}
+
+.title-header {
+ position: fixed;
+ left: 0;
+ right: 0;
+ display: flex;
+ top: 0;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 32rpx;
+ line-height: 90rpx;
+ z-index: 2;
+}
+.title-header .icon-fanhui1 {
+ padding: 0 20rpx;
+ font-size: 44rpx;
+ color: #333;
+}
+.right {
+ position: absolute;
+ right: 20rpx;
+}
+.search-box {
+ display: flex;
+ align-items: center;
+ margin-left: 60rpx;
+ width: 560rpx;
+ border-radius: 30rpx;
+ height: 60rpx;
+ padding: 0 20rpx;
+ font-size: 26rpx;
+ background: #F0F0F0;
+}
+.bg-box .search-box {
+ background: #F0F0F0;
+}
+.search-box .weui-input {
+ margin-left: 10rpx;
+ flex: 1;
+ width: 100%;
+}
+.bg-box.title-box .icon-fanhui1 {
+ color: white;
+}
+.phcolor {
+ color: #ccc;
+}
diff --git a/subPackages/postSearch/index.js b/subPackages/postSearch/index.js
new file mode 100644
index 0000000..55ce67b
--- /dev/null
+++ b/subPackages/postSearch/index.js
@@ -0,0 +1,582 @@
+// subPackages/xx/index.js
+import commonApi from "../../utils/https/common"
+import util from "../../utils/util"
+let app = getApp()
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ height: 90,
+ padHeight:0,
+ right:0,
+ type_id:'', //用来区别文创特产、非遗
+ tag_id:'',
+ list:[],
+ keywords:'',
+ skuFlag:null, //规格弹窗
+ info: null, //规格信息
+ skuIndex: 0, //默认选中第一个规格
+ producNum: 1,
+ cartCount:0,
+ showPopup:false, //购物车的弹窗
+ gwcList:[], //gwc里的产品数据
+ allSelectedBtn:false, //全选按钮
+ totalPrice:0, //获取购物车总价--打开购物车后勾选的产品价格
+ nowAddListId:[],
+ type:'', //购物车分类1文创,2非遗
+ show:false
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ console.log(options);
+ let id = '',type=''
+ if (options.type_id == '1') {
+ id = '20,19'
+ type='1'
+ } else {
+ id = '5'
+ type='2'
+ }
+ this.setData({
+ tag_id:id,
+ type,
+ nowAddListId:options.ids.split(',')
+ })
+ // this.getList()
+ this.getCount()
+ },
+
+ // 去产品详情页
+ goodsDetail(e){
+ wx.navigateTo({
+ url: '/pages/info/postProductInfo/index?id='+e.currentTarget.dataset.goods.id,
+ })
+ },
+ // 添加产品到购物车
+ addCart: function (e) {
+ let item = e.currentTarget.dataset.item
+ app.globalData.postProduct = []
+ app.globalData.list = []
+ commonApi.user_post("/product/checkStock", {
+ sku_id: this.data.showPopup ? item.sku.id : this.data.info.sku[this.data.skuIndex].id,
+ }).then(res => {
+ if (res && res.code != 1) {
+ return;
+ } else {
+ commonApi.user_post("cart_within/add_sku", {
+ sku_id: this.data.showPopup ? item.sku.id :this.data.info.sku[this.data.skuIndex].id,
+ num: this.data.producNum,
+ type:this.data.type
+ }).then(res => {
+ if (res.code == 1) {
+ let sku_id = this.data.showPopup ? item.sku.id :this.data.info.sku[this.data.skuIndex].id
+ let _nowAddListId = this.data.nowAddListId
+ // debugger
+ _nowAddListId.push(sku_id)
+ this.setData({
+ nowAddListId: _nowAddListId
+ })
+ commonApi.user_post('cart_within/get_list', {
+ type:this.data.type
+ }).then(res => {
+ // debugger
+ let cartCount = 0,totalPrice = 0,gwcList=this.data.gwcList
+ res.data.forEach(val=> {
+ cartCount+=val.num
+ console.log(this.data.skuFlag);
+ if (!this.data.skuFlag && !this.data.showPopup) {
+ console.log(this.data.nowAddListId)
+ if (this.data.nowAddListId.some(s => +s === +val.sku_id) ) {
+ val.selected = 1
+ }
+ }else {
+ gwcList.forEach(el=> {
+ if (el.id == val.id) {
+ val.selected = el.selected
+ }
+ })
+ }
+ })
+ res.data.forEach(element=> {
+ if (element.selected == 1) {
+ totalPrice += Number(element.num*element.sku.price)
+ }
+ })
+ console.log(res.data);
+ let status = res.data.every(el => el.selected === 1)
+ this.setData({
+ cartCount: cartCount,
+ totalPrice,
+ producNum:1,
+ gwcList:res.data,
+ allSelectedBtn:status?true:false,
+ })
+ })
+ // 加动效
+ this.setData({
+ skuFlag: null,
+ aniSkuIndex: this.data.skuIndex,
+ cartImgInfo: null
+ })
+ setTimeout(() => {
+ this.setData({
+ aniSkuIndex: -1
+ })
+ // wx.showModal({
+ // title: "提示",
+ // content: "去购物车结算?",
+ // success: function (res) {
+ // if (res.confirm) {
+ // wx.navigateTo({
+ // url: '/pages/user/cartlist/list',
+ // })
+ // }
+ // }
+ // })
+ }, 650)
+ }
+ })
+ }
+ })
+
+},
+ // 去结算
+ order: function () {
+ commonApi.user_post('wx/get_user_keep', {
+ jumpurl: '/pages/user/cartlist/list',
+ title: '购物车',
+ type: 'mini'
+ }).then(res => {
+ if (res.data.subscribe == 0) {
+ this.setData({
+ wxqrcode: res.data.qrcode,
+ showQrCode: true
+ })
+ } else {
+ app.globalData.couponInfo = null;
+ util.pagePoint({
+ event: 'cart_order'
+ }, 1)
+ let list = this.data.gwcList,
+ price = 0,
+ product = [],
+ product1 = []
+ list.map(item => {
+ if (item.selected == 1) {
+ // item.product.type="post";
+ if (item.product.type == 'post') {
+ product.push({
+ product: item.product,
+ sku: item.sku,
+ productNum: item.num
+ })
+ } else {
+ product1.push(item)
+ app.globalData.list = product1
+ }
+ if (item.product.type.includes('post')) {
+ this.data.productType = 'post'
+ }
+ }
+ })
+ if (product.length == 0 && product1.length == 0) {
+ // wx.showToast({
+ // title: '请先选择产品',
+ // icon: 'none'
+ // })
+ return;
+ }
+ if (product.length > 0 && product1.length > 0) {
+ this.setData({
+ flag: 'mix',
+ isCar: 'multiple'
+ })
+ }
+ if (product1.length > 1) {
+ this.setData({
+ isCar: 'multiple'
+ })
+ } else {
+ this.setData({
+ isCar: 'single'
+ })
+ }
+ console.log(product1);
+ app.globalData.postProduct = product;
+ if (app.globalData.list) {
+ app.globalData.product = app.globalData.list[app.globalData.index]
+ }
+ wx.navigateTo({
+ url: '/pages/order/postOrder/index?from=cart&flag=' + this.data.flag,
+ })
+ }
+ })
+},
+// 单选一个
+selectedIt(e) {
+ let item = e.currentTarget.dataset.item,gwcList= this.data.gwcList,totalPrice=0,nowAddListId=[]
+ gwcList.forEach(el=> {
+ if (el.id == item.id) {
+ el.selected == 1 ? el.selected =0 : el.selected = 1
+ }
+ })
+ gwcList.forEach(el=> {
+ if (el.selected == 1) {
+ totalPrice += Number(el.num*el.sku.price)
+ }
+ })
+ gwcList.forEach(item=> {
+ if (item.selected == 1) {
+ nowAddListId.push(item.sku_id)
+ }
+ })
+ let status = gwcList.every(el => el.selected === 1)
+ this.setData({
+ gwcList,
+ allSelectedBtn:status?true:false,
+ totalPrice,
+ nowAddListId
+ })
+},
+// 清空
+delAll() {
+ let ids = []
+ this.data.gwcList.forEach(item => {
+ ids.push(item.sku_id)
+ })
+ commonApi.user_post("cart_within/del_sku", {
+ sku_id: ids+'',
+ type:this.data.type
+ }).then(res => {
+ if (res.code == 1) {
+ wx.showToast({
+ title: '清空成功',
+ icon: "success"
+ })
+ this.setData({
+ totalPrice:0
+ })
+ this.getCount()
+ }
+ })
+},
+// 减少一个
+del(e) {
+ let item = e.currentTarget.dataset.item
+ let gwcList = this.data.gwcList
+ commonApi.user_post("cart_within/update_sku", {
+ num:item.num-1,
+ sku_id: item.sku_id,
+ type:this.data.type
+ }).then(res => {
+ if (res.code == 1) {
+ // this.getCount()
+ commonApi.user_post('cart_within/get_list', {
+ type:this.data.type
+ }).then(res => {
+ let arr = res.data,totalPrice = 0,cartCount=0
+ if (res.data.length>0) {
+ res.data.forEach(item=> {
+ // totalPrice += item.num*item.sku.price
+ cartCount += item.num
+ gwcList.forEach(el=> {
+ if (el.id == item.id) {
+ item.selected = el.selected
+ }
+ })
+ })
+ res.data.forEach(item=> {
+ if (item.selected ==1) {
+ totalPrice += item.num*item.sku.price
+ }
+ })
+ }
+ let status = res.data.every(el => el.selected === 1)
+ this.setData({
+ cartCount: cartCount, //1
+ gwcList:res.data,
+ allSelectedBtn:status?true:false,
+ totalPrice
+ })
+ })
+ }
+ })
+},
+// 全选
+allSelected() {
+ let gwcList = this.data.gwcList
+ let totalPrice = 0
+ let nowAddListId = []
+ if (this.data.allSelectedBtn) {
+ gwcList.forEach(item=> {
+ item.selected =0
+ })
+ nowAddListId = []
+ } else {
+ gwcList.forEach(item=> {
+ item.selected =1
+ })
+ gwcList.forEach(item=> {
+ totalPrice += Number(item.num*item.sku.price)
+ })
+ gwcList.forEach(item=> {
+ nowAddListId.push(item.sku_id)
+ })
+ }
+ this.setData({
+ gwcList,
+ allSelectedBtn:!this.data.allSelectedBtn,
+ totalPrice,
+ nowAddListId
+ })
+},
+// 左侧购物车打开弹窗
+openPopup() {
+ // this.getCount()
+ let gwcList = this.data.gwcList
+ let status = gwcList.every(el => el.selected === 1)
+ this.setData({
+ showPopup:!this.data.showPopup,
+ allSelectedBtn:status?true:false,
+ })
+},
+ // 获取历史购物车详情
+ getCount() {
+ commonApi.user_post('cart_within/get_list', {
+ type:this.data.type
+ }).then(res => {
+ let arr = res.data,totalPrice = 0,cartCount=0
+ if (arr.length>0) {
+ arr.forEach(item=> {
+ // totalPrice += item.num*item.sku.price
+ cartCount += item.num
+ })
+ }
+ arr.forEach(item=> {
+ if (this.data.nowAddListId.some(s => +s === +item.sku_id) ) {
+ item.selected = 1
+ }
+ })
+ arr.forEach(item=> {
+ if (item.selected == 1) {
+ totalPrice += item.num*item.sku.price
+ }
+ })
+ // console.log(arr);
+ // debugger
+ this.setData({
+ cartCount: cartCount, //1
+ gwcList:arr,
+ allSelectedBtn:false,
+ totalPrice
+ })
+ })
+ },
+ search() {
+ this.setData({
+ list:[]
+ })
+ this.getList()
+ },
+ searchInput(e) {
+ this.setData({
+ keywords:e.detail.value
+ })
+ },
+ getList() {
+ this.setData({
+ show:false
+ })
+ let list= this.data.list;
+ if (this.data.keywords == '' || this.data.keywords.indexOf(' ')!==-1) {
+ return
+ }
+ if(list.length>=this.data.total) return;
+ commonApi._post("product/get_product_by_tag",{
+ tag_id:this.data.tag_id, //标签的ID
+ offset:this.data.list.length, //起始查询
+ limit: 10, //查询数量
+ title:this.data.keywords.length>0 ? this.data.keywords : '', //搜索产品名称
+ }).then(res=>{
+ res.data.list.map(item=>{
+ item.display_tags = item.display_tags?item.display_tags.split(","):[];
+ item.display_tags = item.display_tags.splice(0,2);
+ })
+ this.setData({
+ list:list.concat(res.data.list),
+ show:true
+ })
+ console.log(this.data.list);
+ })
+ },
+ getHeight() {
+ let systemInfo = wx.getSystemInfoSync(),rect = wx.getMenuButtonBoundingClientRect();
+ let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height;
+ this.setData({
+ height:height,
+ padHeight:systemInfo.statusBarHeight,
+ right:(systemInfo.screenWidth - rect.right) + rect.width
+ })
+ console.log(systemInfo,rect)
+ },
+ back: function () {
+ if(this.properties.clickid){
+ wx.uma.trackEvent(this.properties.clickid);
+ }
+ const pages = getCurrentPages();
+ // wx.showTabBar({})
+ console.log(this.properties.isIndex)
+ if (pages.length<=1){
+ wx.switchTab({
+ url: app.globalData.menuRoute
+ })
+ }
+ else {
+ wx.navigateBack({
+ delta: 1
+ })
+ }
+ },
+ // 添加产品弹窗 1.首先获取到该产品下的规格
+ addBuyCart(e) {
+ let item = e.currentTarget.dataset.item
+ console.log(item);
+ commonApi._post("product/get_product_detail", {
+ id: item.id
+ }).then(res => {
+ if (item.skuid) {
+ let sku = res.data.sku.find(skuItem => item.id == skuItem.skuid);
+ res.data.sku = [sku];
+ }
+ res.data.flag = res.data.sku.find(item => item.flag == 'on') ? res.data.flag : 0
+ this.setData({
+ info: res.data,
+ // skuFlag: "cart"
+ })
+ this.showCart()
+ this.BroswerRecord()
+ })
+ },
+ // 添加产品弹窗 2.渲染规格,未登录去登录
+ showCart: function () {
+ commonApi.user_post('wx/get_user_keep', {
+ jumpurl: '/pages/info/postProductInfo/index?id=' + this.data.id,
+ title: this.data.info.title,
+ type: 'mini'
+ }).then(res => {
+ if (res.data.subscribe == 0) {
+ this.setData({
+ wxqrcode: res.data.qrcode,
+ showQrCode: true
+ })
+ } else {
+ if (this.data.info.sku.length == 0) {
+ wx.showToast({
+ title: '该产品未设置规格,不能加购',
+ icon: 'none'
+ })
+ return;
+ }
+ this.setData({
+ skuFlag: "cart"
+ })
+ let that = this
+ wx.createSelectorQuery().select('#skuImg').boundingClientRect(function (res) {
+ console.log(res)
+ that.setData({
+ cartImgInfo: 'top:' + res.top + 'px;left:' + res.left + 'px;'
+ })
+ }).exec()
+ }
+ this.getCount()
+ })
+ },
+ // 规格弹窗切换其他规格
+ selectSku: function (e) {
+ let index = e.currentTarget.dataset.index;
+ this.setData({
+ skuIndex: index
+ })
+ },
+ // 关闭弹窗
+ hideSku: function () {
+ this.setData({
+ skuFlag: null,
+ cartImgInfo: null
+ })
+ },
+ // 减少数量
+ minus: function () {
+ if (this.data.producNum == 1) return;
+ this.setData({
+ producNum: this.data.producNum - 1
+ })
+ },
+ // 加数量
+ add: function () {
+ this.setData({
+ producNum: this.data.producNum + 1
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+ this.getHeight()
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.setData({
+ show:false
+ })
+ this.getHeight()
+ this.getCount()
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload() {
+ let ids = this.data.nowAddListId
+ ids = ids.map(item => Number(item));
+ app.globalData.nowAddListId = ids
+ // debugger
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh() {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+ this.getList()
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ }
+})
\ No newline at end of file
diff --git a/subPackages/postSearch/index.json b/subPackages/postSearch/index.json
new file mode 100644
index 0000000..79be446
--- /dev/null
+++ b/subPackages/postSearch/index.json
@@ -0,0 +1,5 @@
+{
+ "usingComponents": {
+
+ }
+}
\ No newline at end of file
diff --git a/subPackages/postSearch/index.wxml b/subPackages/postSearch/index.wxml
new file mode 100644
index 0000000..9408dc4
--- /dev/null
+++ b/subPackages/postSearch/index.wxml
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+
+
+
+
+ {{item.title}}
+
+
+
+ {{item.price/100}}
+ {{item.market_price/100}}
+
+
+
+
+
+
+
+
+
+
+ 暂无搜索结果
+
+
+
+
+
+
+
+
+
+ {{cartCount}}
+
+
+ 总计:{{totalPrice/100}}
+
+
+ 明细
+
+
+
+
+
+ 去结算
+
+
+
+
+
+
+
+
+
+ {{info.sku[skuIndex].price/100}}
+
+ 补贴价:¥{{ (1 - allowance_data.discount_rate / 100) * info.sku[skuIndex].price / 100 }}
+
+ 已选择:{{info.sku[skuIndex].sku_name}}
+
+
+
+ {{item.sku_name}}
+
+
+ 数量
+
+ {{producNum}}
+
+
+
+
+
+ 加入购物车
+ 该商品已下架
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 全选
+
+
+
+ 清空
+
+
+
+
+
+
+
+
+
+
+ {{item.product.title}}
+ {{item.sku.sku_name}}
+
+
+ {{item.sku.price/100}}
+
+
+ {{item.num}}
+
+
+
+
+
+
+
+
diff --git a/subPackages/postSearch/index.wxss b/subPackages/postSearch/index.wxss
new file mode 100644
index 0000000..b6f55f5
--- /dev/null
+++ b/subPackages/postSearch/index.wxss
@@ -0,0 +1,474 @@
+.title-box,
+.title-header {
+ background: #ffff;
+}
+
+.bg-box,
+.bg-box .title-header {
+ background: transparent;
+ color: #ccc;
+}
+
+.title-header {
+ position: fixed;
+ left: 0;
+ right: 0;
+ display: flex;
+ top: 0;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 32rpx;
+ line-height: 90rpx;
+ z-index: 2;
+}
+
+.title-header .icon-fanhui1 {
+ padding: 0 20rpx;
+ font-size: 44rpx;
+ color: #333;
+}
+
+.right {
+ position: absolute;
+ right: 20rpx;
+}
+
+.search-box {
+ display: flex;
+ align-items: center;
+ margin-left: 60rpx;
+ width: 560rpx;
+ border-radius: 30rpx;
+ height: 60rpx;
+ padding: 0 20rpx;
+ font-size: 26rpx;
+ background: #F0F0F0;
+}
+
+.bg-box .search-box {
+ background: #F0F0F0;
+}
+
+.search-box .weui-input {
+ margin-left: 10rpx;
+ flex: 1;
+ width: 100%;
+}
+
+.bg-box.title-box .icon-fanhui1 {
+ color: white;
+}
+
+.phcolor {
+ color: #ccc;
+}
+
+.hot-list {
+ padding: 26.67rpx;
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ padding-bottom: 170rpx;
+}
+
+.hot-item {
+ margin-bottom: 20rpx;
+ width: 337rpx;
+ height: 513rpx;
+ background: #FFFFFF;
+ box-shadow: 0rpx 0rpx 9rpx 0rpx rgba(153, 153, 153, 0.33);
+ border-radius: 13rpx;
+}
+
+.hot-item-img {
+ width: 337rpx;
+ height: 337rpx;
+ background: #0B898E;
+ border-radius: 13rpx;
+}
+
+.hot-item-title {
+ font-family: PingFang SC;
+ font-weight: 500;
+ font-size: 27rpx;
+ color: #000000;
+ /* margin-bottom: 25.33rpx; */
+}
+
+.hot-item-price {
+ font-family: Arial;
+ font-weight: bold;
+ font-size: 33rpx;
+ color: #D70000;
+ margin-right: 12.67rpx;
+}
+
+.hot-item-price::before {
+ content: "¥";
+ font-weight: 400;
+ font-size: 23rpx;
+}
+
+.hot-item-market_price {
+ font-family: Arial;
+ font-weight: 400;
+ font-size: 21rpx;
+ color: #999999;
+ text-decoration-line: line-through;
+}
+
+.hot-item-main {
+ padding: 20rpx 19rpx 26.67rpx 20rpx;
+ display: flex;
+ flex-direction: column;
+ min-height: 140rpx;
+ justify-content: space-between;
+}
+
+.hot-list-item:nth-child(2) .hot-item:first-child {
+ width: 337rpx;
+ height: 373rpx;
+ background: #FFFFFF;
+ box-shadow: 0rpx 0rpx 9rpx 0rpx rgba(153, 153, 153, 0.33);
+ border-radius: 13rpx;
+ padding-bottom: 20rpx;
+}
+
+.hot-list-item:nth-child(2) .hot-item:first-child .hot-item-img {
+ width: 337rpx;
+ height: 238rpx;
+ background: #71B580;
+ border-radius: 13rpx;
+}
+
+.hot-list-item:nth-child(2) .hot-item:first-child .main {
+ width: 337rpx;
+ height: 238rpx;
+ background: #71B580;
+ border-radius: 13rpx;
+}
+
+.hot-list-item:nth-child(2) .hot-item:first-child .hot-item-main {
+ padding: 5rpx 19rpx 26.67rpx 15rpx;
+ display: flex;
+ flex-direction: column;
+ min-height: 90rpx;
+ justify-content: space-between;
+}
+
+.hot-list-item:nth-child(2) .hot-item:first-child .hot-item-main .hot-item-title {
+ margin-bottom: 20rpx;
+}
+
+.hot-list-item {
+ width: 337rpx;
+}
+
+.add {
+ width: 40rpx;
+ height: 40rpx;
+ background: #0B898E;
+ border-radius: 50%;
+ text-align: center;
+ line-height: 40rpx;
+ font-weight: 500;
+ font-size: 31rpx;
+ color: #FFFFFF;
+}
+
+.bottom {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: 167rpx;
+ background: #FFFFFF;
+ box-shadow: 0rpx 2rpx 13rpx 0rpx rgba(136, 136, 136, 0.25);
+ padding: 0 27.33rpx 0 26.67rpx;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ z-index: 666;
+}
+
+.gwc {
+ margin-right: 14rpx;
+ width: 84rpx;
+ height: 84rpx;
+ position: relative;
+}
+
+.cartCount {
+ width: 40rpx;
+ height: 40rpx;
+ background: #D90F01;
+ border-radius: 50%;
+ border: 1rpx solid #FFFFFF;
+ font-family: PingFang SC;
+ font-weight: 500;
+ font-size: 27rpx;
+ color: #FFFFFF;
+ text-align: center;
+ line-height: 40rpx;
+ position: absolute;
+ right: -10rpx;
+ top: -10rpx;
+}
+
+.gwc-left {
+ display: flex;
+ align-items: center;
+}
+
+.money {
+ font-weight: bold;
+ font-size: 47rpx;
+ color: #D70000;
+}
+
+.money::before {
+ content: "¥";
+ font-size: 23rpx;
+ font-weight: 500;
+}
+
+.buy {
+ width: 240rpx;
+ height: 83rpx;
+ background: #D70000;
+ border-radius: 42rpx;
+ font-family: PingFang SC;
+ font-weight: bold;
+ font-size: 32rpx;
+ color: #FFFFFF;
+ text-align: center;
+ line-height: 83rpx;
+}
+
+.no-buy {
+ width: 240rpx;
+ height: 83rpx;
+ background: #BDBDBD;
+ border-radius: 42rpx;
+ font-family: PingFang SC;
+ font-weight: bold;
+ font-size: 32rpx;
+ color: #FFFFFF;
+ text-align: center;
+ line-height: 83rpx;
+}
+
+.mask-content {
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ width: 100%;
+}
+.mask-content .icon-close {
+ position: absolute;
+ right: 40rpx;
+ top: 40rpx;
+}
+.sku-info-box {
+ margin: 50rpx 40rpx;
+ display: flex;
+ justify-content: space-between;
+}
+.sku-info-box image {
+ width: 218rpx;
+ height: 180rpx;
+ border-radius: 13rpx;
+ display: block;
+ margin-right: 40rpx;
+ flex-shrink: 0;
+}
+.sku-info {
+ flex: 1;
+}
+.sku-price {
+ font-size: 40rpx;
+ font-weight: 500;
+ color: #D62828;
+ margin: 20rpx 0;
+ display: flex;
+ justify-content: flex-start;
+ align-items: center;
+}
+.sku-price::before {
+ content: "¥";
+ font-weight: 400;
+ font-size: 27rpx;
+ vertical-align: baseline;
+}
+.sku-price view {
+ font-size: 24rpx;
+ color: #FFFFFF;
+ background-color: #D62828;
+ border-radius: 22rpx;
+ line-height: 44rpx;
+ margin-left: 7rpx;
+ padding: 0 20rpx;
+}
+.sku-name {
+ font-size: 27rpx;
+ color: #666666;
+}
+.sku-names {
+ display: flex;
+ font-size: 29rpx;
+ color: #333;
+ margin: 0 40rpx;
+ text-align: center;
+ flex-wrap: wrap;
+ margin-bottom: 20rpx;
+}
+.sku-name-item {
+ background: #EFEFEF;
+ border: 1rpx solid #EFEFEF;
+ width: 318rpx;
+ line-height: 77rpx;
+ border-radius: 14rpx;
+ margin-bottom: 25rpx;
+ margin-right: 30rpx;
+}
+.sku-name-item:nth-child(2n) {
+ margin-right: 0;
+}
+.sku-name-item.active {
+ color: #0B898E;
+ border-color: #0B898E;
+ background: rgba(11, 137, 142, 0.1);
+}
+.number-box {
+ display: flex;
+ align-items: center;
+ border-top: 1rpx solid #ccc;
+ justify-content: space-between;
+ margin: 0 40rpx;
+ padding: 40rpx 0;
+}
+.number-box text {
+ flex: 1;
+ font-size: 29rpx;
+ color: #333;
+}
+.number-box view {
+ border: 1rpx solid #666;
+ border-radius: 7rpx;
+ text-align: center;
+ width: 67rpx;
+ line-height: 67rpx;
+ font-size: 33rpx;
+ color: #000;
+}
+.number-box view.disable {
+ border-color: #ccc;
+ color: #999;
+}
+.number-box view.number {
+ width: 94rpx;
+ margin: 0 15rpx;
+}
+.btn-box {
+ height: 138rpx;
+ background: #FFFFFF;
+ box-shadow: 0px 0px 16rpx 0px rgba(6, 0, 1, 0.1);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: fixed;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+.mask-btn {
+ width: 670rpx;
+ line-height: 78rpx;
+ background: #D62828;
+ border-radius: 39rpx;
+ color: #fff;
+ text-align: center;
+ font-size: 33rpx;
+ font-weight: 500;
+}
+.mask-btn.disable {
+ background: #ccc;
+}
+
+.flex {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.all {
+ font-family: PingFang SC;
+ font-weight: bold;
+ font-size: 37rpx;
+ color: #000000;
+ margin-left: 26rpx;
+}
+
+.del-all {
+ font-family: PingFang SC;
+ font-weight: bold;
+ font-size: 27rpx;
+ color: #999999;
+ margin-left: 7.33rpx;
+}
+
+.gwc-item {
+ display: flex;
+ align-items: center;
+ margin-bottom: 48rpx;
+}
+
+.main {
+ height: 179rpx;
+ padding: 8.67rpx 0 6.67rpx;
+ width: 425rpx;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+
+.main .title {
+ font-family: PingFang SC;
+ font-weight: bold;
+ font-size: 31rpx;
+ color: #2C2C2C;
+ margin-bottom: 18rpx;
+}
+.main .sku-title {
+ font-family: PingFang SC;
+ font-weight: 500;
+ font-size: 27rpx;
+ color: #999999;
+}
+
+.main-bottom {
+ display: flex;
+ width: 100%;
+ justify-content: space-between;
+}
+
+.num-box {
+ display: flex;
+}
+
+.reduce, .grow {
+ width: 49rpx;
+ height: 49rpx;
+}
+
+.main-bottom .price {
+ font-family: PingFangSC;
+ font-size: 35rpx;
+ color: #F84A56;
+}
+.main-bottom .price::before {
+ content: "¥";
+ font-size: 24rpx;
+ font-weight: 500;
+}
diff --git a/subPackages/techanNew/index.js b/subPackages/techanNew/index.js
index 0fcfddc..88546b1 100644
--- a/subPackages/techanNew/index.js
+++ b/subPackages/techanNew/index.js
@@ -10,6 +10,9 @@ Page({
* 页面的初始数据
*/
data: {
+ height: 90,
+ padHeight:0,
+ right:0,
list:[], //获取的产品列表
total:1, //总数
keywords:"", //搜索关键字
@@ -48,13 +51,15 @@ Page({
allSelectedBtn:false, //全选按钮
seachFlag:false, //搜索模式
totalPrice:0, //获取购物车总价--打开购物车后勾选的产品价格
- name:'文创特产'
+ name:'文创特产',
+ nowAddListId:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
+ app.globalData.nowAddListId = []
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
@@ -92,6 +97,9 @@ Page({
wx.showToast({
title: '清空成功',
icon: "success"
+ })
+ this.setData({
+ totalPrice:0
})
this.getCount()
}
@@ -155,36 +163,33 @@ Page({
num: this.data.producNum,
type:"1"
}).then(res => {
- if (res.code == 1) {
+ if (res.code == 1) {
+ let sku_id = this.data.showPopup ? item.sku.id :this.data.info.sku[this.data.skuIndex].id
+ let _nowAddListId = this.data.nowAddListId
+ _nowAddListId.push(sku_id)
+ this.setData({
+ nowAddListId: _nowAddListId
+ })
commonApi.user_post('cart_within/get_list', {
type:'1'
}).then(res => {
+ // debugger
let cartCount = 0,totalPrice = 0,gwcList=this.data.gwcList
res.data.forEach(val=> {
cartCount+=val.num
console.log(this.data.skuFlag);
- // debugger
if (!this.data.skuFlag && !this.data.showPopup) {
- // debugger
- if (val.sku.id == this.data.info.sku[this.data.skuIndex].id) {
+ console.log(this.data.nowAddListId)
+ if (this.data.nowAddListId.includes(val.sku.id) ) {
val.selected = 1
}
}else {
- // debugger
gwcList.forEach(el=> {
if (el.id == val.id) {
val.selected = el.selected
}
})
}
- // if (this.data.showPopup) {
- // totalPrice += Number(val.num*val.sku.price)
- // gwcList.forEach(el=> {
- // if (el.id == val.id) {
- // val.selected = el.selected
- // }
- // })
- // }
})
res.data.forEach(element=> {
if (element.selected == 1) {
@@ -269,10 +274,10 @@ Page({
}
})
if (product.length == 0 && product1.length == 0) {
- wx.showToast({
- title: '请先选择产品',
- icon: 'none'
- })
+ // wx.showToast({
+ // title: '请先选择产品',
+ // icon: 'none'
+ // })
return;
}
if (product.length > 0 && product1.length > 0) {
@@ -305,10 +310,12 @@ Page({
allSelected() {
let gwcList = this.data.gwcList
let totalPrice = 0
+ let nowAddListId = []
if (this.data.allSelectedBtn) {
gwcList.forEach(item=> {
item.selected =0
})
+ nowAddListId = []
} else {
gwcList.forEach(item=> {
item.selected =1
@@ -316,16 +323,22 @@ Page({
gwcList.forEach(item=> {
totalPrice += Number(item.num*item.sku.price)
})
+ gwcList.forEach(item=> {
+ nowAddListId.push(item.sku_id)
+ })
}
+ console.log(nowAddListId);
+ // debugger
this.setData({
gwcList,
allSelectedBtn:!this.data.allSelectedBtn,
- totalPrice
+ totalPrice,
+ nowAddListId
})
},
// 单选一个
selectedIt(e) {
- let item = e.currentTarget.dataset.item,gwcList= this.data.gwcList,totalPrice=0
+ let item = e.currentTarget.dataset.item,gwcList= this.data.gwcList,totalPrice=0,nowAddListId=[]
gwcList.forEach(el=> {
if (el.id == item.id) {
el.selected == 1 ? el.selected =0 : el.selected = 1
@@ -336,18 +349,27 @@ Page({
totalPrice += Number(el.num*el.sku.price)
}
})
+ gwcList.forEach(item=> {
+ if (item.selected == 1) {
+ nowAddListId.push(item.sku_id)
+ }
+ })
+ console.log(nowAddListId);
let status = gwcList.every(el => el.selected === 1)
this.setData({
gwcList,
allSelectedBtn:status?true:false,
- totalPrice
+ totalPrice,
+ nowAddListId
})
},
// 左侧购物车打开弹窗
openPopup() {
- // this.getCount()
let gwcList = this.data.gwcList
- let status = gwcList.every(el => el.selected === 1)
+ let status = false
+ if (gwcList.length>0) {
+ status = gwcList.every(el => el.selected === 1)
+ }
this.setData({
showPopup:!this.data.showPopup,
allSelectedBtn:status?true:false,
@@ -361,14 +383,20 @@ Page({
tag_id:this.data.navList2[this.data.navIndex].type, //标签的ID
offset:list.length, //起始查询
limit:10, //查询数量
- title:this.data.keywords //搜索产品名称
+ title:this.data.seachFlag ? this.data.keywords : '' //搜索产品名称
}).then(res => {
+ let arr = []
+ if (this.data.seachFlag) {
+ res.data.list.map(obj => {
+ arr = [...arr, ...obj.product]
+ })
+ }
res.data.list.map(item=>{
item.display_tags = item.display_tags?item.display_tags.split(","):[];
item.display_tags = item.display_tags.splice(0,2);
})
this.setData({
- list:list.concat(res.data.list),
+ list:this.data.seachFlag?arr:list.concat(res.data.list),
total:res.data.total
})
})
@@ -386,6 +414,7 @@ Page({
},
// 获取历史购物车详情
getCount() {
+ // debugger
commonApi.user_post('cart_within/get_list', {
type:'1'
}).then(res => {
@@ -396,10 +425,28 @@ Page({
cartCount += item.num
})
}
+ if (app.globalData.nowAddListId.length>0) {
+ arr.map(item=> {
+ app.globalData.nowAddListId.forEach(val=> {
+ if (val == item.sku_id) {
+ item.selected = 1
+ }
+ })
+ })
+ // debugger
+ arr.forEach(item=> {
+ if(item.selected == 1) {
+ totalPrice += item.num*item.sku.price
+ }
+ })
+ }
+ // console.log(arr);
+ // debugger
this.setData({
cartCount: cartCount, //1
- gwcList:res.data,
- allSelectedBtn:false
+ gwcList:arr,
+ allSelectedBtn:false,
+ totalPrice:app.globalData.nowAddListId.length>0?totalPrice:0
})
})
},
@@ -408,11 +455,20 @@ Page({
this.setData({
list:[],
total:1,
- navIndex:0,
- typeIndex:0,
+ // navIndex:0,
+ // typeIndex:0,
flag:true
})
this.getList()
+ this.getCount()
+ },
+ goNewSearch() {
+ console.log(this.data.nowAddListId);
+ // debugger
+ wx.navigateTo({
+ // url: "/subPackages/postSearch/index?type_id=1",
+ url: "/subPackages/postSearch/index?type_id=1&ids="+this.data.nowAddListId,
+ })
},
// 搜索
search:function(e){
@@ -423,7 +479,7 @@ Page({
list:[],
total:1
})
- this.onReload()
+ // this.onReload()
}else {
this.setData({
seachFlag:true,
@@ -431,7 +487,16 @@ Page({
list:[],
total:1
})
- this.getList();
+ // if (!this.data.flag) {
+ // this.getSupplierTag()
+ // } else {
+ // this.getList()
+ // }
+ }
+ if (!this.data.flag) {
+ this.getSupplierTag()
+ } else {
+ this.getList()
}
},
// 去产品详情页
@@ -509,7 +574,7 @@ Page({
tag_id:this.data.seachFlag? '20,19':this.data.typeList[this.data.typeIndex].id, //标签的ID
offset:list.length, //起始查询
limit: 10, //查询数量
- title:this.data.keywords, //搜索产品名称
+ title:this.data.seachFlag ? this.data.keywords : '', //搜索产品名称
}).then(res=>{
res.data.list.map(item=>{
item.display_tags = item.display_tags?item.display_tags.split(","):[];
@@ -619,18 +684,53 @@ Page({
producNum: this.data.producNum + 1
})
},
+ getHeight() {
+ let systemInfo = wx.getSystemInfoSync(),rect = wx.getMenuButtonBoundingClientRect();
+ let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height;
+ this.setData({
+ height:height,
+ padHeight:systemInfo.statusBarHeight,
+ right:(systemInfo.screenWidth - rect.right) + rect.width
+ })
+ console.log(systemInfo,rect)
+ },
+ back: function () {
+ if(this.properties.clickid){
+ wx.uma.trackEvent(this.properties.clickid);
+ }
+ const pages = getCurrentPages();
+ // wx.showTabBar({})
+ console.log(this.properties.isIndex)
+ if (pages.length<=1){
+ wx.switchTab({
+ url: app.globalData.menuRoute
+ })
+ }
+ else {
+ wx.navigateBack({
+ delta: 1
+ })
+ }
+ },
+ // lower() {
+ // if (this.data.flag) {
+ // this.getList()
+ // } else {
+ // this.getSupplierTag()
+ // }
+ // },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
-
+ this.getHeight()
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
- // this.onReload()
+ this.onReload()
// this.setData({
// seachFlag:false
// // list:[],
@@ -640,6 +740,13 @@ Page({
// // flag:true
// })
// this.getList()
+ this.getHeight()
+ console.log(app.globalData.nowAddListId );
+ if (app.globalData.nowAddListId.length>0) {
+ // debugger
+ this.getCount()
+ }
+ // debugger
},
/**
diff --git a/subPackages/techanNew/index.wxml b/subPackages/techanNew/index.wxml
index 98904bd..3b06131 100644
--- a/subPackages/techanNew/index.wxml
+++ b/subPackages/techanNew/index.wxml
@@ -3,7 +3,21 @@
-
+
+
+
+
@@ -14,7 +28,8 @@
{{item.title}}
-
+
+
@@ -31,8 +46,8 @@
-
-
+
+
@@ -42,7 +57,7 @@
{{item.price/100}}
- ¥{{item.market_price/100}}
+ ¥{{item.market_price/100}}
+
@@ -98,7 +113,7 @@
{{item.price/100}}
- {{item.market_price/100}}
+ {{item.market_price/100}}
@@ -127,14 +142,15 @@
总计:{{totalPrice/100}}
-
+
+ 明细
+
+
+
- 去结算
+ 去结算
+ 去结算
@@ -195,8 +211,8 @@
- {{item.product.title}}
- {{item.sku.sku_name}}
+ {{item.product.title}}
+ {{item.sku.sku_name}}
{{item.sku.price/100}}
diff --git a/subPackages/techanNew/index.wxss b/subPackages/techanNew/index.wxss
index 69bccdf..3c7b928 100644
--- a/subPackages/techanNew/index.wxss
+++ b/subPackages/techanNew/index.wxss
@@ -683,3 +683,60 @@ page {
.hot-list-item {
width: 337rpx;
}
+
+
+
+.title-box,.title-header{
+ background: #ffff;
+}
+.bg-box,.bg-box .title-header {
+ background: transparent;
+ color: #ccc;
+}
+
+.title-header {
+ position: fixed;
+ left: 0;
+ right: 0;
+ display: flex;
+ top: 0;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 32rpx;
+ line-height: 90rpx;
+ z-index: 2;
+}
+.title-header .icon-fanhui1 {
+ padding: 0 20rpx;
+ font-size: 44rpx;
+ color: #333;
+}
+.right {
+ position: absolute;
+ right: 20rpx;
+}
+.search-box {
+ display: flex;
+ align-items: center;
+ margin-left: 60rpx;
+ width: 560rpx;
+ border-radius: 30rpx;
+ height: 60rpx;
+ padding: 0 20rpx;
+ font-size: 26rpx;
+ background: #F0F0F0;
+}
+.bg-box .search-box {
+ background: #F0F0F0;
+}
+.search-box .weui-input {
+ margin-left: 10rpx;
+ flex: 1;
+ width: 100%;
+}
+.bg-box.title-box .icon-fanhui1 {
+ color: white;
+}
+.phcolor {
+ color: #ccc;
+}