diff --git a/app.js b/app.js index 01b3256..b6140ad 100644 --- a/app.js +++ b/app.js @@ -21,7 +21,7 @@ App({ if (this.release) { this.httpUrl = 'https://api.qniao.cn' } else { - this.httpUrl = 'https://api-test.qniao.cn' + this.httpUrl = 'http://192.168.0.24:9000' } wx.getSystemInfo({ success: e => { diff --git a/components/button/index.wxss b/components/button/index.wxss index 3625172..50c204a 100644 --- a/components/button/index.wxss +++ b/components/button/index.wxss @@ -55,6 +55,13 @@ .wux-button--disabled { opacity: .4!important } +.wux-button--tag { + padding: 4rpx 24rpx 2rpx 24rpx; + min-width: 50rpx; + min-height: 40rpx!important; + font-size: 24rpx; + line-height: 40rpx +} .wux-button--small { padding: 4rpx 8rpx 2rpx; min-width: 56rpx; @@ -354,4 +361,35 @@ .wux-button--stable.wux-button--hover { background-color: #dfdfdf!important; color: #fff!important +} + +.wux-button--tag, +.wux-button--tag--disabled { + border-color: transparent!important; + background-color: #999999!important; + color: #fff!important; +} +.wux-button--tag.wux-button--outline { + border-color: #999999!important; + background-color: transparent!important; + color: #999999!important; +} +.wux-button--tag.wux-button--outline.wux-button--disabled { + border-color: #999999!important; + background-color: transparent!important; + color: #999999!important; + text-decoration:line-through; +} +.wux-button--tag.wux-button--clear, +.wux-button--tag.wux-button--clear.wux-button--disabled { + background-color: transparent!important; + color: #999999!important +} +.wux-button--tag.wux-button--clear.wux-button--hover { + background-color: rgba(0,0,0,0)!important; + color: #999999!important +} +.wux-button--tag.wux-button--hover { + background-color: #999999!important; + color: #fff!important } \ No newline at end of file diff --git a/components/image/index.wxss b/components/image/index.wxss index 6772dfe..a8ea644 100644 --- a/components/image/index.wxss +++ b/components/image/index.wxss @@ -49,7 +49,7 @@ .wux-image--widthFix .wux-image__inner { position: relative } -.wux-image image, +.wux-image, .wux-image__thumb { display: inline-block; overflow: hidden; diff --git a/components/refresher/index.js b/components/refresher/index.js index 7daf27c..61463a6 100644 --- a/components/refresher/index.js +++ b/components/refresher/index.js @@ -15,6 +15,10 @@ let options = janComponent({ }, properties: { + height: { + type: Number, + value: 500 + }, refresherTextStyle: { type: String, value: "black" diff --git a/components/refresher/index.wxml b/components/refresher/index.wxml index 3630670..956998f 100644 --- a/components/refresher/index.wxml +++ b/components/refresher/index.wxml @@ -1,4 +1,4 @@ - + diff --git a/components/skeleton-avatar/index.wxss b/components/skeleton-avatar/index.wxss index 6e39d0b..f0addaa 100644 --- a/components/skeleton-avatar/index.wxss +++ b/components/skeleton-avatar/index.wxss @@ -28,6 +28,12 @@ line-height: 120rpx } +.wux-skeleton-avatar--tab { + width: 100%; + height: 60rpx; + line-height: 60rpx +} + .wux-skeleton-avatar--full { width: 100%; height: 240rpx; diff --git a/components/tab/index.js b/components/tab/index.js index 4238d9b..f59934d 100644 --- a/components/tab/index.js +++ b/components/tab/index.js @@ -17,6 +17,11 @@ Component({ type: Boolean, value: false }, + // view宽度 + padding: { + type: Number, + value: 0, + }, // tab高度 size: { type: Number, @@ -31,9 +36,7 @@ Component({ }, data: { /* 未渲染数据 */ - windowWidth: 0, // 屏幕宽度 tabItems: [], // 所有 tab 节点信息 - /* 渲染数据 */ scrolling: true, // 控制 scroll-view 滚动以在异步加载数据的时候能正确获得 dom 信息 needTransition: false, // 下划线是否需要过渡动画 @@ -61,11 +64,13 @@ Component({ itemLeft = item.left || 0; this.setData({needTransition: needTransition}); - + if(this.data.padding){ + itemLeft -= this.data.padding + } if (this.data.scroll) { // 超出滚动的情况 // 保持滚动后当前 item '尽可能' 在屏幕中间 let scrollLeft = itemLeft - (this.data.windowWidth - itemWidth) / 2; - + console.log('scrollLeft>>>' + scrollLeft) this.setData({ tabCur: tabCur, scrollLeft: scrollLeft, @@ -100,17 +105,16 @@ Component({ * 监听 tab 高度变化, 最小值为80rpx */ sizeChange(newVal, oldVal) { - if (newVal <= 80) { - this.setData({size: 80}); + if (newVal <= 60) { + this.setData({size: 60}); } }, /** * 初始化函数 */ init() { - const {windowWidth} = wx.getSystemInfoSync(); - this.setData({windowWidth: windowWidth || 375}); - + const {windowWidth} = wx.getSystemInfoSync() + this.setData({windowWidth: windowWidth || 375}) this.createSelectorQuery().selectAll(".tabs__item-child").boundingClientRect((res) => { this.setData({ scrolling: true, diff --git a/components/tab/index.wxss b/components/tab/index.wxss index 86c83db..9308dc5 100644 --- a/components/tab/index.wxss +++ b/components/tab/index.wxss @@ -35,6 +35,7 @@ padding: 0 10rpx; box-sizing: border-box; transition: color 0.3s ease-in-out; + font-size: 14px; } .tabs__item--cur { color: #008AFF; diff --git a/pages/mall/order-info/index.js b/pages/mall/order-info/index.js index 1fa152f..a149f28 100644 --- a/pages/mall/order-info/index.js +++ b/pages/mall/order-info/index.js @@ -13,6 +13,7 @@ Page({ token: app.globalData.token, backStr: '返回', orderInfo: null, + matchTag: null, sukList: [], form: { productId: null, @@ -20,7 +21,6 @@ Page({ number: 1, unitPrice: 0 }, - skuJson: '', amount: null }, /** @@ -78,26 +78,26 @@ Page({ current: e.currentTarget.dataset.url }); }, + // 根据 + checkDisableTag: function(sukId, match, element){ + match[sukId] = element.id + for (let index = 0; index < this.data.orderInfo.skuList.length; index++) { + const item = this.data.orderInfo.skuList[index]; + if(this.checkSkuPrice(match, item)){ + delete match[sukId] + return false + } + } + delete match[sukId] + return true + }, + // tag 点击事件 tagClick: function (e) { + this.data.matchTag = null var sukId = e.currentTarget.dataset.suk// 对应的是一级列表的Id var id = e.currentTarget.dataset.index// 对应的是二级列表的Id,相应是有价格计算的 - var attributeList = this.data.orderInfo.attributeList - for (let i = 0; i < attributeList.length; i++) { - if (attributeList[i].id == sukId) { - for (let k = 0; k < attributeList[i].values.length; k++) { - const element = attributeList[i].values[k]; - element.select = false - if (element.id == id) { - element.select = true - } - } - } - } - this.setData({ - ['orderInfo.attributeList']: attributeList, - amount: null - }) - // 检查是否需要跟新,或者修改; + //------------------------------sukList------------------------------------------- + // 检查是否需要跟新,或者修改,跟新sukList; var push_flag = true for (let index = 0; index < this.data.sukList.length; index++) { const element = this.data.sukList[index]; @@ -113,16 +113,53 @@ Page({ id: id }) } + //------------------------------attributeList------------------------------------------- + var match = {} + for (let index = 0; index < this.data.sukList.length; index++) { + const element = this.data.sukList[index]; + match[element.skuId] = element.id + } + var attributeList = this.data.orderInfo.attributeList + for (let i = 0; i < attributeList.length; i++) { + for (let k = 0; k < attributeList[i].values.length; k++) { + const element = attributeList[i].values[k]; + // 点击的列判断 对应的是一级列表,肯定是可以点击的 + if (attributeList[i].id == sukId) { + element.select = false + if (element.id == id) { + element.select = true + } + } else { + // 如果其余的规格没有价格的,进行处理;无法点击 + element.disabled = this.checkDisableTag(attributeList[i].id, match, element) + } + } + } + this.setData({ + ['orderInfo.attributeList']: attributeList, + amount: null + }) + //------------------------------matchTag------------------------------------------- if (this.data.sukList.length == this.data.orderInfo.attributeList.length) { - var match = {} + this.data.matchTag = {} for (let index = 0; index < this.data.sukList.length; index++) { const element = this.data.sukList[index]; - match[element.skuId] = element.id + this.data.matchTag[element.skuId] = element.id } - this.data.skuJson = JSON.stringify(match) - this.data.skuJson = this.data.skuJson.substring(1, this.data.skuJson.length - 1) this.onNumChange(null) } + }, + // 根据所有选择的规格校验获取价格 + checkSkuPrice: function(tag, element){ + if(!tag){ + return false + } + for (var key in tag) { + if(element.price <=0 || tag[key] != element[key]){ + return false + } + } + return true }, // 数量变化的函数监听 onNumChange: function (e) { @@ -140,7 +177,7 @@ Page({ // 根据规格,克重,以及其他筛选价格 for (let index = 0; index < this.data.orderInfo.skuList.length; index++) { const element = this.data.orderInfo.skuList[index]; - if(JSON.stringify(element).indexOf(this.data.skuJson) >= 0){ + if(this.checkSkuPrice(this.data.matchTag, element)){ this.data.form.unitPrice = Number(element.price) this.data.form.dividePrice = Number(element.dividePrice) this.data.form.skuId = element.id @@ -176,6 +213,7 @@ Page({ this.data.form.summary = this.data.orderInfo.summary this.data.form.sellMode = this.data.orderInfo.sellMode this.data.form.name = this.data.orderInfo.name + this.data.form.outline = this.data.orderInfo.outline this.data.form.litimgUrl = this.data.orderInfo.litimgUrl this.data.form.unit = this.data.orderInfo.unit wx.navigateTo({ @@ -194,7 +232,6 @@ Page({ path: '/pages/mall/order-info/index?id=' + this.data.orderInfo.id, imageUrl: this.data.orderInfo.litimgUrl, success: function(res) { - console.log(res) } } }, diff --git a/pages/mall/order-info/index.json b/pages/mall/order-info/index.json index 9840c5f..8162bd9 100644 --- a/pages/mall/order-info/index.json +++ b/pages/mall/order-info/index.json @@ -1,6 +1,6 @@ { "usingComponents": { - "wux-tag": "/components/tag/index", + "wux-button": "/components/button/index", "wux-input-number": "/components/input-number/index" } } \ No newline at end of file diff --git a/pages/mall/order-info/index.wxml b/pages/mall/order-info/index.wxml index 4780257..2c82615 100644 --- a/pages/mall/order-info/index.wxml +++ b/pages/mall/order-info/index.wxml @@ -24,13 +24,14 @@ {{orderInfo.name}} + {{orderInfo.outline}} + 选择{{sukItem.name}} - - {{item.val}} - {{item.val}} + + {{item.val}} @@ -46,7 +47,7 @@ 商品描述 - {{orderInfo.summary}} + {{orderInfo.detail}} diff --git a/pages/mall/order-list/index.wxml b/pages/mall/order-list/index.wxml index 3122616..58d5ec0 100644 --- a/pages/mall/order-list/index.wxml +++ b/pages/mall/order-list/index.wxml @@ -5,13 +5,15 @@ - - + + + + diff --git a/pages/mall/order-offer/index.js b/pages/mall/order-offer/index.js index 55f2ce4..a5ba0a6 100644 --- a/pages/mall/order-offer/index.js +++ b/pages/mall/order-offer/index.js @@ -25,7 +25,8 @@ Page({ var form = JSON.parse(options.json) form.payType = 1 // form.totalPrice = float.accAdd(float.accMul(form.unitPrice, form.number), form.dividePrice) - form.totalPrice = float.accMul(form.unitPrice, form.number) + form.totalPrice = float.accMul(form.unitPrice, form.number).toFixed(2) + form.preAmount = float.accMul(float.accMul(form.unitPrice, form.number), 0.1).toFixed(2) this.setData({ form: form }) @@ -49,8 +50,15 @@ Page({ }, checkMode: function (e) { + var preAmount = 0 + if(e.currentTarget.dataset.index == 1){ + preAmount = float.accMul(float.accMul(this.data.form.unitPrice, this.data.form.number), 0.1).toFixed(2) + } else if(e.currentTarget.dataset.index == 2){ + preAmount = float.accMul(this.data.form.unitPrice, this.data.form.number).toFixed(2) + } this.setData({ - ['form.payType']: e.currentTarget.dataset.index + ['form.payType']: Number(e.currentTarget.dataset.index), + ['form.preAmount']: preAmount }) }, diff --git a/pages/mall/order-offer/index.wxml b/pages/mall/order-offer/index.wxml index e7f7784..5504caf 100644 --- a/pages/mall/order-offer/index.wxml +++ b/pages/mall/order-offer/index.wxml @@ -1,4 +1,3 @@ - 返回 @@ -29,12 +28,15 @@ - - + + {{form.name}} - {{form.summary}} + + {{form.outline}} + {{form.summary}} + @@ -54,8 +56,8 @@ ¥{{form.dividePrice}} - 应付金额 - ¥{{form.totalPrice}} + {{form.payType == 1 ? '预付金额' : '应付金额'}} + ¥{{form.preAmount}} @@ -66,13 +68,13 @@ - 预付定金 - 预付款50%,余款货到付款 + 预付定金 + 预付款10%,余款货到付款 - 货到付款 + 货到付款 @@ -86,8 +88,8 @@ - 共{{form.number}}{{form.unit}} - 合计: + + 合计: ¥{{form.totalPrice}} diff --git a/pages/mall/order-offer/index.wxss b/pages/mall/order-offer/index.wxss index 0e2bb31..0a9ba18 100644 --- a/pages/mall/order-offer/index.wxss +++ b/pages/mall/order-offer/index.wxss @@ -82,4 +82,19 @@ button::after { display: flex; align-items: center; justify-content: center; +} + +.page-outline { + margin-top: 8rpx; + font-size: 10px; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(51, 51, 51, 1); + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: normal !important; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; } \ No newline at end of file diff --git a/pages/mall/search-list/index.js b/pages/mall/search-list/index.js index 228ec97..7684b0e 100644 --- a/pages/mall/search-list/index.js +++ b/pages/mall/search-list/index.js @@ -31,7 +31,7 @@ Page({ */ onLoad: function (options) { this.setData({ - height: app.globalData.fragmentHeight, + height: app.globalData.fragmentHeight - 100, CustomBar: app.globalData.CustomBar, }) var that = this diff --git a/pages/mall/search-list/index.wxml b/pages/mall/search-list/index.wxml index 74c9c18..4c4097d 100644 --- a/pages/mall/search-list/index.wxml +++ b/pages/mall/search-list/index.wxml @@ -45,11 +45,15 @@ - + {{item.name}} - 已拼{{item.soldNum}}{{item.unit}} + 已拼{{item.soldNum}}{{item.unit}} + {{item.viewNum}} 浏览 + + + {{item.outline}} + {{item.summary}} - {{item.summary}} ¥{{item.price}} 库存:{{item.stockNumber}}{{item.unit}} diff --git a/pages/mall/search-list/index.wxss b/pages/mall/search-list/index.wxss index f245c6e..acc8db5 100644 --- a/pages/mall/search-list/index.wxss +++ b/pages/mall/search-list/index.wxss @@ -62,6 +62,21 @@ color: rgba(51, 51, 51, 1); } +.page-outline { + margin-top: 8rpx; + font-size: 10px; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(51, 51, 51, 1); + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: normal !important; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + .page-btn { height: 27px; background: rgba(255, 66, 43, 1); diff --git a/pages/mall/shops/index.js b/pages/mall/shops/index.js index f59893d..7c52235 100644 --- a/pages/mall/shops/index.js +++ b/pages/mall/shops/index.js @@ -10,15 +10,20 @@ Page({ * 页面的初始数据 */ data: { - height: app.globalData.fragmentHeight - 100, + firstShow: false, + height: app.globalData.fragmentHeight - 180, CustomBar: app.globalData.CustomBar, - tabs: ['待出车', '进行中', '已完成', '进行中', '已完成', '进行中', '已完成', '进行中', '已完成'], + scroll: true, + pageIndex: 0, + pageList: [], + tabs: [], loading: true, finished: false, requesting: false, cheapList: [], taskList: [], form: { + productTypeId: '', pageSize: 10, pageNum: 1 }, @@ -31,7 +36,7 @@ Page({ onLoad: function (options) { this.checkLogin() this.setData({ - height: app.globalData.fragmentHeight, + height: app.globalData.fragmentHeight - 200, CustomBar: app.globalData.CustomBar, token: app.globalData.token }) @@ -43,16 +48,50 @@ Page({ if(message.what == 1 && util.isEmpty(this.data.token)){ this.setData({ token: app.globalData.token }) } + this.fetchTabList() + this.fetchCheapList() + this.fetchTaskList() }, /** * 生命周期函数--监听页面初次渲染完成 */ - onReady: function () { + onShow: function(){ + if(this.data.firstShow){ + this.onRefreshList() + } if (!this.data.firstShow) { - this.fetchCheapList() - this.fetchTaskList() + this.data.firstShow = true + } + }, + // 获取特价列表 + fetchTabList: function () { + // /product/type/list产品分类列表 + request.get('/bxe-mall/product/type/list').then(result => { + //成功回调 + var tabList = ['全部'] + var size = 0 + for (let index = 0; index < result.data.length; index++) { + tabList.push(result.data[index].name) + size += result.data[index].name.length + } + this.data.pageList = result.data + this.setData({ tabs: tabList, scroll: size > 14 }) + }) + }, + // Tab 点击切换,并刷新列表; + onTabChange: function (e) { + if(this.data.pageIndex == Number(e.detail.index)){ + return + } + this.data.pageIndex = Number(e.detail.index) + if(this.data.pageIndex == 0){ + this.data.form.productTypeId = '' + } else { + this.data.form.productTypeId = this.data.pageList[this.data.pageIndex - 1].id } + this.onRefreshList() }, + // 下拉刷新... onRefreshList: function(){ this.setData({ cheapList: [], @@ -66,13 +105,9 @@ Page({ }, // 获取特价列表 fetchCheapList: function () { - request.get('/bxe-mall/product/cheapList').then(result => { + request.get('/bxe-mall/product/cheapList', this.data.form).then(result => { //成功回调 this.setData({ loading: false, cheapList: result.data }) - }).catch(err => { - //异常回调 - this.setData({ loading: false }) - util.showToast(err) }) }, // 获取团购列表 @@ -80,7 +115,11 @@ Page({ if (this.data.requesting || this.data.finished) { return } - this.data.requesting = true + if(this.data.loading){ + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } // /product/cheapList特价产品列表 request.get('/bxe-mall/product/groupList', this.data.form).then(result => { //成功回调 diff --git a/pages/mall/shops/index.wxml b/pages/mall/shops/index.wxml index 4195cbd..c78ade8 100644 --- a/pages/mall/shops/index.wxml +++ b/pages/mall/shops/index.wxml @@ -3,86 +3,105 @@ 原纸商城 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 暂无数据 + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 暂无数据 + + + @@ -94,7 +113,7 @@ - + @@ -102,7 +121,10 @@ {{item.name}} {{item.viewNum}} 浏览 - {{item.summary}} + + {{item.outline}} + {{item.summary}} + ¥{{item.price}} 库存:{{item.stockNumber}}{{item.unit}} @@ -121,10 +143,9 @@ - - - + + @@ -132,7 +153,10 @@ {{item.name}} 已拼{{item.soldNum}}{{item.unit}} - {{item.summary}} + + {{item.outline}} + {{item.summary}} + ¥{{item.price}} 库存:{{item.stockNumber}}{{item.unit}} @@ -148,5 +172,5 @@ {{finished?'到底了':'加载中...'}} - - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/mall/shops/index.wxss b/pages/mall/shops/index.wxss index c6854dd..bde0996 100644 --- a/pages/mall/shops/index.wxss +++ b/pages/mall/shops/index.wxss @@ -1,6 +1,6 @@ /* pages/mall/shops/index.wxss */ -.swiper-image{ +.swiper-image { height: 120px; border-radius: 6px; width: 100%; @@ -104,6 +104,21 @@ color: rgba(51, 51, 51, 1); } +.page-outline { + margin-top: 8rpx; + font-size: 10px; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(51, 51, 51, 1); + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: normal !important; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + .page-btn { height: 27px; background: rgba(255, 66, 43, 1); diff --git a/pages/refresh/refresh.js b/pages/refresh/refresh.js index 4e2d90f..f2b64c8 100644 --- a/pages/refresh/refresh.js +++ b/pages/refresh/refresh.js @@ -9,6 +9,7 @@ Page({ }, onRefresh(e) { + console.log('onRefresh>>>') this.setData({ refresherState: true }) diff --git a/pages/refresh/refresh.wxml b/pages/refresh/refresh.wxml index 94789d7..9665b0e 100644 --- a/pages/refresh/refresh.wxml +++ b/pages/refresh/refresh.wxml @@ -1,6 +1,8 @@ - + 师德师风 + 师德师风 + 师德师风 \ No newline at end of file