From 8bc49985bf953d41a7b1c290a99f4b70c537fad2 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Mon, 11 Oct 2021 21:08:50 +0800 Subject: [PATCH] no message --- api/request.js | 2 +- submodel/pages/shop/bidding/index.js | 123 +++++++++++++++++ submodel/pages/shop/bidding/index.json | 8 ++ submodel/pages/shop/bidding/index.wxml | 65 +++++++++ submodel/pages/shop/bidding/index.wxss | 42 ++++++ submodel/pages/shop/bill/index.js | 99 ++++++++++++++ submodel/pages/shop/bill/index.json | 6 + submodel/pages/shop/bill/index.wxml | 40 ++++++ submodel/pages/shop/bill/index.wxs | 14 ++ submodel/pages/shop/bill/index.wxss | 11 ++ submodel/pages/shop/create/index.js | 134 ++++++++++++++++++ submodel/pages/shop/create/index.json | 7 + submodel/pages/shop/create/index.wxml | 39 ++++++ submodel/pages/shop/create/index.wxss | 4 + submodel/pages/shop/detail/index.js | 150 +++++++++++++++++++++ submodel/pages/shop/detail/index.json | 8 ++ submodel/pages/shop/detail/index.wxml | 81 +++++++++++ submodel/pages/shop/detail/index.wxss | 75 +++++++++++ submodel/pages/shop/index/index.js | 180 +++++++++++++++++++++++++ submodel/pages/shop/index/index.json | 10 ++ submodel/pages/shop/index/index.wxml | 81 +++++++++++ submodel/pages/shop/index/index.wxss | 18 +++ submodel/pages/shop/order/index.js | 118 ++++++++++++++++ submodel/pages/shop/order/index.json | 8 ++ submodel/pages/shop/order/index.wxml | 67 +++++++++ submodel/pages/shop/order/index.wxss | 50 +++++++ submodel/pages/shop/shop.wxs | 40 ++++++ 27 files changed, 1479 insertions(+), 1 deletion(-) create mode 100644 submodel/pages/shop/bidding/index.js create mode 100644 submodel/pages/shop/bidding/index.json create mode 100644 submodel/pages/shop/bidding/index.wxml create mode 100644 submodel/pages/shop/bidding/index.wxss create mode 100644 submodel/pages/shop/bill/index.js create mode 100644 submodel/pages/shop/bill/index.json create mode 100644 submodel/pages/shop/bill/index.wxml create mode 100644 submodel/pages/shop/bill/index.wxs create mode 100644 submodel/pages/shop/bill/index.wxss create mode 100644 submodel/pages/shop/create/index.js create mode 100644 submodel/pages/shop/create/index.json create mode 100644 submodel/pages/shop/create/index.wxml create mode 100644 submodel/pages/shop/create/index.wxss create mode 100644 submodel/pages/shop/detail/index.js create mode 100644 submodel/pages/shop/detail/index.json create mode 100644 submodel/pages/shop/detail/index.wxml create mode 100644 submodel/pages/shop/detail/index.wxss create mode 100644 submodel/pages/shop/index/index.js create mode 100644 submodel/pages/shop/index/index.json create mode 100644 submodel/pages/shop/index/index.wxml create mode 100644 submodel/pages/shop/index/index.wxss create mode 100644 submodel/pages/shop/order/index.js create mode 100644 submodel/pages/shop/order/index.json create mode 100644 submodel/pages/shop/order/index.wxml create mode 100644 submodel/pages/shop/order/index.wxss create mode 100644 submodel/pages/shop/shop.wxs diff --git a/api/request.js b/api/request.js index 04ee63f..d4c3010 100644 --- a/api/request.js +++ b/api/request.js @@ -89,7 +89,7 @@ function handleResponse({ data, status }) { } }) } - var message = 'Token异常' + var message = '' if (data.message) { message = data.message } diff --git a/submodel/pages/shop/bidding/index.js b/submodel/pages/shop/bidding/index.js new file mode 100644 index 0000000..4126653 --- /dev/null +++ b/submodel/pages/shop/bidding/index.js @@ -0,0 +1,123 @@ +import { getBiddingActivityList } from "../../../api/ztb" +const util = require('../../../utils/util') +const event = require('../../../utils/event.js') +const app = getApp() +const status = ['', 0 ,1, 2, -1] + +Page({ + /** + * 页面的初始数据 + */ + data: { + height: app.globalData.fragmentHeight, + kg: app.globalData.kg, + loading: true, + requesting: false, + finished: false, + tabList: ['全部', '竞价中', '待下单', '已结束', '已流拍' ], + tabIndex: 0, + top: 0, + orderList: [], + form: { + status: '', + pageNum: 1, + pageSize:15 + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + height: app.globalData.fragmentHeight - 90, + kg: app.globalData.kg, + CustomBar: app.globalData.CustomBar + }) + event.on('EventMessage', this, this.onEvent) + this.fetchBiddingList() + }, + onEvent: function (message) { + if (message.what == 301 || message.what == 102) { + this.onRefreshList() + } + }, + onRefreshList: function () { + if (this.data.requesting) { + return + } + this.setData({ + orderList: [], + ['form.status']: this.data.form.status, + ['form.pageNum']: 1, + loading: true, + finished: false + }) + this.fetchBiddingList() + }, + fetchBiddingList: function () { + if (this.data.requesting || this.data.finished) { + return + } + if (this.data.loading) { + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } + getBiddingActivityList(this.data.form).then(result => { + if (result.data.records.length) { + var respList = result.data.records + let nowList = `orderList[${this.data.orderList.length}]` + var num = this.data.form.pageNum + var finished = this.data.form.pageNum >= result.data.pages + if(this.data.form.pageNum == 1){ + this.setData({ + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + top: 0, + finished, + requesting: false, + loading: false + }) + } else { + this.setData({ + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + finished, + requesting: false, + loading: false + }) + } + } else { + this.setData({ + finished: true, + requesting: false, + loading: false + }) + } + }).catch(err => { + //异常回调 + this.setData({ + requesting: false, + loading: false + }) + util.showToast(err) + }) + }, + lookItem: function (e) { + var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] + wx.navigateTo({ url: '/submodel/pages/bidding/detail/index?type=1&id=' + item.id }) + }, + onTabChange: function ({detail}) { + if (this.data.tabIndex == detail.index) { + return + } + this.data.tabIndex = detail.index + this.data.form.status = status[detail.index] + this.onRefreshList() + }, + onUnload: function(){ + event.remove('EventMessage', this) + } +}) \ No newline at end of file diff --git a/submodel/pages/shop/bidding/index.json b/submodel/pages/shop/bidding/index.json new file mode 100644 index 0000000..ee41d37 --- /dev/null +++ b/submodel/pages/shop/bidding/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "refresh-view": "/components/refresher/index", + "wux-tabi": "/components/tabi/index", + "wux-image": "/components/image/index", + "wux-divider": "/components/divider/index" + } +} \ No newline at end of file diff --git a/submodel/pages/shop/bidding/index.wxml b/submodel/pages/shop/bidding/index.wxml new file mode 100644 index 0000000..0546db5 --- /dev/null +++ b/submodel/pages/shop/bidding/index.wxml @@ -0,0 +1,65 @@ + + + + 竞价管理 + + + + + + + + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + + + + + + + 竞拍订单 + 起拍价:{{formate.formatePrice(item.initialUnitPrice,kg)}} + + 单号:{{item.id}} + + {{shop.orderBidding(item.status)}} + + + + + + + + + {{item.productSecondCategoryName}} + + + 库存:{{formate.formateWeight(item.stock, kg)}} + + + {{item.productSummary}} + + + + + + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + + \ No newline at end of file diff --git a/submodel/pages/shop/bidding/index.wxss b/submodel/pages/shop/bidding/index.wxss new file mode 100644 index 0000000..6885eb0 --- /dev/null +++ b/submodel/pages/shop/bidding/index.wxss @@ -0,0 +1,42 @@ +.item-content { + background-color: white; + padding: 24rpx 32rpx; +} + +.page-name { + font-size: 32rpx; + font-family: PingFang-SC-Medium, PingFang-SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 22px; +} + +.page-num { + font-size: 24rpx; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} + +.image-load { + width: 80px; + height: 80px; + display: flex; + align-items: center; + justify-content: center; +} + +.page-outline { + padding-top: 8rpx; + font-size: 26rpx; + 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: 3; + -webkit-box-orient: vertical; +} \ No newline at end of file diff --git a/submodel/pages/shop/bill/index.js b/submodel/pages/shop/bill/index.js new file mode 100644 index 0000000..1beec6b --- /dev/null +++ b/submodel/pages/shop/bill/index.js @@ -0,0 +1,99 @@ +import { getStoreWater } from "../../../api/ztb" +const util = require('../../../utils/util') +const app = getApp() + +Page({ + /** + * 页面的初始数据 + */ + data: { + height: app.globalData.fragmentHeight, + loading: true, + requesting: false, + finished: false, + top: 0, + orderList: [], + form: { + pageNum: 1, + pageSize:15 + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // wx.navigateTo({ url: options.url + '?' + options.key + '=' + options.value }) + this.setData({ + height: app.globalData.fragmentHeight + }) + this.fetchBillList() + }, + onRefreshList: function () { + if (this.data.requesting) { + return + } + this.setData({ + orderList: [], + ['form.pageNum']: 1, + loading: true, + finished: false + }) + this.fetchBillList() + }, + fetchBillList: function () { + if (this.data.requesting || this.data.finished) { + return + } + if (this.data.loading) { + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } + getStoreWater(this.data.form).then(result => { + if (result.data && result.data.records && result.data.records.length) { + var respList = result.data.records + let nowList = `orderList[${this.data.orderList.length}]` + var num = this.data.form.pageNum + var finished = this.data.form.pageNum >= result.data.pages + if(this.data.form.pageNum == 1){ + this.setData({ + [nowList]: respList, + ['form.pageNum']: (num + 1), + top: 0, + finished, + requesting: false, + loading: false + }) + } else { + this.setData({ + [nowList]: respList, + ['form.pageNum']: (num + 1), + finished, + requesting: false, + loading: false + }) + } + } else { + this.setData({ + finished: true, + requesting: false, + loading: false + }) + } + }).catch(err => { + //异常回调 + this.setData({ + requesting: false, + loading: false + }) + util.showToast(err) + }) + }, + lookItem: function (e) { + // var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] + // wx.navigateTo({ + // url: '/submodelpages/home/bill-detail/index?id=' + item.id + // }) + } +}) \ No newline at end of file diff --git a/submodel/pages/shop/bill/index.json b/submodel/pages/shop/bill/index.json new file mode 100644 index 0000000..0832291 --- /dev/null +++ b/submodel/pages/shop/bill/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "refresh-view": "/components/refresher/index", + "wux-divider": "/components/divider/index" + } +} \ No newline at end of file diff --git a/submodel/pages/shop/bill/index.wxml b/submodel/pages/shop/bill/index.wxml new file mode 100644 index 0000000..207bfab --- /dev/null +++ b/submodel/pages/shop/bill/index.wxml @@ -0,0 +1,40 @@ + + + 店铺收入 + + + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + + + + + {{item.type == 1 ? '一口价订单' : '竞价订单'}} + {{bill.billStatus(item.status)}} + + + 订单编号:{{item.orderNo}} + {{item.price}} + + + + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + + \ No newline at end of file diff --git a/submodel/pages/shop/bill/index.wxs b/submodel/pages/shop/bill/index.wxs new file mode 100644 index 0000000..c27b858 --- /dev/null +++ b/submodel/pages/shop/bill/index.wxs @@ -0,0 +1,14 @@ +function billStatus(status) { + if (status == 1) { + return '待结算' + } else if (status == 2) { + return '已结算' + } else if (status == 3) { + return '取消' + } + return '' +} + +module.exports = { + billStatus: billStatus +} \ No newline at end of file diff --git a/submodel/pages/shop/bill/index.wxss b/submodel/pages/shop/bill/index.wxss new file mode 100644 index 0000000..e0ecedb --- /dev/null +++ b/submodel/pages/shop/bill/index.wxss @@ -0,0 +1,11 @@ +.item-content { + background-color: white; + padding: 18rpx 24rpx; +} + +.page-num { + font-size: 24rpx; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} \ No newline at end of file diff --git a/submodel/pages/shop/create/index.js b/submodel/pages/shop/create/index.js new file mode 100644 index 0000000..afe520a --- /dev/null +++ b/submodel/pages/shop/create/index.js @@ -0,0 +1,134 @@ +// pages/shop/apply/index.js +import { updateStore, getStoreInfo, editStore } from "../../../api/ztb" +const util = require('../../../utils/util') +import regions from '../../../const/region' + +Page({ + /** + * 页面的初始数据 + */ + data: { + options: regions, + theme: 'energized', + warning: '注意:店铺资料审核后不可修改,请谨慎填写', + region: [440000, 440100, 440106], + form: { + contactPhoneNo: '', + name: '', + contacts: '', + locProvinceId: '', + locCityId: '', + locDistrictId: '', + locDetails: '' + }, + imgList: [], + requesting: false + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader') + if(options.storeId){ + this.data.form['storeId'] = options.storeId + wx.showLoading({ title: '加载中', mask: true }) + getStoreInfo(options.storeId).then(result => { + var fileList = [] + if(result.data.coverImgUrlList && result.data.coverImgUrlList.length){ + result.data.coverImgUrlList.forEach(element => { + fileList.push({ url: element, status: 8 }) + }) + } + this.setData({ + form: result.data, + imgList: fileList, + ['form.areaStr']: result.data.locProvinceName + ' ' + result.data.locCityName + ' ' + result.data.locDistrictName, + region: [result.data.locProvinceId, result.data.locCityId, result.data.locDistrictId] + }) + wx.hideLoading() + }).catch(err => { + //异常回调 + wx.hideLoading() + }) + } + }, + bindinput: function(e){ + this.data.form[e.target.id] = e.detail.value + }, + showRegion: function(){ + if(this.data.disabled){ + return + } + this.cascaderView.showPicker(this.data.region) + }, + onRegionChange: function (e) { + if (e.detail && e.detail.options) { + this.setData({ + ['form.areaStr']: e.detail.options.map((n) => n.label).join(' '), + region: e.detail.value + }) + this.data.form['locProvinceId'] = e.detail.value[0] + this.data.form['locCityId'] = e.detail.value[1] + this.data.form['locDistrictId'] = e.detail.value[2] + } + }, + onUploadChange: function(e){ + if(e.detail && e.detail.length){ + var list = [] + e.detail.forEach(element => { + if(!util.isEmpty(element.url)){ + list.push(element.url) + } + }) + this.data.form['coverImgUrlList'] = list + } + }, + submitForm: function(){ + if(util.isEmpty(this.data.form.name)){ + util.showToast('请输入店铺名称') + return + } + if(util.isEmpty(this.data.form.contacts)){ + util.showToast('请输入店主昵称') + return + } + if(util.isEmpty(this.data.form.contactPhoneNo)){ + util.showToast('请输入联系电话') + return + } + if(util.isEmpty(this.data.form.locDistrictId)){ + util.showToast('请选择店铺所在区域') + return + } + if(util.isEmpty(this.data.form.locDetails)){ + util.showToast('请输入店铺详细地址') + return + } + if(util.isEmpty(this.data.form.coverImgUrlList) || this.data.form.coverImgUrlList.length <= 0){ + util.showToast('请上传一张店铺图片') + return + } + this.setData({requesting: true}) + wx.showLoading({ title: '加载中', mask: true }) + if(!util.isEmpty(this.data.form.storeId)){ + editStore(this.data.form).then(result => { + wx.hideLoading() + util.showBackToast('店铺完善成功') + }).catch(err => { + wx.hideLoading() + util.showToast(err) + this.setData({requesting: false}) + }) + } else { + updateStore(this.data.form).then(result => { + wx.hideLoading() + util.showBackToast('店铺完善成功') + }).catch(err => { + wx.hideLoading() + util.showToast(err) + this.setData({requesting: false}) + }) + } + } + +}) \ No newline at end of file diff --git a/submodel/pages/shop/create/index.json b/submodel/pages/shop/create/index.json new file mode 100644 index 0000000..0d4b543 --- /dev/null +++ b/submodel/pages/shop/create/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "wux-button": "/components/button/index", + "wux-cascader": "/components/cascader/index", + "wux-uploader": "/components/uploader/index" + } +} \ No newline at end of file diff --git a/submodel/pages/shop/create/index.wxml b/submodel/pages/shop/create/index.wxml new file mode 100644 index 0000000..1998ab9 --- /dev/null +++ b/submodel/pages/shop/create/index.wxml @@ -0,0 +1,39 @@ + + + 完善店铺 + + + + 店铺名称: + + + + 店主昵称: + + + + 联系电话: + + + + + 所在地区: + {{form.areaStr||'请选择所在地区'}} + + + + + 详细地址: + + + + + {{!disabled?'上传或拍照店铺图片:':'店铺图片:'}} + + + + + 提交 + + + \ No newline at end of file diff --git a/submodel/pages/shop/create/index.wxss b/submodel/pages/shop/create/index.wxss new file mode 100644 index 0000000..031b355 --- /dev/null +++ b/submodel/pages/shop/create/index.wxss @@ -0,0 +1,4 @@ +/* pages/shop/apply/index.wxss */ +.margin-top{ + margin-top: 18rpx; +} \ No newline at end of file diff --git a/submodel/pages/shop/detail/index.js b/submodel/pages/shop/detail/index.js new file mode 100644 index 0000000..bcd7541 --- /dev/null +++ b/submodel/pages/shop/detail/index.js @@ -0,0 +1,150 @@ +// pages/shop/detail/index.js +import { getStoreInfo, getProductList, getStoreProductList } from "../../../api/ztb" +const math = require('../../../utils/math') +const util = require('../../../utils/util') +const app = getApp() + +Page({ + /** + * 页面的初始数据 + */ + data: { + height: app.globalData.fragmentHeight, + kg: app.globalData.kg, + imageHeight: 0, + imgList: [], + detail: null, + tabList: [ '供应', '采购', '联系'], + tabIndex: 0, + orderList: [], + loading: true, + requesting: false, + finished: false, + form: { + storeId: null, + pageNum: 1, + pageSize:15 + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.data.form.storeId = options.storeId + wx.showLoading({ title: '加载中', mask: true }) + getStoreInfo(options.storeId).then(result => { + this.setData({ + detail: result.data, + imgList: result.data.coverImgUrlList, + imageHeight: math.divide(math.times(750, 9), 16), + height: app.globalData.fragmentHeight, + kg: app.globalData.kg, + }) + wx.hideLoading() + }).catch(err => { + //异常回调 + wx.hideLoading() + }) + this.fetchGoodList() + }, + viewImage: function(event){ + wx.previewImage({ urls: this.data.imgList, current: event.currentTarget.dataset.url }) + }, + onTabChange: function({detail}){ + if (this.data.tabIndex == Number(detail.index)) { + return + } + this.data.tabIndex = Number(detail.index) + if(this.data.tabIndex != 2){ + this.onRefreshList() + } else { + this.setData({ tabIndex: this.data.tabIndex }) + } + }, + onRefreshList: function () { + if(this.data.tabIndex == 2){ + this.setData({ requesting: false }) + return + } + if (this.data.requesting) { + return + } + this.setData({ + orderList: [], + tabIndex: this.data.tabIndex, + ['form.pageNum']: 1, + loading: true, + finished: false + }) + this.fetchGoodList() + }, + fetchGoodList: function () { + if (this.data.requesting || this.data.finished) { + return + } + if (this.data.loading) { + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } + if(this.data.tabIndex == 0){ + getStoreProductList(this.data.form).then(result => { + this.doResult(result) + }).catch(err => { + this.setData({ requesting: false, loading: false }) + util.showToast(err) + }) + } else if(this.data.tabIndex == 1){ + getProductList(this.data.form).then(result => { + this.doResult(result) + }).catch(err => { + this.setData({ requesting: false, loading: false }) + util.showToast(err) + }) + } + }, + doResult: function(result){ + if (result.data.records.length) { + var respList = result.data.records + let nowList = `orderList[${this.data.orderList.length}]` + var num = this.data.form.pageNum + var finished = this.data.form.pageNum >= result.data.pages + if(this.data.form.pageNum == 1){ + this.setData({ + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + top: 0, + finished, + requesting: false, + loading: false + }) + } else { + this.setData({ + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + finished, + requesting: false, + loading: false + }) + } + } else { + this.setData({ + finished: true, + requesting: false, + loading: false + }) + } + }, + lookItem: function(event){ + var item = this.data.orderList[event.currentTarget.dataset.page][event.currentTarget.dataset.index] + if(item.bidType == 3){ + wx.navigateTo({ url: '/submodel/pages/purchase/detail/index?id=' + item.id }) + } else { + wx.navigateTo({ url: '/pages/mall/detail/index?id=' + item.id }) + } + } + +}) \ No newline at end of file diff --git a/submodel/pages/shop/detail/index.json b/submodel/pages/shop/detail/index.json new file mode 100644 index 0000000..ee41d37 --- /dev/null +++ b/submodel/pages/shop/detail/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "refresh-view": "/components/refresher/index", + "wux-tabi": "/components/tabi/index", + "wux-image": "/components/image/index", + "wux-divider": "/components/divider/index" + } +} \ No newline at end of file diff --git a/submodel/pages/shop/detail/index.wxml b/submodel/pages/shop/detail/index.wxml new file mode 100644 index 0000000..53cc44d --- /dev/null +++ b/submodel/pages/shop/detail/index.wxml @@ -0,0 +1,81 @@ + + + + 店铺详情 + + + + + + + + + + + + + + + + + + + + {{detail.name}} + + + + {{detail.locProvinceName}} {{detail.locCityName}} + + + + 店主昵称:{{detail.contacts}} + 店铺地址:{{detail.locDetails}} + 联系方式:{{detail.contactPhoneNo}} + + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + + + + + + + + + + + + {{item.secondCategoryName}} + + + + {{item.description || ''}} + + + {{item.unitPrice ? '¥' + formate.formatePrice(item.unitPrice, kg) : '价格面议'}} + 库存:{{formate.formateWeight(item.stock, kg)}} + + + + + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + + \ No newline at end of file diff --git a/submodel/pages/shop/detail/index.wxss b/submodel/pages/shop/detail/index.wxss new file mode 100644 index 0000000..8fc546c --- /dev/null +++ b/submodel/pages/shop/detail/index.wxss @@ -0,0 +1,75 @@ +/* pages/shop/detail/index.wxss */ +.margin-top { + margin-top: 18rpx; +} + +.detail-layout { + min-height: 90rpx; + font-size: 30rpx; + align-items: center; +} + +.info-layout { + position: absolute; + bottom: 0; + width: 100%; + background-color: rgba(0, 0, 0, 0.3); + padding: 18rpx 30rpx; +} + +.item-content { + height: 120px; + background: rgba(255, 255, 255, 1); + padding: 20rpx +} + +.page-name { + font-size: 32rpx; + font-family: PingFang-SC-Medium, PingFang-SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 22px; +} + +.page-num { + font-size: 24rpx; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} + +.page-outline { + margin-top: 8rpx; + font-size: 28rpx; + 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-price { + line-height: 30rpx; + font-size: 32rpx; + font-family: DINAlternate-Bold, DINAlternate; + font-weight: bold; + color: rgba(255, 66, 43, 1); +} + +.image-load { + width: 100px; + height: 100px; + display: flex; + align-items: center; + justify-content: center; +} + +.tag { + height: 40rpx; + padding: 2rpx 18rpx 4rpx 18rpx; +} \ No newline at end of file diff --git a/submodel/pages/shop/index/index.js b/submodel/pages/shop/index/index.js new file mode 100644 index 0000000..891d22e --- /dev/null +++ b/submodel/pages/shop/index/index.js @@ -0,0 +1,180 @@ +// pages/shop/index/index.js +import { getStoreOverView, getStoreInfo, depositStore } from "../../../api/ztb" +const math = require('../../../utils/math') +const util = require('../../../utils/util') +const tdsdk = require('../../../libs/tdweapp') +const app = getApp() + +Page({ + data: { + iconList: [ + { index: 0, icon: 'pick', color: 'gray', badge: 0, name: '我要卖货' }, + { index: 1, icon: 'edit', color: 'gray', badge: 0, name: '发布竞价' }, + { index: 5, icon: 'shop', color: 'gray', badge: 0, name: '编辑店铺' }, + { index: 7, icon: 'form', color: 'gray', badge: 0, name: '发布采购' } + ], + form: { + margin: 0, + todayMargin: 0, + todayMarginNum: 0 + }, + detail: null, + hasStore: 0, + status: null, + imageHeight: 0, + imgList: [] + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') + this.setData({ hasStore: app.globalData.userInfo.hasStore }) + }, + onShow: function () { + wx.showLoading({ title: '加载中', mask: true }) + // get/store-overview + getStoreOverView().then(result => { + //成功回调 + app.globalData.userInfo.hasStore = result.data.hasStore + this.setData({ form: result.data, hasStore: result.data.hasStore, status: result.data.status }) + this.data.status = result.data.status + if (this.data.hasStore && result.data.status != 2) { + this.showDialog() + } + if(this.data.form.storeId){ + getStoreInfo(this.data.form.storeId).then(res => { + this.setData({ detail: res.data, imgList: res.data.coverImgUrlList, imageHeight: math.divide(math.times(750, 9), 16)}) + wx.hideLoading() + }).catch(err => { + wx.hideLoading() + }) + } else { + wx.hideLoading() + } + }).catch(err => { + //异常回调 + wx.hideLoading() + }) + }, + showDialog: function(){ + this.wuxDialog.open({ + resetOnClose: true, + maskClosable: false, + title: '温馨提示', + content: '您还没有完善店铺信息,现在去善店铺信息?', + buttons: [{ + text: '取消' + }, { + text: '确定', + type: 'primary', + onTap(e) { + wx.navigateTo({ url: '/pages/shop/create/index' }) + } + }] + }) + }, + onClose: function(){ + this.setData({visible: false}) + }, + onImageClick: function(){ + this.setData({visible: false}) + wx.navigateTo({ url: '/pages/ztbvip/index' }) + }, + apllyShop: function(){ + if(!app.globalData.userInfo.isAuth){ + this.wuxDialog.open({ + resetOnClose: true, + title: '温馨提示', + content: '您还没有进行个人信息认证,无法开店,现在去进行个人信息认证?', + buttons: [{ + text: '确定', + type: 'primary', + onTap(e) { + wx.navigateTo({ url: '/pages/home/idcard/index' }) + } + }] + }) + return + } + if(!app.globalData.userInfo.isVIP){ + this.setData({visible: true}) + return + } + if (!app.globalData.userInfo.hasStore) { + if(this.data.form.status == 1){ + wx.navigateTo({ url: '/pages/shop/create/index' }) + } else { + wx.showLoading({ title: '加载中', mask: true }) + depositStore().then(result => { + //成功回调 + app.globalData.userInfo.hasStore = 1 + this.data.form.status == 1 + wx.hideLoading() + wx.navigateTo({ url: '/pages/shop/create/index' }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } + } else if(this.data.form.storeId){ + if(this.data.form.status == 2){ + wx.navigateTo({ url: '/pages/shop/detail/index?storeId=' + this.data.form.storeId }) + } else { + wx.navigateTo({ url: '/pages/shop/create/index' }) + } + } + }, + onGridTap: function (e) { + if (!app.globalData.userInfo.hasStore) { + this.wuxDialog.open({ + resetOnClose: true, + maskClosable: false, + title: '温馨提示', + content: '您还没有开店,请先申请开店吧!', + buttons: [ { + text: '确定', + type: 'primary' + }] + }) + return + } + if (this.data.form.status != 2) { + this.showDialog() + return + } + var index = e.currentTarget.dataset.index + if (index === 0) { + wx.navigateTo({ url: '/pages/goods/create/index?type=1' }) + } else if (index === 1) { + wx.navigateTo({ url: '/pages/goods/create/index?type=2' }) + } else if (index === 2) { + wx.navigateTo({ url: '/pages/shop/bidding/index' }) + } else if (index === 3) { + wx.navigateTo({ url: '/pages/goods/index/index' }) + } else if (index === 4) { + wx.navigateTo({ url: '/pages/shop/order/index?storeId=' + this.data.form.storeId }) + } else if (index === 5) { + wx.navigateTo({ url: '/pages/shop/create/index?storeId=' + this.data.form.storeId }) + } else if (index === 6) { + wx.navigateTo({ url: '/pages/shop/bill/index' }) + } else if (index === 7) { + wx.navigateTo({ url: '/submodel/pages/purchase/create/index' }) + } else if (index === 8) { + wx.navigateTo({ url: '/submodel/pages/purchase/index/index?storeId=' + this.data.form.storeId }) + } + }, + viewImage: function(e){ + wx.previewImage({ urls: this.data.imgList, current: e.currentTarget.dataset.url }); + }, + onShow: function () { + tdsdk.Page.onShow() + }, + onHide: function(){ + tdsdk.Page.onHide() + }, + onUnload: function () { + tdsdk.Page.onUnload() + } + +}) \ No newline at end of file diff --git a/submodel/pages/shop/index/index.json b/submodel/pages/shop/index/index.json new file mode 100644 index 0000000..543e9b5 --- /dev/null +++ b/submodel/pages/shop/index/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "wux-dialog": "/components/dialog/index", + "wux-button": "/components/button/index", + "wux-cell-group": "/components/cell-group/index", + "wux-cell": "/components/cell/index", + "wux-image": "/components/image/index", + "wux-popup": "/components/popup/index" + } +} \ No newline at end of file diff --git a/submodel/pages/shop/index/index.wxml b/submodel/pages/shop/index/index.wxml new file mode 100644 index 0000000..1bd924a --- /dev/null +++ b/submodel/pages/shop/index/index.wxml @@ -0,0 +1,81 @@ + + + 我的店铺 + + + + + + + + + + + + + 店主昵称:{{detail.contacts}}({{detail.contactPhoneNo}}) + 店铺地址:{{detail.locDetails}} + + + + + + + {{detail.name}} + + + + {{detail.locProvinceName}} {{detail.locCityName}} + + + + + {{ hasStore ? (status == 2 ? '我的店铺' : '完善店铺') : '申请开店' }} + + + + + + + {{item.badge>99?"99+":item.badge}} + + + {{item.name}} + + + + + + + + ¥{{form.todayMargin || 0}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/submodel/pages/shop/index/index.wxss b/submodel/pages/shop/index/index.wxss new file mode 100644 index 0000000..b9cc3e7 --- /dev/null +++ b/submodel/pages/shop/index/index.wxss @@ -0,0 +1,18 @@ +/* pages/shop/index/index.wxss */ +.margin-top { + margin-top: 18rpx; +} + +.detail-layout{ + min-height:90rpx; + font-size: 30rpx; + align-items: center; +} + +.info-layout { + position: absolute; + bottom: 0; + width: 100%; + background-color: rgba(0, 0, 0, 0.3); + padding: 18rpx 30rpx; +} \ No newline at end of file diff --git a/submodel/pages/shop/order/index.js b/submodel/pages/shop/order/index.js new file mode 100644 index 0000000..865a359 --- /dev/null +++ b/submodel/pages/shop/order/index.js @@ -0,0 +1,118 @@ +import { getStoreTradeList } from "../../../api/ztb" +const util = require('../../../utils/util') +const event = require('../../../utils/event.js') +const app = getApp() +const status = ['', 1, 2, 3, 4, 5, 6, 7, 8, 9] + +Page({ + + /** + * 页面的初始数据 + */ + data: { + height: app.globalData.fragmentHeight, + kg: app.globalData.kg, + loading: true, + requesting: false, + finished: false, + tabList: [ '全部', '待付诚意金', '待上传资料', '待上传资料确认', '待支付尾款', '待收货', '待扣点确认', '待退货确认', '已完成', '已关闭' ], + tabIndex: 0, + top: 0, + orderList: [], + form: { + storeId: '', + status: '', + pageNum: 1, + pageSize:15 + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + ['form.storeId']: options.storeId, + height: app.globalData.fragmentHeight - 90, + kg: app.globalData.kg, + CustomBar: app.globalData.CustomBar + }) + event.on('EventMessage', this, this.onEvent) + this.fetchOrderList() + }, + onEvent: function (message) { + if (message.what == 320) { + this.onRefreshList() + } + }, + onRefreshList: function () { + if (this.data.requesting) { + return + } + this.setData({ + orderList: [], + ['form.status']: this.data.form.status, + ['form.pageNum']: 1, + loading: true, + finished: false + }) + this.fetchOrderList() + }, + fetchOrderList: function () { + if (this.data.requesting || this.data.finished) { + return + } + if (this.data.loading) { + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } + getStoreTradeList(this.data.form).then(result => { + if (result.data.records.length) { + var respList = result.data.records + let nowList = `orderList[${this.data.orderList.length}]` + var num = this.data.form.pageNum + var finished = this.data.form.pageNum >= result.data.pages + if(this.data.form.pageNum == 1){ + this.setData({ + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + top: 0, + finished, + requesting: false, + loading: false + }) + } else { + this.setData({ + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + finished, + requesting: false, + loading: false + }) + } + } else { + this.setData({ finished: true, requesting: false, loading: false }) + } + }).catch(err => { + this.setData({ requesting: false, loading: false }) + util.showToast(err) + }) + }, + lookItem: function (e) { + var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] + wx.navigateTo({ url: '/submodel/pages/morder/detail/index?type=1&orderId=' + item.orderId }) + }, + onTabChange: function ({detail}) { + if (this.data.tabIndex == detail.index) { + return + } + this.data.tabIndex = detail.index + this.data.form.status = status[this.data.tabIndex] + this.onRefreshList() + }, + onUnload: function(){ + event.remove('EventMessage', this) + } +}) \ No newline at end of file diff --git a/submodel/pages/shop/order/index.json b/submodel/pages/shop/order/index.json new file mode 100644 index 0000000..ee41d37 --- /dev/null +++ b/submodel/pages/shop/order/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "refresh-view": "/components/refresher/index", + "wux-tabi": "/components/tabi/index", + "wux-image": "/components/image/index", + "wux-divider": "/components/divider/index" + } +} \ No newline at end of file diff --git a/submodel/pages/shop/order/index.wxml b/submodel/pages/shop/order/index.wxml new file mode 100644 index 0000000..b8ea019 --- /dev/null +++ b/submodel/pages/shop/order/index.wxml @@ -0,0 +1,67 @@ + + + + 订单管理 + + + + + + + + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + + + + + + + {{item.orderPlacerName}} + {{item.phone}} + + + + + + {{item.bidType == 1 ? '一口价' : '竞拍订单'}} + 单号:{{item.orderId}} + + {{shop.orderStatus(item.status)}} + + + + + + + + {{item.secondCategoryName}} + 单价:{{formate.formatePrice2(item.unitPrice, kg)}} + + + {{item.description}} + + + + + + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + + \ No newline at end of file diff --git a/submodel/pages/shop/order/index.wxss b/submodel/pages/shop/order/index.wxss new file mode 100644 index 0000000..e73febb --- /dev/null +++ b/submodel/pages/shop/order/index.wxss @@ -0,0 +1,50 @@ +.item-content { + background-color: white; + padding: 24rpx 32rpx; +} + +.page-name { + font-size: 32rpx; + font-family: PingFang-SC-Medium, PingFang-SC; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 22px; +} + +.page-num { + font-size: 24rpx; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} + +.image-load { + width: 80px; + height: 80px; + display: flex; + align-items: center; + justify-content: center; +} + +.page-outline { + padding-top: 8rpx; + font-size: 26rpx; + 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: 3; + -webkit-box-orient: vertical; +} + +.image-load { + width: 100px; + height: 100px; + display: flex; + align-items: center; + justify-content: center; +} diff --git a/submodel/pages/shop/shop.wxs b/submodel/pages/shop/shop.wxs new file mode 100644 index 0000000..663ac97 --- /dev/null +++ b/submodel/pages/shop/shop.wxs @@ -0,0 +1,40 @@ +function orderBidding(status) { + if (status == -1) { + return '已流拍' + } else if (status == 0) { + return '竞价中' + } else if (status == 1) { + return '待下单' + } else if (status == 2) { + return '已结束' + } + return '' +} + +function orderStatus(status) { + if (status == 1) { + return '待付诚意金' + } else if (status == 2) { + return '待上传资料' + } else if (status == 3) { + return '待上传资料确认' + } else if (status == 4) { + return '待支付尾款' + } else if (status == 5) { + return '待收货' + } else if (status == 6) { + return '待扣点确认' + } else if (status == 7) { + return '待退货确认' + } else if (status == 8) { + return '已完成' + } else if (status == 9) { + return '已关闭' + } + return '' +} + +module.exports = { + orderBidding: orderBidding, + orderStatus: orderStatus +} \ No newline at end of file