diff --git a/app.json b/app.json index ae83de2..2b5ccd7 100644 --- a/app.json +++ b/app.json @@ -14,8 +14,6 @@ "pages/home/tab4/index", "pages/home/tab5/index", "pages/home/tab6/index", - "pages/shop/index/index", - "pages/shop/create/index", "pages/shop/detail/index", "pages/shop/order/index", "pages/shop/bidding/index", diff --git a/pages/home/index/index.js b/pages/home/index/index.js index 8a7c664..e91be05 100644 --- a/pages/home/index/index.js +++ b/pages/home/index/index.js @@ -94,7 +94,7 @@ Component({ if (e.currentTarget.id == 'bidding') { util.navigateTo('/submodel/pages/bidding/index/index') } else if (e.currentTarget.id == 'shop') { - util.navigateTo('/pages/shop/index/index') + util.navigateTo('/submodel/pages/shop/index/index') } else if (e.currentTarget.id == 'ordering') { util.navigateTo('/submodel/pages/morder/index/index') } else if (e.currentTarget.id == 'agent') { diff --git a/pages/html/integral/index.js b/pages/html/integral/index.js index bcf7688..0717607 100644 --- a/pages/html/integral/index.js +++ b/pages/html/integral/index.js @@ -63,13 +63,13 @@ Page({ } if(targetView == 'createShop'){ // 开店铺 - wx.redirectTo({ url: '/pages/shop/index/index' }) + wx.redirectTo({ url: '/submodel/pages/shop/index/index' }) } else if(targetView == 'updateShopInfo'){ // 完善店铺 - wx.redirectTo({ url: '/pages/shop/index/index' }) + wx.redirectTo({ url: '/submodel/pages/shop/index/index' }) } else if(targetView == 'createProduct'){ // 发布商品 - wx.redirectTo({ url: '/pages/shop/index/index' }) + wx.redirectTo({ url: '/submodel/pages/shop/index/index' }) } else if(targetView == 'replyArticle'){ // 回复帖子 wx.navigateBack({ delta: 1 }) diff --git a/pages/shop/index/index.js b/pages/shop/index/index.js deleted file mode 100644 index c05ecf5..0000000 --- a/pages/shop/index/index.js +++ /dev/null @@ -1,179 +0,0 @@ -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/pages/shop/index/index.json b/pages/shop/index/index.json deleted file mode 100644 index 543e9b5..0000000 --- a/pages/shop/index/index.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "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/pages/shop/index/index.wxml b/pages/shop/index/index.wxml deleted file mode 100644 index ffb85d2..0000000 --- a/pages/shop/index/index.wxml +++ /dev/null @@ -1,80 +0,0 @@ - - 我的店铺 - - - - - - - - - - - - - 店主昵称:{{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/pages/shop/index/index.wxss b/pages/shop/index/index.wxss deleted file mode 100644 index d443ee2..0000000 --- a/pages/shop/index/index.wxss +++ /dev/null @@ -1,17 +0,0 @@ -.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/create/index.js b/submodel/pages/shop/create/index.js deleted file mode 100644 index 365ae56..0000000 --- a/submodel/pages/shop/create/index.js +++ /dev/null @@ -1,134 +0,0 @@ -// 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 deleted file mode 100644 index 0d4b543..0000000 --- a/submodel/pages/shop/create/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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 deleted file mode 100644 index f4bdd7b..0000000 --- a/submodel/pages/shop/create/index.wxml +++ /dev/null @@ -1,38 +0,0 @@ - - 完善店铺 - - - - 店铺名称: - - - - 店主昵称: - - - - 联系电话: - - - - - 所在地区: - {{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 deleted file mode 100644 index 031b355..0000000 --- a/submodel/pages/shop/create/index.wxss +++ /dev/null @@ -1,4 +0,0 @@ -/* 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 index bcd7541..9486374 100644 --- a/submodel/pages/shop/detail/index.js +++ b/submodel/pages/shop/detail/index.js @@ -1,7 +1,6 @@ -// pages/shop/detail/index.js -import { getStoreInfo, getProductList, getStoreProductList } from "../../../api/ztb" -const math = require('../../../utils/math') -const util = require('../../../utils/util') +import { getStoreInfo, getProductList, getStoreProductList } from "../../../../api/ztb" +const math = require('../../../../utils/math') +const util = require('../../../../utils/util') const app = getApp() Page({ diff --git a/submodel/pages/shop/detail/index.wxml b/submodel/pages/shop/detail/index.wxml index 53cc44d..2790f7a 100644 --- a/submodel/pages/shop/detail/index.wxml +++ b/submodel/pages/shop/detail/index.wxml @@ -1,5 +1,5 @@ - + 店铺详情 diff --git a/submodel/pages/shop/detail/index.wxss b/submodel/pages/shop/detail/index.wxss index 8fc546c..cd1d25e 100644 --- a/submodel/pages/shop/detail/index.wxss +++ b/submodel/pages/shop/detail/index.wxss @@ -1,4 +1,3 @@ -/* pages/shop/detail/index.wxss */ .margin-top { margin-top: 18rpx; } diff --git a/submodel/pages/shop/index/index.js b/submodel/pages/shop/index/index.js index c05ecf5..3c03172 100644 --- a/submodel/pages/shop/index/index.js +++ b/submodel/pages/shop/index/index.js @@ -1,7 +1,7 @@ -import { getStoreOverView, getStoreInfo, depositStore } from "../../../api/ztb" -const math = require('../../../utils/math') -const util = require('../../../utils/util') -const tdsdk = require('../../../libs/tdweapp') +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({ @@ -68,7 +68,7 @@ Page({ text: '确定', type: 'primary', onTap(e) { - wx.navigateTo({ url: '/pages/shop/create/index' }) + wx.navigateTo({ url: '/submodel/pages/shop/create/index' }) } }] }) @@ -100,9 +100,10 @@ Page({ this.setData({visible: true}) return } + console.log(app.globalData.userInfo) if (!app.globalData.userInfo.hasStore) { if(this.data.form.status == 1){ - wx.navigateTo({ url: '/pages/shop/create/index' }) + wx.navigateTo({ url: '/submodel/pages/shop/create/index' }) } else { wx.showLoading({ title: '加载中', mask: true }) depositStore().then(result => { @@ -110,7 +111,7 @@ Page({ app.globalData.userInfo.hasStore = 1 this.data.form.status == 1 wx.hideLoading() - wx.navigateTo({ url: '/pages/shop/create/index' }) + wx.navigateTo({ url: '/submodel/pages/shop/create/index' }) }).catch(err => { wx.hideLoading() util.showToast(err) @@ -120,8 +121,10 @@ Page({ 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' }) + wx.navigateTo({ url: '/submodel/pages/shop/create/index' }) } + } else { + wx.navigateTo({ url: '/submodel/pages/shop/create/index' }) } }, onGridTap: function (e) { @@ -154,7 +157,7 @@ Page({ } 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 }) + wx.navigateTo({ url: '/submodel/pages/shop/create/index?storeId=' + this.data.form.storeId }) } else if (index === 6) { wx.navigateTo({ url: '/pages/shop/bill/index' }) } else if (index === 7) { diff --git a/submodel/pages/shop/order/index.js b/submodel/pages/shop/order/index.js index 865a359..60b1767 100644 --- a/submodel/pages/shop/order/index.js +++ b/submodel/pages/shop/order/index.js @@ -1,6 +1,6 @@ -import { getStoreTradeList } from "../../../api/ztb" -const util = require('../../../utils/util') -const event = require('../../../utils/event.js') +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] diff --git a/submodel/pages/shop/order/index.wxml b/submodel/pages/shop/order/index.wxml index b8ea019..8872fb7 100644 --- a/submodel/pages/shop/order/index.wxml +++ b/submodel/pages/shop/order/index.wxml @@ -1,5 +1,5 @@ - + 订单管理 diff --git a/utils/util.js b/utils/util.js index 54ed45e..89911c2 100644 --- a/utils/util.js +++ b/utils/util.js @@ -166,7 +166,7 @@ function checkId(id) { const tokenList = [ '/submodel/pages/paper/price-index/index', - '/pages/shop/index/index', + '/submodel/pages/shop/index/index', '/submodel/pages/bidding/index/index', '/submodel/pages/morder/index/index', '/pages/html/message/index', @@ -244,7 +244,7 @@ function navigateTarget(redirectInfo){ } else if(redirectInfo.targetView == 'myBidList'){ navigateTo('/submodel/pages/bidding/index/index') } else if(redirectInfo.targetView == 'myShop'){ - navigateTo('/pages/shop/index/index') + navigateTo('/submodel/pages/shop/index/index') } else if(redirectInfo.targetView == 'buyerOrderList'){ navigateTo('/submodel/pages/morder/index/index') } else if(redirectInfo.targetView == 'createArticle'){