diff --git a/app.json b/app.json index a934f79..8a297d8 100644 --- a/app.json +++ b/app.json @@ -1,23 +1,50 @@ { "pages": [ "pages/index/index", - "pages/cardList/cardList", - "pages/cardDetail/cardDetail", + "pages/serve/index/index", "pages/mine/index/index", - "pages/moments/publish/momentpublish", - "pages/moments/edit/momentedit", - "pages/moments/list/momentslist", - "pages/moments/publish/momentpublishline", "pages/mine/myCard/myCard", "pages/mine/myCardDetail/myCardDetail", - "pages/sharePage/sharePage", "pages/mine/otherCard/othercarddetail", - "pages/moments/list/momentsshowlist", - "pages/moments/momentsdetail/momentsdetail", - "pages/moments/showlist/showlist", "pages/mine/setting/columnsetting", - "pages/serve/index/index" + "pages/mine/shop/shopedit", + "pages/mine/shop/shopauthentication", + "pages/mine/shop/shopauthenticationedit", + "pages/mine/shop/shopauthenticationdetail", + "pages/mine/shop/addshop", + "pages/mine/shop/choosetrade", + "pages/mine/shop/mineshop", + "pages/mine/shop/mineshopdetail", + "pages/mine/manage/shopstaff", + "pages/mine/manage/shopmember", + "pages/mine/manage/shopposition", + "pages/mine/manage/addposition", + "pages/mine/product/catalogmanage/catalogmanage", + "pages/mine/product/catalogmanage/addcatalog", + "pages/mine/product/productmanage/addproduct", + "pages/mine/product/productmanage/productlist", + "pages/mine/product/productmanage/choosecatalog", + "pages/mine/product/productmanage/productmanage", + "pages/mine/product/productmanage/searchproduct", + "pages/mine/order/ordersuccess", + "pages/mine/order/orderlist", + "pages/mine/order/orderdetail" ], + "subPackages": [{ + "root": "packagecard", + "pages": [ + "cardList/cardList", + "cardDetail/cardDetail", + "moments/publish/momentpublish", + "moments/edit/momentedit", + "moments/list/momentslist", + "moments/publish/momentpublishline", + "sharePage/sharePage", + "moments/list/momentsshowlist", + "moments/momentsdetail/momentsdetail", + "moments/showlist/showlist" + ] + }], "window": { "backgroundTextStyle": "dark", "navigationBarBackgroundColor": "#fff", diff --git a/images/ic_empty_data.png b/images/ic_empty_data.png index d4e1174..e24d154 100644 Binary files a/images/ic_empty_data.png and b/images/ic_empty_data.png differ diff --git a/images/ic_empty_desc.png b/images/ic_empty_desc.png index f350c93..c5dae0c 100644 Binary files a/images/ic_empty_desc.png and b/images/ic_empty_desc.png differ diff --git a/images/ic_empty_map.png b/images/ic_empty_map.png index e5e9f4c..ed86dd6 100644 Binary files a/images/ic_empty_map.png and b/images/ic_empty_map.png differ diff --git a/images/ic_empty_text.png b/images/ic_empty_text.png index f8eb158..e0c7142 100644 Binary files a/images/ic_empty_text.png and b/images/ic_empty_text.png differ diff --git a/images/ic_empty_voice.png b/images/ic_empty_voice.png index 27f40c5..ed6a977 100644 Binary files a/images/ic_empty_voice.png and b/images/ic_empty_voice.png differ diff --git a/images/ic_order_close.png b/images/ic_order_close.png new file mode 100644 index 0000000..c64a3d1 Binary files /dev/null and b/images/ic_order_close.png differ diff --git a/images/ic_order_finish.png b/images/ic_order_finish.png new file mode 100644 index 0000000..e56cf5e Binary files /dev/null and b/images/ic_order_finish.png differ diff --git a/images/ic_order_pay.png b/images/ic_order_pay.png new file mode 100644 index 0000000..90c55c0 Binary files /dev/null and b/images/ic_order_pay.png differ diff --git a/images/ic_order_wait_pay.png b/images/ic_order_wait_pay.png new file mode 100644 index 0000000..a3e3ff5 Binary files /dev/null and b/images/ic_order_wait_pay.png differ diff --git a/images/ic_success.png b/images/ic_success.png new file mode 100644 index 0000000..57c15d0 Binary files /dev/null and b/images/ic_success.png differ diff --git a/images/templete_1.png b/images/templete_1.png new file mode 100644 index 0000000..e157a90 Binary files /dev/null and b/images/templete_1.png differ diff --git a/images/templete_2.png b/images/templete_2.png new file mode 100644 index 0000000..1d0fc11 Binary files /dev/null and b/images/templete_2.png differ diff --git a/images/templete_3.png b/images/templete_3.png new file mode 100644 index 0000000..80bd2e2 Binary files /dev/null and b/images/templete_3.png differ diff --git a/images/templete_4.png b/images/templete_4.png new file mode 100644 index 0000000..1125592 Binary files /dev/null and b/images/templete_4.png differ diff --git a/pages/cardDetail/cardDetail.js b/packagecard/cardDetail/cardDetail.js similarity index 100% rename from pages/cardDetail/cardDetail.js rename to packagecard/cardDetail/cardDetail.js diff --git a/pages/cardDetail/cardDetail.json b/packagecard/cardDetail/cardDetail.json similarity index 100% rename from pages/cardDetail/cardDetail.json rename to packagecard/cardDetail/cardDetail.json diff --git a/pages/cardDetail/cardDetail.wxml b/packagecard/cardDetail/cardDetail.wxml similarity index 100% rename from pages/cardDetail/cardDetail.wxml rename to packagecard/cardDetail/cardDetail.wxml diff --git a/pages/cardDetail/cardDetail.wxss b/packagecard/cardDetail/cardDetail.wxss similarity index 100% rename from pages/cardDetail/cardDetail.wxss rename to packagecard/cardDetail/cardDetail.wxss diff --git a/packagecard/cardList/cardList.js b/packagecard/cardList/cardList.js new file mode 100644 index 0000000..c0bbd55 --- /dev/null +++ b/packagecard/cardList/cardList.js @@ -0,0 +1,63 @@ +const app = getApp() +// pages/list/list.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + cardUrl: app.cardUrl, + cardList: [] + }, + getList: function () { + var self = this + wx.showNavigationBarLoading() + app.http.get(app.urls.getCardList, { + header: { + token: app.globalData.token + } + }).then(res => { + self.setData({ + cardList: res.data + }) + wx.hideNavigationBarLoading() //完成停止加载 + wx.stopPullDownRefresh() //停止下拉刷新 + }) + .catch(err => { + wx.hideNavigationBarLoading() //完成停止加载 + wx.stopPullDownRefresh() //停止下拉刷新 + }) + }, + goDetail: function (e) { + var id = e.currentTarget.dataset.id + console.log(id) + wx.navigateTo({ + url: '../cardDetail/cardDetail?id=' + id, + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var self = this + wx.getStorage({ + key: 'token', + success: function (res) { + self.setData({ + token: res.data + }) + app.globalData.token = res.data + self.getList() + } + }) + }, + + + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + this.getList() + }, +}) \ No newline at end of file diff --git a/pages/cardList/cardList.json b/packagecard/cardList/cardList.json similarity index 100% rename from pages/cardList/cardList.json rename to packagecard/cardList/cardList.json diff --git a/pages/cardList/cardList.wxml b/packagecard/cardList/cardList.wxml similarity index 100% rename from pages/cardList/cardList.wxml rename to packagecard/cardList/cardList.wxml diff --git a/pages/cardList/cardList.wxss b/packagecard/cardList/cardList.wxss similarity index 100% rename from pages/cardList/cardList.wxss rename to packagecard/cardList/cardList.wxss diff --git a/pages/common/webpage/webpage.js b/packagecard/common/webpage/webpage.js similarity index 100% rename from pages/common/webpage/webpage.js rename to packagecard/common/webpage/webpage.js diff --git a/pages/common/webpage/webpage.json b/packagecard/common/webpage/webpage.json similarity index 100% rename from pages/common/webpage/webpage.json rename to packagecard/common/webpage/webpage.json diff --git a/pages/common/webpage/webpage.wxml b/packagecard/common/webpage/webpage.wxml similarity index 100% rename from pages/common/webpage/webpage.wxml rename to packagecard/common/webpage/webpage.wxml diff --git a/pages/common/webpage/webpage.wxss b/packagecard/common/webpage/webpage.wxss similarity index 100% rename from pages/common/webpage/webpage.wxss rename to packagecard/common/webpage/webpage.wxss diff --git a/pages/moments/edit/momentedit.js b/packagecard/moments/edit/momentedit.js similarity index 100% rename from pages/moments/edit/momentedit.js rename to packagecard/moments/edit/momentedit.js diff --git a/pages/moments/edit/momentedit.json b/packagecard/moments/edit/momentedit.json similarity index 100% rename from pages/moments/edit/momentedit.json rename to packagecard/moments/edit/momentedit.json diff --git a/pages/moments/edit/momentedit.wxml b/packagecard/moments/edit/momentedit.wxml similarity index 100% rename from pages/moments/edit/momentedit.wxml rename to packagecard/moments/edit/momentedit.wxml diff --git a/pages/moments/edit/momentedit.wxss b/packagecard/moments/edit/momentedit.wxss similarity index 100% rename from pages/moments/edit/momentedit.wxss rename to packagecard/moments/edit/momentedit.wxss diff --git a/pages/moments/list/momentslist.js b/packagecard/moments/list/momentslist.js similarity index 100% rename from pages/moments/list/momentslist.js rename to packagecard/moments/list/momentslist.js diff --git a/pages/moments/list/momentslist.json b/packagecard/moments/list/momentslist.json similarity index 100% rename from pages/moments/list/momentslist.json rename to packagecard/moments/list/momentslist.json diff --git a/pages/moments/list/momentslist.wxml b/packagecard/moments/list/momentslist.wxml similarity index 100% rename from pages/moments/list/momentslist.wxml rename to packagecard/moments/list/momentslist.wxml diff --git a/pages/moments/list/momentslist.wxss b/packagecard/moments/list/momentslist.wxss similarity index 100% rename from pages/moments/list/momentslist.wxss rename to packagecard/moments/list/momentslist.wxss diff --git a/pages/moments/list/momentsshowlist.js b/packagecard/moments/list/momentsshowlist.js similarity index 100% rename from pages/moments/list/momentsshowlist.js rename to packagecard/moments/list/momentsshowlist.js diff --git a/pages/moments/list/momentsshowlist.json b/packagecard/moments/list/momentsshowlist.json similarity index 100% rename from pages/moments/list/momentsshowlist.json rename to packagecard/moments/list/momentsshowlist.json diff --git a/pages/moments/list/momentsshowlist.wxml b/packagecard/moments/list/momentsshowlist.wxml similarity index 100% rename from pages/moments/list/momentsshowlist.wxml rename to packagecard/moments/list/momentsshowlist.wxml diff --git a/pages/moments/list/momentsshowlist.wxss b/packagecard/moments/list/momentsshowlist.wxss similarity index 100% rename from pages/moments/list/momentsshowlist.wxss rename to packagecard/moments/list/momentsshowlist.wxss diff --git a/pages/moments/momentsdetail/momentsdetail.js b/packagecard/moments/momentsdetail/momentsdetail.js similarity index 99% rename from pages/moments/momentsdetail/momentsdetail.js rename to packagecard/moments/momentsdetail/momentsdetail.js index 5d39300..7c55ba5 100644 --- a/pages/moments/momentsdetail/momentsdetail.js +++ b/packagecard/moments/momentsdetail/momentsdetail.js @@ -308,7 +308,7 @@ Page({ // 跳转模板列表 goList: function () { wx.navigateTo({ - url: '../cardList/cardList', + url: 'packagecard/cardList/cardList', }) }, // 获取个人简介 diff --git a/pages/moments/momentsdetail/momentsdetail.json b/packagecard/moments/momentsdetail/momentsdetail.json similarity index 100% rename from pages/moments/momentsdetail/momentsdetail.json rename to packagecard/moments/momentsdetail/momentsdetail.json diff --git a/pages/moments/momentsdetail/momentsdetail.wxml b/packagecard/moments/momentsdetail/momentsdetail.wxml similarity index 100% rename from pages/moments/momentsdetail/momentsdetail.wxml rename to packagecard/moments/momentsdetail/momentsdetail.wxml diff --git a/pages/moments/momentsdetail/momentsdetail.wxss b/packagecard/moments/momentsdetail/momentsdetail.wxss similarity index 100% rename from pages/moments/momentsdetail/momentsdetail.wxss rename to packagecard/moments/momentsdetail/momentsdetail.wxss diff --git a/pages/moments/publish/momentpublish.js b/packagecard/moments/publish/momentpublish.js similarity index 96% rename from pages/moments/publish/momentpublish.js rename to packagecard/moments/publish/momentpublish.js index f85256f..1215a15 100644 --- a/pages/moments/publish/momentpublish.js +++ b/packagecard/moments/publish/momentpublish.js @@ -42,35 +42,6 @@ Page({ speedStep: 5, //快进快退秒数 setInter: '', //定时器 currentItem: undefined, - items: [{ - title: '标题', //标题 - count: 3, //数量 - type: 'TEXT', //类型 - }, { - title: '标题', //标题 - count: 9, //数量 - type: 'TEXTAREA', //类型 - }, { - title: '标题', //标题 - count: 2, //数量 - type: 'AUDIO', //类型 - }, { - title: '标题', //标题 - count: 3, //数量 - type: 'VIDEO', //类型 - }, { - title: '标题', //标题 - count: 9, //数量 - type: 'PHOTO', //类型 - }, { - title: '标题', //标题 - count: 9, //数量 - type: 'LINK', //类型 - }, { - title: '标题', //标题 - count: 2, //数量 - type: 'LOCATION', //类型 - }], isAuthAudio: false }, diff --git a/pages/moments/publish/momentpublish.json b/packagecard/moments/publish/momentpublish.json similarity index 100% rename from pages/moments/publish/momentpublish.json rename to packagecard/moments/publish/momentpublish.json diff --git a/pages/moments/publish/momentpublish.wxml b/packagecard/moments/publish/momentpublish.wxml similarity index 100% rename from pages/moments/publish/momentpublish.wxml rename to packagecard/moments/publish/momentpublish.wxml diff --git a/pages/moments/publish/momentpublish.wxss b/packagecard/moments/publish/momentpublish.wxss similarity index 100% rename from pages/moments/publish/momentpublish.wxss rename to packagecard/moments/publish/momentpublish.wxss diff --git a/pages/moments/publish/momentpublishline.js b/packagecard/moments/publish/momentpublishline.js similarity index 100% rename from pages/moments/publish/momentpublishline.js rename to packagecard/moments/publish/momentpublishline.js diff --git a/pages/moments/publish/momentpublishline.json b/packagecard/moments/publish/momentpublishline.json similarity index 100% rename from pages/moments/publish/momentpublishline.json rename to packagecard/moments/publish/momentpublishline.json diff --git a/pages/moments/publish/momentpublishline.wxml b/packagecard/moments/publish/momentpublishline.wxml similarity index 100% rename from pages/moments/publish/momentpublishline.wxml rename to packagecard/moments/publish/momentpublishline.wxml diff --git a/pages/moments/publish/momentpublishline.wxss b/packagecard/moments/publish/momentpublishline.wxss similarity index 100% rename from pages/moments/publish/momentpublishline.wxss rename to packagecard/moments/publish/momentpublishline.wxss diff --git a/pages/moments/showlist/showlist.js b/packagecard/moments/showlist/showlist.js similarity index 100% rename from pages/moments/showlist/showlist.js rename to packagecard/moments/showlist/showlist.js diff --git a/pages/moments/showlist/showlist.json b/packagecard/moments/showlist/showlist.json similarity index 100% rename from pages/moments/showlist/showlist.json rename to packagecard/moments/showlist/showlist.json diff --git a/pages/moments/showlist/showlist.wxml b/packagecard/moments/showlist/showlist.wxml similarity index 100% rename from pages/moments/showlist/showlist.wxml rename to packagecard/moments/showlist/showlist.wxml diff --git a/pages/moments/showlist/showlist.wxss b/packagecard/moments/showlist/showlist.wxss similarity index 100% rename from pages/moments/showlist/showlist.wxss rename to packagecard/moments/showlist/showlist.wxss diff --git a/packagecard/pages/cardDetail/cardDetail.js b/packagecard/pages/cardDetail/cardDetail.js new file mode 100644 index 0000000..480269a --- /dev/null +++ b/packagecard/pages/cardDetail/cardDetail.js @@ -0,0 +1,66 @@ +// packagecard/pages/cardDetail/cardDetail.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/sharePage/sharePage.json b/packagecard/pages/cardDetail/cardDetail.json similarity index 100% rename from pages/sharePage/sharePage.json rename to packagecard/pages/cardDetail/cardDetail.json diff --git a/packagecard/pages/cardDetail/cardDetail.wxml b/packagecard/pages/cardDetail/cardDetail.wxml new file mode 100644 index 0000000..01a893f --- /dev/null +++ b/packagecard/pages/cardDetail/cardDetail.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/cardDetail/cardDetail.wxml diff --git a/packagecard/pages/cardDetail/cardDetail.wxss b/packagecard/pages/cardDetail/cardDetail.wxss new file mode 100644 index 0000000..cd13f9b --- /dev/null +++ b/packagecard/pages/cardDetail/cardDetail.wxss @@ -0,0 +1 @@ +/* packagecard/pages/cardDetail/cardDetail.wxss */ \ No newline at end of file diff --git a/packagecard/pages/cardList/cardList.js b/packagecard/pages/cardList/cardList.js new file mode 100644 index 0000000..6072872 --- /dev/null +++ b/packagecard/pages/cardList/cardList.js @@ -0,0 +1,66 @@ +// packagecard/pages/cardList/cardList.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/cardList/cardList.json b/packagecard/pages/cardList/cardList.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/cardList/cardList.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/cardList/cardList.wxml b/packagecard/pages/cardList/cardList.wxml new file mode 100644 index 0000000..971cb1d --- /dev/null +++ b/packagecard/pages/cardList/cardList.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/cardList/cardList.wxml diff --git a/packagecard/pages/cardList/cardList.wxss b/packagecard/pages/cardList/cardList.wxss new file mode 100644 index 0000000..661fde8 --- /dev/null +++ b/packagecard/pages/cardList/cardList.wxss @@ -0,0 +1 @@ +/* packagecard/pages/cardList/cardList.wxss */ \ No newline at end of file diff --git a/packagecard/pages/moments/edit/momentedit.js b/packagecard/pages/moments/edit/momentedit.js new file mode 100644 index 0000000..e6fed8b --- /dev/null +++ b/packagecard/pages/moments/edit/momentedit.js @@ -0,0 +1,66 @@ +// packagecard/pages/moments/edit/momentedit.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/moments/edit/momentedit.json b/packagecard/pages/moments/edit/momentedit.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/moments/edit/momentedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/moments/edit/momentedit.wxml b/packagecard/pages/moments/edit/momentedit.wxml new file mode 100644 index 0000000..8b40299 --- /dev/null +++ b/packagecard/pages/moments/edit/momentedit.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/moments/edit/momentedit.wxml diff --git a/packagecard/pages/moments/edit/momentedit.wxss b/packagecard/pages/moments/edit/momentedit.wxss new file mode 100644 index 0000000..93295c6 --- /dev/null +++ b/packagecard/pages/moments/edit/momentedit.wxss @@ -0,0 +1 @@ +/* packagecard/pages/moments/edit/momentedit.wxss */ \ No newline at end of file diff --git a/packagecard/pages/moments/list/momentslist.js b/packagecard/pages/moments/list/momentslist.js new file mode 100644 index 0000000..5f7d7f3 --- /dev/null +++ b/packagecard/pages/moments/list/momentslist.js @@ -0,0 +1,66 @@ +// packagecard/pages/moments/list/momentslist.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/moments/list/momentslist.json b/packagecard/pages/moments/list/momentslist.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/moments/list/momentslist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/moments/list/momentslist.wxml b/packagecard/pages/moments/list/momentslist.wxml new file mode 100644 index 0000000..9fc2489 --- /dev/null +++ b/packagecard/pages/moments/list/momentslist.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/moments/list/momentslist.wxml diff --git a/packagecard/pages/moments/list/momentslist.wxss b/packagecard/pages/moments/list/momentslist.wxss new file mode 100644 index 0000000..be1841f --- /dev/null +++ b/packagecard/pages/moments/list/momentslist.wxss @@ -0,0 +1 @@ +/* packagecard/pages/moments/list/momentslist.wxss */ \ No newline at end of file diff --git a/packagecard/pages/moments/list/momentsshowlist.js b/packagecard/pages/moments/list/momentsshowlist.js new file mode 100644 index 0000000..9085815 --- /dev/null +++ b/packagecard/pages/moments/list/momentsshowlist.js @@ -0,0 +1,66 @@ +// packagecard/pages/moments/list/momentsshowlist.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/moments/list/momentsshowlist.json b/packagecard/pages/moments/list/momentsshowlist.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/moments/list/momentsshowlist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/moments/list/momentsshowlist.wxml b/packagecard/pages/moments/list/momentsshowlist.wxml new file mode 100644 index 0000000..94f6b81 --- /dev/null +++ b/packagecard/pages/moments/list/momentsshowlist.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/moments/list/momentsshowlist.wxml diff --git a/packagecard/pages/moments/list/momentsshowlist.wxss b/packagecard/pages/moments/list/momentsshowlist.wxss new file mode 100644 index 0000000..2f9d7a9 --- /dev/null +++ b/packagecard/pages/moments/list/momentsshowlist.wxss @@ -0,0 +1 @@ +/* packagecard/pages/moments/list/momentsshowlist.wxss */ \ No newline at end of file diff --git a/packagecard/pages/moments/momentsdetail/momentsdetail.js b/packagecard/pages/moments/momentsdetail/momentsdetail.js new file mode 100644 index 0000000..493fbf7 --- /dev/null +++ b/packagecard/pages/moments/momentsdetail/momentsdetail.js @@ -0,0 +1,66 @@ +// packagecard/pages/moments/momentsdetail/momentsdetail.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/moments/momentsdetail/momentsdetail.json b/packagecard/pages/moments/momentsdetail/momentsdetail.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/moments/momentsdetail/momentsdetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/moments/momentsdetail/momentsdetail.wxml b/packagecard/pages/moments/momentsdetail/momentsdetail.wxml new file mode 100644 index 0000000..5a18c0e --- /dev/null +++ b/packagecard/pages/moments/momentsdetail/momentsdetail.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/moments/momentsdetail/momentsdetail.wxml diff --git a/packagecard/pages/moments/momentsdetail/momentsdetail.wxss b/packagecard/pages/moments/momentsdetail/momentsdetail.wxss new file mode 100644 index 0000000..fe25e94 --- /dev/null +++ b/packagecard/pages/moments/momentsdetail/momentsdetail.wxss @@ -0,0 +1 @@ +/* packagecard/pages/moments/momentsdetail/momentsdetail.wxss */ \ No newline at end of file diff --git a/packagecard/pages/moments/publish/momentpublish.js b/packagecard/pages/moments/publish/momentpublish.js new file mode 100644 index 0000000..3fd61a9 --- /dev/null +++ b/packagecard/pages/moments/publish/momentpublish.js @@ -0,0 +1,66 @@ +// packagecard/pages/moments/publish/momentpublish.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/moments/publish/momentpublish.json b/packagecard/pages/moments/publish/momentpublish.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/moments/publish/momentpublish.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/moments/publish/momentpublish.wxml b/packagecard/pages/moments/publish/momentpublish.wxml new file mode 100644 index 0000000..f4d2a50 --- /dev/null +++ b/packagecard/pages/moments/publish/momentpublish.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/moments/publish/momentpublish.wxml diff --git a/packagecard/pages/moments/publish/momentpublish.wxss b/packagecard/pages/moments/publish/momentpublish.wxss new file mode 100644 index 0000000..d0532f4 --- /dev/null +++ b/packagecard/pages/moments/publish/momentpublish.wxss @@ -0,0 +1 @@ +/* packagecard/pages/moments/publish/momentpublish.wxss */ \ No newline at end of file diff --git a/packagecard/pages/moments/publish/momentpublishline.js b/packagecard/pages/moments/publish/momentpublishline.js new file mode 100644 index 0000000..51b325b --- /dev/null +++ b/packagecard/pages/moments/publish/momentpublishline.js @@ -0,0 +1,66 @@ +// packagecard/pages/moments/publish/momentpublishline.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/moments/publish/momentpublishline.json b/packagecard/pages/moments/publish/momentpublishline.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/moments/publish/momentpublishline.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/moments/publish/momentpublishline.wxml b/packagecard/pages/moments/publish/momentpublishline.wxml new file mode 100644 index 0000000..d1f1766 --- /dev/null +++ b/packagecard/pages/moments/publish/momentpublishline.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/moments/publish/momentpublishline.wxml diff --git a/packagecard/pages/moments/publish/momentpublishline.wxss b/packagecard/pages/moments/publish/momentpublishline.wxss new file mode 100644 index 0000000..ace5ebd --- /dev/null +++ b/packagecard/pages/moments/publish/momentpublishline.wxss @@ -0,0 +1 @@ +/* packagecard/pages/moments/publish/momentpublishline.wxss */ \ No newline at end of file diff --git a/packagecard/pages/moments/showlist/showlist.js b/packagecard/pages/moments/showlist/showlist.js new file mode 100644 index 0000000..821ebc6 --- /dev/null +++ b/packagecard/pages/moments/showlist/showlist.js @@ -0,0 +1,66 @@ +// packagecard/pages/moments/showlist/showlist.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/moments/showlist/showlist.json b/packagecard/pages/moments/showlist/showlist.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/moments/showlist/showlist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/moments/showlist/showlist.wxml b/packagecard/pages/moments/showlist/showlist.wxml new file mode 100644 index 0000000..4c6fefc --- /dev/null +++ b/packagecard/pages/moments/showlist/showlist.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/moments/showlist/showlist.wxml diff --git a/packagecard/pages/moments/showlist/showlist.wxss b/packagecard/pages/moments/showlist/showlist.wxss new file mode 100644 index 0000000..d69b080 --- /dev/null +++ b/packagecard/pages/moments/showlist/showlist.wxss @@ -0,0 +1 @@ +/* packagecard/pages/moments/showlist/showlist.wxss */ \ No newline at end of file diff --git a/packagecard/pages/sharePage/sharePage.js b/packagecard/pages/sharePage/sharePage.js new file mode 100644 index 0000000..37a79e6 --- /dev/null +++ b/packagecard/pages/sharePage/sharePage.js @@ -0,0 +1,66 @@ +// packagecard/pages/sharePage/sharePage.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/pages/sharePage/sharePage.json b/packagecard/pages/sharePage/sharePage.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/pages/sharePage/sharePage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/pages/sharePage/sharePage.wxml b/packagecard/pages/sharePage/sharePage.wxml new file mode 100644 index 0000000..0825e0b --- /dev/null +++ b/packagecard/pages/sharePage/sharePage.wxml @@ -0,0 +1,2 @@ + +packagecard/pages/sharePage/sharePage.wxml diff --git a/packagecard/pages/sharePage/sharePage.wxss b/packagecard/pages/sharePage/sharePage.wxss new file mode 100644 index 0000000..cd21f4a --- /dev/null +++ b/packagecard/pages/sharePage/sharePage.wxss @@ -0,0 +1 @@ +/* packagecard/pages/sharePage/sharePage.wxss */ \ No newline at end of file diff --git a/pages/sharePage/sharePage.js b/packagecard/sharePage/sharePage.js similarity index 100% rename from pages/sharePage/sharePage.js rename to packagecard/sharePage/sharePage.js diff --git a/packagecard/sharePage/sharePage.json b/packagecard/sharePage/sharePage.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/packagecard/sharePage/sharePage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/sharePage/sharePage.wxml b/packagecard/sharePage/sharePage.wxml similarity index 100% rename from pages/sharePage/sharePage.wxml rename to packagecard/sharePage/sharePage.wxml diff --git a/pages/sharePage/sharePage.wxss b/packagecard/sharePage/sharePage.wxss similarity index 100% rename from pages/sharePage/sharePage.wxss rename to packagecard/sharePage/sharePage.wxss diff --git a/pages/cardList/cardList.js b/pages/cardList/cardList.js deleted file mode 100644 index 9ebcbfd..0000000 --- a/pages/cardList/cardList.js +++ /dev/null @@ -1,115 +0,0 @@ -const app = getApp() -// pages/list/list.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - cardUrl: app.cardUrl, - cardList: [] - }, - getList: function () { - var self = this - wx.showNavigationBarLoading() - app.http.get(app.urls.getCardList, { - header: { - token: app.globalData.token - }, - data: {} - }).then(res => { - self.setData({ - cardList: res.data - }) - wx.hideNavigationBarLoading() //完成停止加载 - wx.stopPullDownRefresh() //停止下拉刷新 - }) - .catch(err => { - wx.hideNavigationBarLoading() //完成停止加载 - wx.stopPullDownRefresh() //停止下拉刷新 - }) - // app.restAjax.get(app.restAjax.path('{cardUrl}app/cardtemplate/listcardtemplate', [app.cardUrl]), {}, { - // headers: { - // token: app.globalData.token - // } - // }, function(code, data) { - // self.setData({ - // cardList: data - // }) - // }, function(code, data) { - // app.dialog.msg(data.msg); - // }); - }, - goDetail: function (e) { - var id = e.currentTarget.dataset.id - console.log(id) - wx.navigateTo({ - url: '../cardDetail/cardDetail?id=' + id, - }) - }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - var self = this - wx.getStorage({ - key: 'token', - success: function (res) { - self.setData({ - token: res.data - }) - app.globalData.token = res.data - self.getList() - } - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - this.getList() - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } -}) \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index b70b42e..ee47eee 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -225,7 +225,7 @@ Page({ var userid = e.currentTarget.dataset.userid var idx = e.currentTarget.dataset.idx wx.navigateTo({ - url: '../moments/showlist/showlist?id=' + item.cId + '&userId=' + userid + '&index=' + idx, + url: '/packagecard/moments/showlist/showlist?id=' + item.cId + '&userId=' + userid + '&index=' + idx, }) } }, @@ -411,7 +411,7 @@ Page({ // 跳转模板列表 goList: function () { wx.navigateTo({ - url: '../cardList/cardList', + url: '/packagecard/cardList/cardList', }) }, // 获取个人简介 @@ -748,7 +748,7 @@ Page({ var postId = self.buildId() self.shareRecord(postId) - var param = '/pages/sharePage/sharePage?cardTemplateDispatchId=' + postId; + var param = '/packagecard/sharePage/sharePage?cardTemplateDispatchId=' + postId; return { title: '名片分享', path: param, @@ -776,7 +776,7 @@ Page({ var cId = e.currentTarget.dataset.cid var uId = e.currentTarget.dataset.id wx.navigateTo({ - url: '../moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId, + url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId, }) } } diff --git a/pages/mine/manage/addposition.js b/pages/mine/manage/addposition.js new file mode 100644 index 0000000..89235a9 --- /dev/null +++ b/pages/mine/manage/addposition.js @@ -0,0 +1,88 @@ +//职位添加 +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + curShopId: '', //店铺ID + positionName: '', //名称 + positionOrder: 0, //排序 + positionSummary: '' //职位描述 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + curShopId: options.shopId + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + checkParams() { + if (this.data.positionName == '') { + wx.showToast({ + title: '请输入职位名称', + icon: "none" + }) + return false + } + if (this.data.positionOrder == 0) { + wx.showToast({ + title: '请输入职位排序', + }) + return false + } + return true + }, + addPosition() { + if (this.checkParams()) { + let _self = this + wx.showLoading({ + title: '添加中...', + }) + app.http.post(app.urls.doSavePosition, { + header: { + token: app.globalData.token + }, + data: { + shopId: _self.data.curShopId, + positionName: _self.data.positionName, + positionSummary: _self.data.positionSummary, + positionOrder: _self.data.positionOrder + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '添加成功', + success: function () { + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddSuccess: true + }) + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + textareaBInput(e) { + this.setData({ + positionSummary: e.detail.value + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/manage/addposition.json b/pages/mine/manage/addposition.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/manage/addposition.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/manage/addposition.wxml b/pages/mine/manage/addposition.wxml new file mode 100644 index 0000000..6ecd634 --- /dev/null +++ b/pages/mine/manage/addposition.wxml @@ -0,0 +1,39 @@ + + + 添加职位 + + +
+ + + + 名称 + + + + + + + 排序 + + + + + + + + 职位描述 + + + + + + + + +
+ + + +
\ No newline at end of file diff --git a/pages/mine/manage/addposition.wxss b/pages/mine/manage/addposition.wxss new file mode 100644 index 0000000..292344d --- /dev/null +++ b/pages/mine/manage/addposition.wxss @@ -0,0 +1 @@ +/* pages/mine/manage/addposition.wxss */ \ No newline at end of file diff --git a/pages/mine/manage/shopmember.js b/pages/mine/manage/shopmember.js new file mode 100644 index 0000000..0d6343e --- /dev/null +++ b/pages/mine/manage/shopmember.js @@ -0,0 +1,108 @@ +//店铺会员管理页面 +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + curShopId: '', + currentPage: 1, + memberList: [], + refresherTriggered: false, + isCellOpen: false, + }, + onOpen() { + this.setData({ + isCellOpen: true + }) + }, + onClose(event) { + let _self = this + const { + position, + instance + } = event.detail; + switch (position) { + case 'right': + case 'cell': + instance.close(); + _self.setData({ + isCellOpen: false + }) + break; + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + curShopId: options.shopId + }) + this.getMemberList(this.data.curShopId) + }, + getMemberList(id) { + console.log(app) + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMemberList.format({ + shopId: id + }), { + header: { + token: app.globalData.token + }, + data: { + shopId: id + } + }) + .then(res => { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + _self.setData({ + memberList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + }) + }, + showMemberDetail(e) { + console.log(e) + }, + //删除会员 + doDelMember(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该会员吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelMember.format({ + ids: e.currentTarget.dataset.key.memberId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + }) + _self.getMemberList(_self.data.curShopId) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/manage/shopmember.json b/pages/mine/manage/shopmember.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/manage/shopmember.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/manage/shopmember.wxml b/pages/mine/manage/shopmember.wxml new file mode 100644 index 0000000..8a67aa3 --- /dev/null +++ b/pages/mine/manage/shopmember.wxml @@ -0,0 +1,32 @@ + + 店铺会员 + + + + + + + + {{item.userName.length>0 ? item.userName:'未录入'}} + + + 等级:{{item.memberLevel}} + + + + + + + + + 删除 + + + + + + + \ No newline at end of file diff --git a/pages/mine/manage/shopmember.wxss b/pages/mine/manage/shopmember.wxss new file mode 100644 index 0000000..1aa5056 --- /dev/null +++ b/pages/mine/manage/shopmember.wxss @@ -0,0 +1 @@ +/* pages/mine/staff/shopmember.wxss */ \ No newline at end of file diff --git a/pages/mine/manage/shopposition.js b/pages/mine/manage/shopposition.js new file mode 100644 index 0000000..1577896 --- /dev/null +++ b/pages/mine/manage/shopposition.js @@ -0,0 +1,110 @@ +// pages/mine/manage/shopposition.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + positionList: [], + currentPage: 1, + curShopId: '', + isAddSuccess: false, + isRefreshing: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + curShopId: options.shopId + }) + this.getPositionList(options.shopId) + }, + getPositionList(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getPositionList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.setData({ + positionList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + toAddPosition() { + wx.navigateTo({ + url: './addposition?shopId=' + this.data.curShopId, + }) + }, + doDelPositon(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该职位吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelPositon.format({ + ids: e.currentTarget.dataset.item.positionId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + }) + _self.dorefreshList() + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + //刷新页面 + dorefreshList() { + this.setData({ + currentPage: 1, + isRefreshing: true + }) + this.getPositionList(this.data.curShopId) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let _self = this + if (_self.data.isAddSuccess) { + _self.setData({ + isAddSuccess: false + }) + //刷新页面 + this.dorefreshList() + } + }, + +}) \ No newline at end of file diff --git a/pages/mine/manage/shopposition.json b/pages/mine/manage/shopposition.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/manage/shopposition.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/manage/shopposition.wxml b/pages/mine/manage/shopposition.wxml new file mode 100644 index 0000000..283156e --- /dev/null +++ b/pages/mine/manage/shopposition.wxml @@ -0,0 +1,35 @@ + + + 店铺职位 + + + + + {{item.positionOrder}} + + + {{item.positionName}} + + + + {{item.positionSummary.length>0 ? item.positionSummary :'未录入' }} + + + + + 删除 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/manage/shopposition.wxss b/pages/mine/manage/shopposition.wxss new file mode 100644 index 0000000..f7d7126 --- /dev/null +++ b/pages/mine/manage/shopposition.wxss @@ -0,0 +1,6 @@ +/* pages/mine/manage/shopposition.wxss */ +.cut { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} \ No newline at end of file diff --git a/pages/mine/manage/shopstaff.js b/pages/mine/manage/shopstaff.js new file mode 100644 index 0000000..2c43413 --- /dev/null +++ b/pages/mine/manage/shopstaff.js @@ -0,0 +1,125 @@ +// pages/mine/staff/shopstaff.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + curShopId: '', + shopStaffList: [], + currentPage: 1, + isCellOpen: false, + isRefreshing: false + }, + onOpen() { + this.setData({ + isCellOpen: true + }) + }, + onClose(event) { + let _self = this + const { + position, + instance + } = event.detail; + switch (position) { + case 'right': + case 'cell': + instance.close(); + _self.setData({ + isCellOpen: false + }) + break; + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + curShopId: options.shopId + }) + this.getStaffList(this.data.curShopId) + }, + //获取店铺员工列表 + getStaffList(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.utls.getStaffList.format({ + shopId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.setData({ + shopStaffList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + + }, + //审核员工 + doVerify(e) { + + }, + //删除员工 + doDelItem(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该职员吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.delStaff.format({ + ids: e.currentTarget.dataset.key.staffId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + }) + _self.dorefreshList() + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + showStaffDetail(e) { + if (!this.data.isCellOpen) { + console.log(e) + } + }, + //修改员工信息 + doEditItem(e) { + console.log(e) + }, + + dorefreshList() { + this.setData({ + currentPage: 1, + isRefreshing: true + }) + this.getStaffList(this.data.curShopId) + }, +}) \ No newline at end of file diff --git a/pages/mine/manage/shopstaff.json b/pages/mine/manage/shopstaff.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/manage/shopstaff.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/manage/shopstaff.wxml b/pages/mine/manage/shopstaff.wxml new file mode 100644 index 0000000..2c08006 --- /dev/null +++ b/pages/mine/manage/shopstaff.wxml @@ -0,0 +1,65 @@ + + + 店铺职工 + + + + + + + + + {{item.userName.length>0 ? item.userName:'未录入'}} + + + {{item.positionName.length>0? item.positionName :'未录入'}} + + + + + 审核 + + + + {{item.isLeader==1 ? '(领导)':''}}管理员 + + + + {{item.isLeader==1 ? '领导':'职工'}} + + + + + 不通过 + + + + + + + + + 删除 + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/manage/shopstaff.wxss b/pages/mine/manage/shopstaff.wxss new file mode 100644 index 0000000..9565511 --- /dev/null +++ b/pages/mine/manage/shopstaff.wxss @@ -0,0 +1 @@ +/* pages/mine/staff/shopstaff.wxss */ \ No newline at end of file diff --git a/pages/mine/order/orderdetail.js b/pages/mine/order/orderdetail.js new file mode 100644 index 0000000..40453d7 --- /dev/null +++ b/pages/mine/order/orderdetail.js @@ -0,0 +1,69 @@ +/** + * 订单详情 + */ +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + orderId: '', + shopId: '', + shopDetailBean: null, + orderList: [], + baseImg: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + orderId: options.orderId, + shopId: options.shopId + }) + this.getShopDetailById(this.data.shopId) + this.getOrderDetail() + }, + //获取店铺详情 + getShopDetailById(id) { + app.http.get(app.urls.getShopDetail.format({ + shopId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + this.setData({ + shopDetailBean: res.data + }) + }) + .catch(err => { + + }) + }, + getOrderDetail() { + wx.showLoading({ + title: '加载中...', + }) + let _self = this + app.http.get(app.urls.getOrderDetail.format({ + orderId: _self.data.orderId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + this.setData({ + orderList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } +}) \ No newline at end of file diff --git a/pages/mine/order/orderdetail.json b/pages/mine/order/orderdetail.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/order/orderdetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/order/orderdetail.wxml b/pages/mine/order/orderdetail.wxml new file mode 100644 index 0000000..8517b9a --- /dev/null +++ b/pages/mine/order/orderdetail.wxml @@ -0,0 +1,51 @@ + + + 订单详情 + + + + + + + + + + + + + {{shopDetailBean.shopName}} + + 店铺地址:{{shopDetailBean.shopAddress}} + + + + + + + + + + {{item.goodsName}} + + ¥{{item.goodsPrice}} + 数量:{{item.goodsCount}} + 总价:{{item.totalPrice}} + + + + + + + + + + 订单备注 + + + + + {{orderList[0].words}} + + + + \ No newline at end of file diff --git a/pages/mine/order/orderdetail.wxss b/pages/mine/order/orderdetail.wxss new file mode 100644 index 0000000..267702a --- /dev/null +++ b/pages/mine/order/orderdetail.wxss @@ -0,0 +1 @@ +/* pages/mine/order/orderdetail.wxss */ \ No newline at end of file diff --git a/pages/mine/order/orderlist.js b/pages/mine/order/orderlist.js new file mode 100644 index 0000000..41bea49 --- /dev/null +++ b/pages/mine/order/orderlist.js @@ -0,0 +1,118 @@ +// pages/mine/order/orderlist.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + orderList: [], //订单列表 + waitList: [], //待付款 + marchList: [], //进行中 + completeList: [], //已完成 + tab: 0, //当前tab + currentType: '', + currentPage: 1, + totalSize: 0, + hasMore: true, + isLoadMore: false, + contentHeight: app.globalData.windowHeight - app.globalData.CustomBar, + imgUrl: app.urls.baseImgUrl + }, + changeTab: function (e) { + var cur = e.currentTarget.dataset.tab + if (this.data.tab != cur) { + this.setData({ + tab: cur, + currentType: cur, + currentPage: 1, + orderList: [] + }) + this.getOrderList() + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var state = options.status + if (state == 5) { + this.setData({ + currentType: '', + tab: 4 + }) + } else { + this.setData({ + currentType: state, + tab: state + }) + } + this.getOrderList() + }, + //获取订单列表 + getOrderList() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMineOrderList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + if (res.data.rows.length > 0) { + _self.data.orderList = _self.data.orderList.concat(res.data.rows) + _self.setData({ + orderList: _self.data.orderList + }) + } else { + _self.setData({ + hasMore: false + }) + } + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + hasMore: true, + currentPage: --_self.data.currentPage, + isLoadMore: false + }) + }) + + }, + //加载更多 + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getOrderList() + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + //显示订单详情 + toDetail(e) { + wx.navigateTo({ + url: './orderdetail?orderId=' + e.currentTarget.dataset.item.orderId + '&shopId=' + e.currentTarget.dataset.item.shopId, + }) + } +}) \ No newline at end of file diff --git a/pages/mine/order/orderlist.json b/pages/mine/order/orderlist.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/order/orderlist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/order/orderlist.wxml b/pages/mine/order/orderlist.wxml new file mode 100644 index 0000000..0f76788 --- /dev/null +++ b/pages/mine/order/orderlist.wxml @@ -0,0 +1,46 @@ + + + 我的订单 + + + 待付款 + 交易中 + 已完成 + 售后/退款 + 全部 + + + + + + + + {{item.shopName}} + + + 下单时间:{{item.gmtCreate}} + + 订单金额: + ¥{{item.amountMoney}} + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/order/orderlist.wxss b/pages/mine/order/orderlist.wxss new file mode 100644 index 0000000..eb21286 --- /dev/null +++ b/pages/mine/order/orderlist.wxss @@ -0,0 +1,46 @@ +/* pages/mine/order/orderlist.wxss */ + .tab{ + position: fixed; + left: 0; + right: 0; + background: #fff; + display: flex; + height: 80rpx; + z-index: 100; + } + .tab-box{ + flex: 1; + display: flex; + justify-content: center; + align-items: center; + font-size: 32rpx; + color: #000; + } + .tab-box.active{ + color: #055fe6; + border-bottom: 2px solid #055fe6; + box-sizing: border-box; + } + .card{ + width: 100%; + box-sizing: border-box; + background: #fff; + z-index: 100; + position: relative; + /* text-align: center; */ + } + .card-bgImg{ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } + .area-box{ + white-space: nowrap; + } + .card-name{ + font-size: 36rpx; + margin: 10rpx 0; + padding: 0 20rpx; + } \ No newline at end of file diff --git a/pages/mine/order/ordersuccess.js b/pages/mine/order/ordersuccess.js new file mode 100644 index 0000000..4a69608 --- /dev/null +++ b/pages/mine/order/ordersuccess.js @@ -0,0 +1,28 @@ +// pages/mine/order/ordersuccess.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + totalPrice: 0, + shopId: '', + orderId: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + totalPrice: options.price, + shopId: options.shopId, + orderId: options.orderId + }) + }, + toShowOrderDetail() { + wx.redirectTo({ + url: './orderdetail?shopId=' + this.data.shopId + '&orderId=' + this.data.orderId, + }) + } +}) \ No newline at end of file diff --git a/pages/mine/order/ordersuccess.json b/pages/mine/order/ordersuccess.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/order/ordersuccess.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/order/ordersuccess.wxml b/pages/mine/order/ordersuccess.wxml new file mode 100644 index 0000000..fb7803a --- /dev/null +++ b/pages/mine/order/ordersuccess.wxml @@ -0,0 +1,12 @@ + + + 订单 + + + + 商品下单成功 + 订单金额:¥{{totalPrice}} + + + + \ No newline at end of file diff --git a/pages/mine/order/ordersuccess.wxss b/pages/mine/order/ordersuccess.wxss new file mode 100644 index 0000000..0a56e8e --- /dev/null +++ b/pages/mine/order/ordersuccess.wxss @@ -0,0 +1 @@ +/* pages/mine/order/ordersuccess.wxss */ \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/addcatalog.js b/pages/mine/product/catalogmanage/addcatalog.js new file mode 100644 index 0000000..0fb85ea --- /dev/null +++ b/pages/mine/product/catalogmanage/addcatalog.js @@ -0,0 +1,237 @@ +// 添加分类 +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + catalogName: '', + catalogOrder: 0, + catalogOneList: [], + catalogTwoList: [], + oneIndex: 0, + oneCatalog: null, + twoIndex: 0, + twoCatalog: null, + catalogLogoPhotos: [], + catalogSummary: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getCatalogList(1, 0, 1, 0) + }, + //获取一级类目 + getCatalogList(type, id, level, code) { + let _self = this + app.http.get(app.urls.getCatalogList.format({ + level: level + }), { + header: { + token: app.globalData.token + }, + data: { + id: id, + code: code + } + }) + .then(res => { + if (type == 1) { + _self.setData({ + oneIndex: 0, + catalogOneList: res.data + }) + } else { + _self.setData({ + twoIndex: 0, + catalogTwoList: res.data + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //一级类目选择 + oneCatalogSelect(e) { + this.setData({ + oneIndex: e.detail.value, + oneCatalog: this.data.catalogOneList[e.detail.value] + }) + this.getCatalogList(2, this.data.catalogOneList[this.data.oneIndex].id, 2, this.data.catalogOneList[this.data.oneIndex].code) + }, + //二级类目选择 + twoCatalogSelect(e) { + this.setData({ + twoIndex: e.detail.value, + twoCatalog: this.data.catalogTwoList[e.detail.value] + }) + }, + //预览Logo + ViewLicImg() { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + DelLogoP(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.catalogLogoPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + catalogLogoPhotos: _self.data.catalogLogoPhotos + }) + } + } + }) + }, + //选择logo + ChooseLogoP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + let _self = this + wx.showLoading({ + title: '上传中...', + }) + app.http.upload(app.urls.doUploadImg, { + path: path, + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + let tempList = _self.data.catalogLogoPhotos.concat(item) + _self.setData({ + catalogLogoPhotos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + wx.showToast({ + title: '上传失败', + }) + }) + }, + //校验参数 + checkParams() { + if (this.data.catalogName == '') { + wx.showToast({ + title: '请输入类目名称', + icon: 'none' + }) + return false + } + if (this.data.twoCatalog == null) { + wx.showToast({ + title: '请选择二级类目', + icon: 'none' + }) + return false + } + if (this.data.catalogOrder == 0) { + wx.showToast({ + title: '请输入类目排序', + icon: 'none' + }) + return false + } + if (this.data.catalogLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传类目Logo', + icon: 'none' + }) + } + + + return true + }, + //添加类目 + doAdd() { + let _self = this + if (_self.checkParams()) { + wx.showModal({ + title: '提示', + content: '添加成功后需要审核(1-3个工作日)并且无法删除和修改,确定要添加该类目吗?', + success(res) { + if (res.confirm) { + //确定添加 + wx.showLoading({ + title: '添加中...', + }) + app.http.post(app.urls.doSaveCatalog, { + header: { + token: app.globalData.token + }, + data: { + categoryName: _self.data.catalogName, //名称 + categorySort: _self.data.catalogOrder, //排序 + categoryLogo: _self.data.catalogLogoPhotos.length > 0 ? _self.data.catalogLogoPhotos[0].id : '', //logo + categoryParentId: _self.data.twoCatalog.id, //上级类目 + categorySummary: _self.data.catalogSummary, //说明 + from: 'mini' //来源 + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '添加成功', + icon: 'success' + }) + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + } + }, + //监听输入 + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + catalogInput(e) { + this.setData({ + catalogSummary: e.detail.value + }) + } +}) \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/addcatalog.json b/pages/mine/product/catalogmanage/addcatalog.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/catalogmanage/addcatalog.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/addcatalog.wxml b/pages/mine/product/catalogmanage/addcatalog.wxml new file mode 100644 index 0000000..2f94d89 --- /dev/null +++ b/pages/mine/product/catalogmanage/addcatalog.wxml @@ -0,0 +1,79 @@ + + 商品类目添加 + + + + + + 类目名称 + + + + + + + 类目排序 + + + + + + + 一级类目 + + + + {{oneCatalog ? oneCatalog.name : '请选择一级类目'}} + + + + + + + 二级类目 + + + + {{twoCatalog ? twoCatalog.name : '请选择二级类目'}} + + + + + + + 类目Logo + + + {{catalogLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + + 类目描述 + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/addcatalog.wxss b/pages/mine/product/catalogmanage/addcatalog.wxss new file mode 100644 index 0000000..79ce33b --- /dev/null +++ b/pages/mine/product/catalogmanage/addcatalog.wxss @@ -0,0 +1,4 @@ +/* pages/mine/product/catalogmanage/addcatalog.wxss */ +.cu-form-group .title { + min-width: calc(4em + 30rpx); +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogedit.js b/pages/mine/product/catalogmanage/catalogedit.js new file mode 100644 index 0000000..16bb854 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogedit.js @@ -0,0 +1,202 @@ +// pages/mine/product/catalogmanage/catalogedit.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + catalogId: '', //id + catalogLogoPhotos: [], //图标 + catalogSummary: '', //说明 + catalogName: '', //名称 + catalogOrder: 0, //排序 + }, + // doUpdateCatalog getCatalogDetail + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + catalogId: options.catalogId + }) + this.getCatalogDetail() + }, + //获取名称 + getCatalogDetail() { + wx.showLoading({ + title: '加载中...', + }) + let _self = this + app.http.get(app.urls.getCatalogDetail.format({ + categoryId: _self.data.catalogId + }), { + header: { + token: app.globalData.token, + isThree: 'yes' + } + }) + .then(res => { + wx.hideLoading({}) + var p = { + id: res.data.categoryLogo, + path: app.urls.baseImgUrl + res.data.categoryLogo + } + _self.data.catalogLogoPhotos.push(p) + _self.setData({ + catalogLogoPhotos: _self.data.catalogLogoPhotos, //图标 + catalogSummary: res.data.categorySummary, //说明 + catalogName: res.data.categoryName, //名称 + catalogOrder: res.data.categorySort, //排序 + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //预览Logo + ViewLicImg() { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + DelLogoP(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.catalogLogoPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + catalogLogoPhotos: _self.data.catalogLogoPhotos + }) + } + } + }) + }, + //选择logo + ChooseLogoP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + let tempList = _self.data.catalogLogoPhotos.concat(item) + _self.setData({ + catalogLogoPhotos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //校验参数 + checkParams() { + if (this.data.catalogName == '') { + wx.showToast({ + title: '请输入类目名称', + icon: 'none' + }) + return false + } + if (this.data.catalogOrder == 0) { + wx.showToast({ + title: '请输入类目排序', + icon: 'none' + }) + return false + } + if (this.data.catalogLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传类目Logo', + icon: 'none' + }) + } + + return true + }, + //添加类目 + doAdd() { + let _self = this + if (_self.checkParams()) { + wx.showLoading({ + title: '修改中...', + }) + app.http.put(app.urls.doUpdateCatalog.format({ + categoryId: _self.data.catalogId + }), { + header: { + isThree: 'yes', + token: app.globalData.token + }, + data: { + categoryName: _self.data.catalogName, //名称 + categorySort: _self.data.catalogOrder, //排序 + categoryLogo: _self.data.catalogLogoPhotos.length > 0 ? _self.data.catalogLogoPhotos[0].id : '', //logo + categorySummary: _self.data.catalogSummary, //说明 + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '修改成功', + icon: 'success' + }) + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //监听输入 + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + catalogInput(e) { + this.setData({ + catalogSummary: e.detail.value + }) + } +}) \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogedit.json b/pages/mine/product/catalogmanage/catalogedit.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogedit.wxml b/pages/mine/product/catalogmanage/catalogedit.wxml new file mode 100644 index 0000000..bcfb3f8 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogedit.wxml @@ -0,0 +1,60 @@ + + + 商品类目编辑 + + + + + + 类目名称 + + + + + + + 类目排序 + + + + + + + 类目Logo + + + {{catalogLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + + 类目描述 + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogedit.wxss b/pages/mine/product/catalogmanage/catalogedit.wxss new file mode 100644 index 0000000..7948df8 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogedit.wxss @@ -0,0 +1 @@ +/* pages/mine/product/catalogmanage/catalogedit.wxss */ \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogmanage.js b/pages/mine/product/catalogmanage/catalogmanage.js new file mode 100644 index 0000000..55fb669 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogmanage.js @@ -0,0 +1,191 @@ +// pages/mine/product/catalogmanage/catalogmanage.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + catalogList: [], + currentPage: 1, + isRefreshing: false, + activeNames: ['0'], + catalogOneList: [], //一级类目 + catalogTwoList: [], //二级类目 + catalogThirdList: [], //三级类目 + selectItems: [], //选中的行业, + selectItemNames: '', + isAddPage: false //用来判断是否需要刷新页面 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getCatalogList(0, 1, 0) + }, + //获取类目列表 + getCatalogList(id, level, code) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getCatalogList.format({ + level: level + }), { + header: { + token: app.globalData.token + }, + data: { + id: id, + code: code + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + data.forEach(el => { + el.isSel = false + }) + if (level == '1') { + _self.setData({ + catalogOneList: res.data + }) + } else if (level == '2') { + _self.setData({ + catalogTwoList: res.data + }) + } else { + _self.setData({ + catalogThirdList: res.data + }) + } + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + }) + }, + // 选中了条目 + selectItem(e) { + let _self = this + let { + type, + item, + index + } = e.currentTarget.dataset + if (type == '1') { + _self.data.catalogOneList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + } else { + el.isSel = false + } + }) + _self.setData({ + catalogOneList: _self.data.catalogOneList, + catalogTwoList: [], + catalogThirdList: [] + }) + _self.getCatalogList(item.id, '2', item.code) + } else if (type == '2') { + _self.data.catalogTwoList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + } else { + el.isSel = false + } + }) + _self.setData({ + catalogTwoList: _self.data.catalogTwoList, + catalogThirdList: [] + }) + _self.getCatalogList(item.id, '3', item.code) + } else { + _self.data.catalogThirdList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + } else { + el.isSel = false + } + }) + _self.setData({ + catalogThirdList: _self.data.catalogThirdList + }) + } + }, + toAddPage() { + wx.navigateTo({ + url: './addcatalog', + }) + }, + //刷新列表 + dorefreshList() { + this.setData({ + catalogOneList: [], //一级类目 + catalogTwoList: [], //二级类目 + catalogThirdList: [], //三级类目 + isRefreshing: true, + currentPage: 1 + }) + this.getCatalogList(0, 1, 0) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let _self = this + if (_self.data.isAddPage) { + _self.dorefreshList() + } + }, + doDel(e) { + var item = e.currentTarget.dataset.item + var index = e.currentTarget.dataset.index + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该类目吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelCatelog.format({ + ids: item.id + }), { + header: { + token: app.globalData.token, + isThree: 'yes' + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + _self.data.catalogThirdList.splice(index, 1) + _self.setData({ + catalogThirdList: _self.data.catalogThirdList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + doEdit(e) { + var item = e.currentTarget.dataset.item + wx.navigateTo({ + url: './catalogedit?catalogId=' + item.id, + }) + } +}) \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogmanage.json b/pages/mine/product/catalogmanage/catalogmanage.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogmanage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogmanage.wxml b/pages/mine/product/catalogmanage/catalogmanage.wxml new file mode 100644 index 0000000..ccf705b --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogmanage.wxml @@ -0,0 +1,86 @@ + + + 商品类目 + + + + + + 商品类目(一级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 商品类目(二级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 商品类目(三级) + + + + + + + + + + + {{item.name}} + + + 删除 + + + 编辑 + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogmanage.wxss b/pages/mine/product/catalogmanage/catalogmanage.wxss new file mode 100644 index 0000000..ccc03dd --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogmanage.wxss @@ -0,0 +1 @@ +/* pages/mine/product/catalogmanage/catalogmanage.wxss */ \ No newline at end of file diff --git a/pages/mine/product/productmanage/addproduct.js b/pages/mine/product/productmanage/addproduct.js new file mode 100644 index 0000000..cff3a0b --- /dev/null +++ b/pages/mine/product/productmanage/addproduct.js @@ -0,0 +1,361 @@ +// pages/mine/product/productmanage/addproduct.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + cataLogId: '', //上级页面传递 + goodsName: '', //商品名称 + goodsCount: 0, //商品数量 + goodsPrice: 0.00, //商品单价 + goodsUnit: '', //商品单位 + goodsStatus: 1, //商品状态 1 上架 2 下架 + goodsPay: 1, //支付方式 1 线上 2 线下 + goodsLogoPhotos: [], //商品Logo + goodsPhotos: [], //商品图片 + goodsVideos: [], //商品视频 + goodsSummary: '', //商品说明 + goodsOrder: 0, //商品排序 + isPopular: false //是否是热门商品 + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + cataLogId: options.cataLogId + }) + }, + //商品状态切换 + selGoodsStatus(e) { + this.setData({ + goodsStatus: e.detail.value + }) + }, + //是否是热门 + selGoodsPopular(e) { + this.setData({ + isPopular: e.detail.value + }) + }, + //支付方式切换 + selGoodsPay(e) { + this.setData({ + goodsPay: e.detail.value + }) + }, + //输入框监听 + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + //商品说明 + goodsSummaryInput(e) { + this.setData({ + goodsSummary: e.detail.value + }) + }, + /** + * 添加图片、视频 1 logo 2 图片 + */ + chooseLogo() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + choosePhoto() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + chooseVideo() { + let _self = this + wx.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], //从相册选择 + maxDuration: 30, + success: (res) => { + _self.doUploadVideo(res) + } + }); + }, + /** + * 删除图片、视频 + */ + delLogo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsLogoPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsLogoPhotos: _self.data.goodsLogoPhotos + }) + } + } + }) + }, + delPhoto(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsPhotos: _self.data.goodsPhotos + }) + } + } + }) + }, + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsVideos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsVideos: _self.data.goodsVideos + }) + } + } + }) + }, + /** + * 预览图片、视频 + */ + viewLogo(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewPhoto(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //上传图片 + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + if (type == 1) { + let tempList = _self.data.goodsLogoPhotos.concat(item) + _self.setData({ + goodsLogoPhotos: tempList + }) + } else { + //图片 + let tempList = _self.data.goodsPhotos.concat(item) + _self.setData({ + goodsPhotos: tempList + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + doUploadVideo(e) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadVideo, { + name: 'video', + path: e.tempFiles[0].tempFilePath, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + let pathStr = e.tempFiles[0].thumbTempFilePath + var id = JSON.parse(res).data + let videoU = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr, + videoUrl: videoU + } + let tempList = _self.data.goodsVideos.concat(item) + _self.setData({ + goodsVideos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //添加商品 + doAdd() { + if (this.checkParams()) { + let _self = this + wx.showLoading({ + title: '添加中...', + }) + let p = '' + _self.data.goodsPhotos.forEach(el => { + p += el.id + ',' + }) + if (p.length != '') { + p = p.substr(0, p.length - 1) + } + let videoId = '' + if (_self.data.goodsVideos.length > 0) { + videoId = _self.data.goodsVideos[0].id + } + app.http.post(app.urls.doSaveGoods, { + header: { + token: app.globalData.token + }, + data: { + categoryId: _self.data.cataLogId, + goodsIcon: _self.data.goodsLogoPhotos[0].id, + goodsName: _self.data.goodsName, + goodsPhotos: p, + goodsSort: _self.data.goodsOrder, + goodsStatus: _self.data.goodsStatus, + goodsSummary: _self.data.goodsSummary, + goodsTotal: _self.data.goodsCount, + goodsUnit: _self.data.goodsUnit, + goodsUnitPrice: _self.data.goodsPrice, + goodsVideo: videoId, + paymentType: _self.data.goodsPay, + shopId: _self.data.shopId, + isPopular: _self.isPopular ? '1' : '0' + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '添加成功', + icon: 'success' + }) + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //校验参数合法性 + checkParams() { + if (this.data.goodsName == '') { + wx.showToast({ + title: '请输入商品名称', + icon: 'error' + }) + return false + } + if (this.data.goodsCount == 0) { + wx.showToast({ + title: '请输入商品数量', + icon: 'error' + }) + return false + } + + if (this.data.goodsCount == 0) { + wx.showToast({ + title: '请输入商品数量', + icon: 'error' + }) + return false + } + if (this.data.goodsUnit == '') { + wx.showToast({ + title: '请输入商品单位', + icon: 'error' + }) + return false + } + if (this.data.goodsLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传商品Logo', + icon: 'error' + }) + return false + } + if (this.data.goodsPhotos.length <= 0) { + wx.showToast({ + title: '请上传商品图片', + icon: 'error' + }) + return false + } + return true + } +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/addproduct.json b/pages/mine/product/productmanage/addproduct.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/productmanage/addproduct.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/addproduct.wxml b/pages/mine/product/productmanage/addproduct.wxml new file mode 100644 index 0000000..1a5843e --- /dev/null +++ b/pages/mine/product/productmanage/addproduct.wxml @@ -0,0 +1,159 @@ + + 商品添加 + + +
+ + + + 商品名称 + + + + + + + 是否热门 + + + + + + + + + 商品数量 + + + + + + + 商品单价 + + + + + + + 商品单位 + + + + + + + + 商品状态 + + + 上架 + 下架 + + + + + + + + 支付方式 + + + 线上 + 线下 + + + + + + + 商品Logo + + + {{goodsLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + + 商品图片 + + + {{goodsPhotos.length}}/9 + + + + + + + + + + + + + + + + + + + 商品视频 + + + {{goodsVideos.length}}/1 + + + + + + + + + + + + + + + + + + + 商品说明 + + + + + + + + + + + 商品排序 + + + +
+
+ + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/addproduct.wxss b/pages/mine/product/productmanage/addproduct.wxss new file mode 100644 index 0000000..09ac7b7 --- /dev/null +++ b/pages/mine/product/productmanage/addproduct.wxss @@ -0,0 +1 @@ +/* pages/mine/product/productmanage/addproduct.wxss */ \ No newline at end of file diff --git a/pages/mine/product/productmanage/choosecatalog.js b/pages/mine/product/productmanage/choosecatalog.js new file mode 100644 index 0000000..5ed5eaf --- /dev/null +++ b/pages/mine/product/productmanage/choosecatalog.js @@ -0,0 +1,156 @@ +// pages/mine/product/productmanage/choosecatalog.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + selCatalogId: '', + selCatalogName: '', + catalogList: [], + currentPage: 1, + isRefreshing: false, + activeNames: ['0'], + catalogOneList: [], //一级类目 + catalogTwoList: [], //二级类目 + catalogThirdList: [], //三级类目 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getCatalogList(0, 1, 0) + }, + doChoose() { + if (this.data.selCatalogId == '') { + wx.showToast({ + title: '请选择三级类目', + icon: 'error' + }) + } else { + wx.redirectTo({ + url: './addproduct?shopId=' + this.data.shopId + '&cataLogId=' + this.data.selCatalogId, + }) + } + }, + //获取类目列表 + getCatalogList(id, level, code) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getCatalogList.format({ + level: level + }), { + header: { + token: app.globalData.token + }, + data: { + id: id, + code: code + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + data.forEach(el => { + el.isSel = false + }) + if (level == '1') { + _self.setData({ + catalogOneList: res.data + }) + } else if (level == '2') { + _self.setData({ + catalogTwoList: res.data + }) + } else { + _self.setData({ + catalogThirdList: res.data + }) + } + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + }) + }, + // 选中了条目 + selectItem(e) { + let _self = this + let { + type, + item, + index + } = e.currentTarget.dataset + if (type == '1') { + _self.data.catalogOneList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + } else { + el.isSel = false + } + }) + _self.setData({ + catalogOneList: _self.data.catalogOneList, + catalogTwoList: [], + catalogThirdList: [] + }) + _self.getCatalogList(item.id, '2', item.code) + } else if (type == '2') { + _self.data.catalogTwoList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + } else { + el.isSel = false + } + }) + _self.setData({ + catalogTwoList: _self.data.catalogTwoList, + catalogThirdList: [] + }) + _self.getCatalogList(item.id, '3', item.code) + } else { + _self.data.catalogThirdList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + this.setData({ + selCatalogId: el.id, + selCatalogName: el.name + }) + } else { + el.isSel = false + } + }) + _self.setData({ + catalogThirdList: _self.data.catalogThirdList + }) + } + }, + toAddPage() { + wx.navigateTo({ + url: './addcatalog', + }) + }, + //刷新列表 + dorefreshList() { + this.setData({ + catalogOneList: [], //一级类目 + catalogTwoList: [], //二级类目 + catalogThirdList: [], //三级类目 + isRefreshing: true, + currentPage: 1 + }) + this.getCatalogList(0, 1, 0) + } +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/choosecatalog.json b/pages/mine/product/productmanage/choosecatalog.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/productmanage/choosecatalog.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/choosecatalog.wxml b/pages/mine/product/productmanage/choosecatalog.wxml new file mode 100644 index 0000000..a847001 --- /dev/null +++ b/pages/mine/product/productmanage/choosecatalog.wxml @@ -0,0 +1,88 @@ + + + 商品类目 + + + + + + + 当前选中类别:{{selCatalogName}} + + + + + + + 商品类目(一级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 商品类目(二级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 商品类目(三级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/choosecatalog.wxss b/pages/mine/product/productmanage/choosecatalog.wxss new file mode 100644 index 0000000..5a20666 --- /dev/null +++ b/pages/mine/product/productmanage/choosecatalog.wxss @@ -0,0 +1 @@ +/* pages/mine/product/productmanage/choosecatalog.wxss */ \ No newline at end of file diff --git a/pages/mine/product/productmanage/productlist.js b/pages/mine/product/productmanage/productlist.js new file mode 100644 index 0000000..ad79bba --- /dev/null +++ b/pages/mine/product/productmanage/productlist.js @@ -0,0 +1,302 @@ +// pages/mine/product/productmanage/productlist.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + CustomBar: app.globalData.CustomBar, + productList: [], + isRefreshing: false, + currentPage: 1, + totalSize: 0, + shopId: '', + isAddPage: false, + isCatalogPage: false, + activeNames: ['0'], + baseImageUrl: app.urls.baseImgUrl, + currentCatalogId: '', + curIndex: 0, + active: 1, + curGoodsList: [], + contentHeight: app.globalData.windowHeight - app.globalData.CustomBar, + isLoadMore: false, + hasMore: true + }, + /** + * 切换类目 + */ + switchRightTap(e) { + let curindex = parseInt(e.currentTarget.dataset.curindex); + this.data.productList[curindex].goodsList = [] + this.setData({ + currentPage: 1, + hasMore: true, + isLoadMore: false, + curIndex: curindex + }) + let item = this.data.productList[curindex] + this.getGoodsListByCId(item.categoryId) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getShopCatalogList(this.data.shopId) + }, + //获取店铺所有商品类目 + getShopCatalogList(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopCatalogList.format({ + shopId: id + }), { + hedaer: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.buildDatas(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + doAdd(e) { + let key = e.currentTarget.dataset.key + if ('chooseCatalog' == key) { + wx.navigateTo({ + url: './choosecatalog?shopId=' + this.data.shopId, + }) + } else { + if (e.currentTarget.dataset.item) { + wx.navigateTo({ + url: './addproduct?shopId=' + this.data.shopId + '&cataLogId=' + e.currentTarget.dataset.item.categoryId, + }) + } else { + wx.showToast({ + title: '请先添加类目', + icon: 'error' + }) + } + } + }, + manageGoods(e) { + wx.navigateTo({ + url: './productmanage?shopId=' + e.currentTarget.dataset.item.shopId + '&shopGoodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, + /** + * 获取商品列表 + */ + getGoodsList(shopId) { + wx.showLoading({ + title: '加载中...', + }) + app.htt.get(app.urls.getShopGoodsList.format({ + shopId: shopId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + this.setData({ + isRefreshing: false + }) + this.buildDatas(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //构建数据 + buildDatas(data) { + let _self = this + if (data.length > 0) { + data.forEach(el => { + el.goodsList = [] + _self.data.productList.push(el) + }) + _self.setData({ + curIndex: 0, + productList: _self.data.productList + }) + _self.getGoodsListByCId(_self.data.productList[0].categoryId) + } + }, + //去除重复的 + unique(rows) { + let temp = rows.concat() + let tempList = [] + for (var i = 0; i < temp.length; i++) { + for (var j = i + 1; j < temp.length; j++) { + if (temp[i].categoryId == temp[j].categoryId) { + temp.splice(j, 1); + j-- + } + } + } + temp.forEach(el => { + tempList.push({ + name: el.categoryName, + id: el.categoryId, + goods: [] + }) + }) + return tempList + }, + //刷新页面 + dorefreshList() { + this.setData({ + currentPage: 1, + isLoadMore: false, + hasMore: true, + productList: [] + }) + this.getShopCatalogList(this.data.shopId) + }, + onShow() { + if (this.data.isAddPage) { + this.setData({ + isAddPage: false + }) + this.dorefreshList() + } + }, + //根据类目ID获取商品 + getGoodsListByCId(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getGoodsByCatalogAndShop.format({ + categoryId: id + }), { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage, + shopId: _self.data.shopId + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + if (res.data.rows.length > 0) { + _self.data.productList.forEach(el => { + if (el.categoryId == id) { + el.goodsList = el.goodsList.concat(res.data.rows) + } + }) + _self.setData({ + productList: _self.data.productList + }) + } else { + _self.setData({ + hasMore: false + }) + } + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + }) + }, + onChange(e) { + let _self = this + let item = e.currentTarget.dataset.item + console.log(item) + this.setData({ + activeNames: e.detail, + currentCatalogId: item.categoryId + }) + console.log(e) + if (e.detail.length > 1) { + //展开 + if (item.goodsList || item.goodsList.length <= 0) { + _self.getGoodsListByCId(item.categoryId) + } + } + }, + doSearchGoods() { + wx.navigateTo({ + url: './searchproduct?shopId=' + this.data.shopId, + }) + }, + //加载更多 + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + let item = _self.data.productList[_self.data.curIndex] + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getGoodsListByCId(item.categoryId) + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + doDelCategory(e) { + let _self = this + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelShopCategoryById.format({ + ids: e.currentTarget.dataset.item.categoryId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + productList: [] + }) + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + _self.getShopCatalogList(_self.data.shopId) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + showConfirmDialog(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该类目吗?(删除后该类目下所有商品将删除!)', + success(res) { + if (res.confirm) { + _self.doDelCategory(e) + } + } + }) + } +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/productlist.json b/pages/mine/product/productmanage/productlist.json new file mode 100644 index 0000000..438d942 --- /dev/null +++ b/pages/mine/product/productmanage/productlist.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-loading": "/vant/dist/loading/index" + } +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/productlist.wxml b/pages/mine/product/productmanage/productlist.wxml new file mode 100644 index 0000000..3901c12 --- /dev/null +++ b/pages/mine/product/productmanage/productlist.wxml @@ -0,0 +1,61 @@ + + + 商品管理 + + + + + 请输入搜索关键字,例如:手机 + + + + + + + + {{item.categoryName}} + + + + + + + + + + + + + + + + + + + {{item.goodsStatus=='1' ? '在售' : '下架' }} + + + + {{item.goodsName}} + + + + {{item.goodsSummary}} + + + ¥:{{item.goodsUnitPrice}} + + 库存:{{item.goodsTotal > 1000 ? '999+' : item.goodsTotal}} + + + + + 加载中... + + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/productlist.wxss b/pages/mine/product/productmanage/productlist.wxss new file mode 100644 index 0000000..0fad7cd --- /dev/null +++ b/pages/mine/product/productmanage/productlist.wxss @@ -0,0 +1,98 @@ +/* pages/mine/product/productmanage/productlist.wxss */ +page { + padding-top: 80rpx; +} + +/* pages/category/index.wxss */ +.category { + display: flex; + flex-direction: row; + height: 100%; + margin-bottom: 80rpx; +} + +.nav_left { + background: #f8f8f8; + width: 30%; + height: 100%; + white-space: nowrap; +} + +.nav_right { + background: #fff; + width: 70%; + height: 100%; +} + +.nav_left_bg { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + padding: 10rpx; + background: #f8f8f8; + position: relative; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.nav_left_items { + font-size: 28rpx; + color: #333; + height: 100rpx; + line-height: 100rpx; + text-align: center; +} + +.nav_left_border { + border-left-color: #0054bd; + border-left-width: 2px; + border-left-style: solid; +} + +.nav_left_item-active { + background-color: #fff; + color: #0054bd; +} + +.jd-category { + margin: 40rpx 16rpx 0; +} + +.jd-category-wrap { + overflow: hidden; + padding: 20rpx 20rpx 0; +} + +.jd-category .title { + font-size: 28rpx; + height: 60rpx; + line-height: 30rpx; + font-weight: 700; + color: #080808 +} + +.jd-category-style { + width: 32.8%; + float: left; + display: flex; + flex-direction: column; + justify-content: center; +} + +.list_img { + width: 150rpx; + height: 150rpx; +} + +.list_text { + text-align: center; + font-size: 24rpx; + color: #686868; + margin-top: 10rpx; + height: 70rpx; +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/productmanage.js b/pages/mine/product/productmanage/productmanage.js new file mode 100644 index 0000000..eabd7df --- /dev/null +++ b/pages/mine/product/productmanage/productmanage.js @@ -0,0 +1,488 @@ +// pages/mine/product/productmanage/productmanage.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + goodsId: '', + goodsBean: null, + shopId: '', + cataLogId: '', //上级页面传递 + goodsName: '', //商品名称 + goodsCount: 0, //商品数量 + goodsPrice: 0.00, //商品单价 + goodsUnit: '', //商品单位 + goodsStatus: 1, //商品状态 1 上架 2 下架 + goodsPay: 1, //支付方式 1 线上 2 线下 + goodsLogoPhotos: [], //商品Logo + goodsPhotos: [], //商品图片 + goodsVideos: [], //商品视频 + goodsSummary: '', //商品说明 + goodsOrder: 0, //商品排序 + isPopular: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + goodsId: options.shopGoodsId + }) + this.getGoodsDetail(this.data.goodsId) + }, + getGoodsDetail(id) { + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getGoodsDetail.format({ + goodsId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (code == 200) { + this.setDataToView(res.data) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + selGoodsPopular(e) { + console.log(e) + this.setData({ + isPopular: e.detail.value + }) + }, + setDataToView(data) { + let _self = this + if (data.goodsPhotos != '') { + let ids = data.goodsPhotos + let idsList = ids.split(',') + idsList.forEach(el => { + if (el != '') { + _self.data.goodsPhotos.push({ + id: el, + path: app.tradeUrl + app.baseImgUrl + el + }) + } + }) + _self.setData({ + goodsPhotos: _self.data.goodsPhotos + }) + } + + if (data.goodsIcon != '') { + let ids = data.goodsIcon + _self.data.goodsLogoPhotos.push({ + id: ids, + path: app.tradeUrl + app.baseImgUrl + ids + }) + _self.setData({ + goodsLogoPhotos: _self.data.goodsLogoPhotos + }) + } + + if (data.goodsVideo != '') { + let ids = data.goodsVideo + let idsList = ids.split(',') + idsList.forEach(el => { + if (el != '') { + _self.data.goodsVideos.push({ + id: el, + videoUrl: app.tradeUrl + app.baseImgUrl + el, + path: '../../../../images/ic_video_default.png', + }) + } + }) + _self.setData({ + goodsVideos: _self.data.goodsVideos + }) + } + this.setData({ + goodsBean: data, + shopId: data.shopId, + cataLogId: data.cataLogId, //上级页面传递 + goodsName: data.goodsName, //商品名称 + goodsCount: data.goodsTotal, //商品数量 + goodsPrice: data.goodsUnitPrice, //商品单价 + goodsUnit: data.goodsUnit, //商品单位 + goodsStatus: data.goodsStatus, //商品状态 1 上架 2 下架 + goodsPay: data.paymentType, //支付方式 1 线上 2 线下 + goodsSummary: data.goodsSummary, //商品说明 + goodsOrder: data.goodsSort, //商品排序 + isPopular: data.isPopular == '0' ? false : true + }) + }, + //商品状态切换 + selGoodsStatus(e) { + this.setData({ + goodsStatus: e.detail.value + }) + }, + //支付方式切换 + selGoodsPay(e) { + this.setData({ + goodsPay: e.detail.value + }) + }, + //输入框监听 + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + //商品说明 + goodsSummaryInput(e) { + this.setData({ + goodsSummary: e.detail.value + }) + }, + /** + * 添加图片、视频 1 logo 2 图片 + */ + chooseLogo() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + choosePhoto() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + chooseVideo() { + let _self = this + wx.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], //从相册选择 + maxDuration: 30, + success: (res) => { + _self.doUploadVideo(res) + } + }); + }, + /** + * 删除图片、视频 + */ + delLogo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsLogoPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsLogoPhotos: _self.data.goodsLogoPhotos + }) + } + } + }) + }, + delPhoto(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsPhotos: _self.data.goodsPhotos + }) + } + } + }) + }, + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsVideos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsVideos: _self.data.goodsVideos + }) + } + } + }) + }, + /** + * 预览图片、视频 + */ + viewLogo(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewPhoto(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //上传图片 + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + if (type == 1) { + let tempList = _self.data.goodsLogoPhotos.concat(item) + _self.setData({ + goodsLogoPhotos: tempList + }) + } else { + //图片 + let tempList = _self.data.goodsPhotos.concat(item) + _self.setData({ + goodsPhotos: tempList + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + doUploadVideo(e) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadVideo, { + name: 'video', + path: e.tempFiles[0].tempFilePath, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = e.tempFiles[0].thumbTempFilePath + let videoU = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr, + videoUrl: videoU + } + let tempList = _self.data.goodsVideos.concat(item) + _self.setData({ + goodsVideos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //修改 + doUpdate() { + if (this.checkParams()) { + let _self = this + wx.showLoading({ + title: '更新中...', + }) + let p = '' + _self.data.goodsPhotos.forEach(el => { + p += el.id + ',' + }) + if (p.length != '') { + p = p.substr(0, p.length - 1) + } + let videoId = '' + if (_self.data.goodsVideos.length > 0) { + videoId = _self.data.goodsVideos[0].id + } + app.http.put(app.urls.doUpdateGoods.format({ + shopGoodsId: _self.data.goodsId + }), { + header: { + token: app.globalData.token + }, + data: { + categoryId: _self.data.cataLogId, + goodsIcon: _self.data.goodsLogoPhotos[0].id, + goodsName: _self.data.goodsName, + goodsPhotos: p, + goodsSort: _self.data.goodsOrder, + goodsStatus: _self.data.goodsStatus, + goodsSummary: _self.data.goodsSummary, + goodsTotal: _self.data.goodsCount, + goodsUnit: _self.data.goodsUnit, + goodsUnitPrice: _self.data.goodsPrice, + goodsVideo: videoId, + paymentType: _self.data.goodsPay, + shopId: _self.data.shopId, + isPopular: _self.data.isPopular ? 1 : 0 + } + }) + .then(res => { + wx.hideLoading({}) + if (code == 200) { + wx.showToast({ + title: '更新成功', + icon: 'success' + }) + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + doDelGoods() { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该商品吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelGoods.format({ + ids: _self.data.goodsId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (code == 200) { + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + //校验参数合法性 + checkParams() { + if (this.data.goodsName == '') { + wx.showToast({ + title: '请输入商品名称', + icon: 'error' + }) + return false + } + if (this.data.goodsCount == 0) { + wx.showToast({ + title: '请输入商品数量', + icon: 'error' + }) + return false + } + + if (this.data.goodsCount == 0) { + wx.showToast({ + title: '请输入商品数量', + icon: 'error' + }) + return false + } + if (this.data.goodsUnit == '') { + wx.showToast({ + title: '请输入商品单位', + icon: 'error' + }) + return false + } + if (this.data.goodsLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传商品Logo', + icon: 'error' + }) + return false + } + if (this.data.goodsPhotos.length <= 0) { + wx.showToast({ + title: '请上传商品图片', + icon: 'error' + }) + return false + } + return true + } +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/productmanage.json b/pages/mine/product/productmanage/productmanage.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/productmanage/productmanage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/productmanage.wxml b/pages/mine/product/productmanage/productmanage.wxml new file mode 100644 index 0000000..d95c6d8 --- /dev/null +++ b/pages/mine/product/productmanage/productmanage.wxml @@ -0,0 +1,166 @@ + + 商品管理 + + +
+ + + + 商品名称 + + + + + + + 是否热门 + + + + + + + + + 商品数量 + + + + + + + 商品单价 + + + + + + + 商品单位 + + + + + + + + 商品状态 + + + 上架 + 下架 + + + + + + + + 支付方式 + + + 线上 + 线下 + + + + + + + 商品Logo + + + {{goodsLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + + 商品图片 + + + {{goodsPhotos.length}}/9 + + + + + + + + + + + + + + + + + + + 商品视频 + + + {{goodsVideos.length}}/1 + + + + + + + + + + + + + + + + + + + 商品说明 + + + + + + + + + + + 商品排序 + + + +
+ +
+ + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/productmanage.wxss b/pages/mine/product/productmanage/productmanage.wxss new file mode 100644 index 0000000..6c87c3c --- /dev/null +++ b/pages/mine/product/productmanage/productmanage.wxss @@ -0,0 +1 @@ +/* pages/mine/product/productmanage/productmanage.wxss */ \ No newline at end of file diff --git a/pages/mine/product/productmanage/searchproduct.js b/pages/mine/product/productmanage/searchproduct.js new file mode 100644 index 0000000..07d870d --- /dev/null +++ b/pages/mine/product/productmanage/searchproduct.js @@ -0,0 +1,102 @@ +// pages/mine/product/productmanage/searchproduct.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + CustomBar: app.globalData.CustomBar, + goodsList: [], + baseImageUrl: app.urls.baseImgUrl, + shopId: '', + countTime: 2000, //延迟搜索 时间 + searchWaiting: false, //是否等待搜索倒计时中, + searchKey: '' + }, + /** + * 获取商品列表 + */ + getGoodsList(keywords) { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getShopGoodsList.format({ + shopId: _self.data.shopId + }), { + header: { + token: app.globalData.token + }, + data: { + keywords: keywords + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.setData({ + goodsList: res.data.rows + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + }, + manageGoods(e) { + wx.navigateTo({ + url: './productmanage?shopGoodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, + searchGoods(e) { + this.setData({ + countTime: 2000, + searchKey: e.detail.value, + }) + //是否处于搜索倒计时中 + if (!this.data.searchWaiting) { + this.timer(); + } + }, + /** + * 延迟搜索 + */ + timer() { + var that = this; + this.setData({ + searchWaiting: true + }) + + let promise = new Promise((resolve, reject) => { + let setTimer = setInterval( + () => { + console.log('搜索倒计时: ' + that.data.countTime); + this.setData({ + countTime: this.data.countTime - 1000 + }) + if (this.data.countTime <= 0) { + console.log('开始搜索: ' + that.data.params); + this.setData({ + countTime: 2000, + searchWaiting: false, + }) + resolve(setTimer) + } + }, 1000) + }) + promise.then((setTimer) => { + this.getGoodsList(this.data.searchKey) + clearInterval(setTimer) //清除计时器 + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/searchproduct.json b/pages/mine/product/productmanage/searchproduct.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/productmanage/searchproduct.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/searchproduct.wxml b/pages/mine/product/productmanage/searchproduct.wxml new file mode 100644 index 0000000..fef3c77 --- /dev/null +++ b/pages/mine/product/productmanage/searchproduct.wxml @@ -0,0 +1,33 @@ + + 商品搜索 + + + + + + + + + + + + + {{good.goodsStatus=='1' ? '在售' : '下架' }} + + + + {{good.goodsName}} + + + {{good.goodsSummary}} + + + + + 库存:{{good.goodsTotal > 1000 ? '999+' : good.goodsTotal}} + 单价:{{good.goodsUnitPrice}} + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/searchproduct.wxss b/pages/mine/product/productmanage/searchproduct.wxss new file mode 100644 index 0000000..fd4e82f --- /dev/null +++ b/pages/mine/product/productmanage/searchproduct.wxss @@ -0,0 +1 @@ +/* pages/mine/product/productmanage/searchproduct.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/addshop.js b/pages/mine/shop/addshop.js new file mode 100644 index 0000000..082593b --- /dev/null +++ b/pages/mine/shop/addshop.js @@ -0,0 +1,378 @@ +const app = getApp(); +Page({ + data: { + StatusBar: app.globalData.StatusBar, + CustomBar: app.globalData.CustomBar, + startDate: "", + endDate: "", + shopName: "", //商店名称 + shopAddress: "", //商店地址 + index: null, + date: '2021-08-08', //营业时间 + shopLicensePhotos: [], //商店营业执照 + shopLogoPhotos: [], //商店Logo + textareaBValue: '', //店铺简介, + isBusiness: true, //是否开业 + selTradeList: [], //行业类型 + shopVideos: [], //宣传视频 + selTemplateId: '1', + selTradeNames: '请选择行业', + }, + PickerChange(e) { + this.setData({ + index: e.detail.value + }) + }, + // 商店注册 + RegisterShop() { + if (this.checkParams()) { + wx.showLoading({ + title: '注册中...' + }) + let _self = this + let industryIds = '' + this.data.selTradeList.forEach(el => { + industryIds += el.id + ',' + }) + app.http.post(app.urls.doSaveShop, { + header: { + token: app.globalData.token + }, + data: { + shopName: _self.data.shopName, + shopAddress: _self.data.shopAddress, + shopSummary: _self.data.textareaBValue, + openDate: _self.data.date, + shopLogo: _self.data.shopLogoPhotos[0].id, + industryIds: industryIds, + shopTemplateId: _self.data.selTemplateId, + isOpen: _self.data.isBusiness ? '1' : '0', + shopVideo: _self.data.shopVideos.length > 0 ? _self.data.shopVideos[0].id : '' + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '注册成功', + icon: 'success', + success(res) { + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //选择模板样式 + choosetemplate(e) { + this.setData({ + selTemplateId: e.detail.value + }) + }, + DateChange(e) { + this.setData({ + date: e.detail.value + }) + }, + + checkIsBusiness(e) { + this.setData({ + isBusiness: e.detail.value + }) + }, + //选择营业执照 + ChooseLicenseP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + //选择logo + ChooseLogoP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + //删除Logo + DelLogoP(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLogoPhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLogoPhotos: this.data.shopLogoPhotos + }) + } + } + }) + }, + //删除营业执照 + DelLicenseP(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLicensePhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLicensePhotos: this.data.shopLicensePhotos + }) + } + } + }) + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + if (type == 2) { + //Logo + let tempList = _self.data.shopLogoPhotos.concat(item) + _self.setData({ + shopLogoPhotos: tempList + }) + } else { + //营业执照 + let tempList = _self.data.shopLicensePhotos.concat(item) + _self.setData({ + shopLicensePhotos: tempList + }) + } + }) + .catch(err => { + wx.hideLoading({}) + wx.showToast({ + title: '上传失败,请重试', + icon: 'none' + }) + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + ViewLogoImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.shopVideos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + shopVideos: _self.data.shopVideos + }) + } + } + }) + }, + textareaBInput(e) { + this.setData({ + textareaBValue: e.detail.value + }) + }, + checkParams() { + var _self = this + if (_self.data.shopName == '') { + wx.showToast({ + title: '商店名称为必填项', + icon: 'none' + }) + return false + } + if (_self.data.shopAddress == '') { + wx.showToast({ + title: '店铺地址为必填项', + icon: 'none' + }) + return false + } + if (_self.data.selTradeList.length <= 0) { + wx.showToast({ + title: '请选择行业', + icon: 'none' + }) + return false + } + if (_self.data.date == '') { + wx.showToast({ + title: '请选择开业时间', + icon: 'none' + }) + return false + } + if (_self.data.shopLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传店铺Logo', + icon: 'none' + }) + return false + } + + return true + }, + showModal(e) { + this.setData({ + modalName: e.currentTarget.dataset.target + }) + }, + hideModal(e) { + this.setData({ + modalName: null + }) + }, + showChooseTrade() { + wx.navigateTo({ + url: './choosetrade', + }) + }, + onShow() { + let _self = this + if (_self.data.selTradeList.length > 0) { + var names = '' + _self.data.selTradeList.forEach(el => { + names += el.name + ',' + }) + _self.setData({ + selTradeNames: names + }) + } + }, + //选择视屏 + chooseVideo() { + let _self = this + wx.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], //从相册选择 + maxDuration: 30, + success: (res) => { + _self.doUploadVideo(res) + } + }); + }, + doUploadVideo(e) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadVideo, { + name: 'video', + path: e.tempFiles[0].tempFilePath, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = e.tempFiles[0].thumbTempFilePath + let videoU = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr, + videoUrl: videoU + } + let tempList = _self.data.shopVideos.concat(item) + _self.setData({ + shopVideos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + showTemplete(e) { + var item = e.currentTarget.dataset.item + var path = [] + switch (item) { + case "1": + path.push('../../../images/templete_1.png') + break + case "2": + path.push('../../../images/templete_2.png') + break + case "3": + path.push('../../../images/templete_3.png') + break + case "4": + path.push('../../../images/templete_4.png') + break + } + console.log(path) + wx.previewImage({ + urls: path, + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/addshop.json b/pages/mine/shop/addshop.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/addshop.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/addshop.wxml b/pages/mine/shop/addshop.wxml new file mode 100644 index 0000000..a5653fc --- /dev/null +++ b/pages/mine/shop/addshop.wxml @@ -0,0 +1,165 @@ + + 店铺注册 + + +
+ + + + 店铺名称 + + + + + + + 店铺地址 + + + + + + + 行    业 + + + {{selTradeNames}} + + + + + + + 开业日期 + + + + {{date}} + + + + + + + 是否开业 + + + + + + + + + 店铺Logo + + + {{shopLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + 宣传视频 + + + {{shopVideos.length}}/1 + + + + + + + + + + + + + + + + + + + 店铺简介 + + + + + + + + + + + 展示样式 + + + + + + + 样式一 + + + + 样式二 + + + + 样式三 + + + + 样式四 + + + + + +
+
+ + + \ No newline at end of file diff --git a/pages/mine/shop/addshop.wxss b/pages/mine/shop/addshop.wxss new file mode 100644 index 0000000..bf02d07 --- /dev/null +++ b/pages/mine/shop/addshop.wxss @@ -0,0 +1,3 @@ +.cu-form-group .title { + min-width: calc(4em + 30rpx); +} diff --git a/pages/mine/shop/choosetrade.js b/pages/mine/shop/choosetrade.js new file mode 100644 index 0000000..8c7f25b --- /dev/null +++ b/pages/mine/shop/choosetrade.js @@ -0,0 +1,207 @@ +// pages/mine/shop/choose.js +const app = getApp() + +Page({ + + /** + * 页面的初始数据 + */ + data: { + activeNames: ['0'], + tradeList: [], //一级行业类型 + tradeTwoList: [], //二级行业类型 + tradeThirdList: [], //三级行业类型, + selectItems: [], //选中的行业, + selectItemNames: '' + }, + getTradeList() { + wx.showLoading({ + title: '获取中...' + }) + let _self = this + app.http.get(app.urls.getIndustryList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + data.forEach(el => { + el.isSel = false + }) + _self.setData({ + tradeList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //type 2 二级 3三级 + getTradeListById(id, type) { + console.log(type) + wx.showLoading({ + title: '获取中...' + }) + let _self = this + app.http.get(app.urls.getIndustryList, { + header: { + token: app.globalData.token + }, + data: { + id: id + } + }) + .then(res => { + wx.hideLoading({}) + res.data.forEach(el => { + el.isSel = false + }) + _self.data.selectItems.forEach(element => { + res.data.forEach(el => { + if (element.id == el.id) { + el.isSel = true + } + }) + }) + if (type == '1') { + _self.setData({ + tradeTwoList: res.data + }) + } else if (type == '2') { + _self.setData({ + tradeThirdList: res.data + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //选中 + selectItem(e) { + let item = e.currentTarget.dataset.item + let type = e.currentTarget.dataset.type + this.doSelectItem(item) + if (type == '1') { + this.data.tradeList.forEach(el => { + if (item.id == el.id) { + el.isSel = !el.isSel + } + }) + this.setData({ + tradeList: this.data.tradeList + }) + } else if (type == '2') { + this.data.tradeTwoList.forEach(el => { + if (item.id == el.id) { + el.isSel = !el.isSel + } + }) + this.setData({ + tradeTwoList: this.data.tradeTwoList + }) + } else { + this.data.tradeThirdList.forEach(el => { + if (item.id == el.id) { + el.isSel = !el.isSel + } + }) + this.setData({ + tradeThirdList: this.data.tradeThirdList + }) + } + }, + //点击文字 + chooseItem(e) { + let item = e.currentTarget.dataset.i + let type = e.currentTarget.dataset.type + if (type == '1') { + this.setData({ + tradeTwoList: [], + tradeThirdList: [] + }) + this.getTradeListById(item.id, type) + } else if (type == '2') { + this.setData({ + tradeThirdList: [] + }) + this.getTradeListById(item.id, type) + } else { + this.doSelectItem(item) + this.data.tradeThirdList.forEach(el => { + if (el.id == item.id) { + el.isSel = !el.isSel + } + }) + this.setData({ + tradeThirdList: this.data.tradeThirdList + }) + } + }, + doSelectItem(item) { + let _self = this + let isSel = !item.isSel + console.log(isSel) + if (isSel) { + _self.data.selectItems.push(item) + + _self.setData({ + selectItems: _self.data.selectItems + }) + console.log(_self.data.selectItems) + } else { + //剔除 + let index = -1 + for (var i = 0; i < _self.data.selectItems.length; ++i) { + if (item.id == _self.data.selectItems[i].id) { + index = i + break + } + } + if (index != -1) { + _self.data.selectItems.splice(index, 1) + } + _self.setData({ + selectItems: _self.data.selectItems + }) + } + var names = '' + _self.data.selectItems.forEach(el => { + names += el.name + ',' + }) + console.log(names) + _self.setData({ + selectItemNames: names + }) + }, + onChange(e) { + this.setData({ + activeNames: e.detail + }) + }, + selected() { + let _self = this + if (_self.data.selectItems.length > 0) { + let pages = getCurrentPages() + let prevPage = pages[pages.length - 2] + prevPage.setData({ + selTradeList: _self.data.selectItems + }) + wx.navigateBack({ + delta: 1, + }) + } else { + wx.showToast({ + title: '未选择任何行业', + icon: 'error' + }) + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getTradeList() + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/choosetrade.json b/pages/mine/shop/choosetrade.json new file mode 100644 index 0000000..f637356 --- /dev/null +++ b/pages/mine/shop/choosetrade.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "van-collapse": "/vant/dist/collapse/index", + "van-collapse-item": "/vant/dist/collapse-item/index" + } +} \ No newline at end of file diff --git a/pages/mine/shop/choosetrade.wxml b/pages/mine/shop/choosetrade.wxml new file mode 100644 index 0000000..d0c3c84 --- /dev/null +++ b/pages/mine/shop/choosetrade.wxml @@ -0,0 +1,93 @@ + + + 行业选择 + + + + 当前选择 + + + + + {{item.name}} + + + + + + + + + 行业类型(一级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 行业类型(二级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 行业类型(三级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/choosetrade.wxss b/pages/mine/shop/choosetrade.wxss new file mode 100644 index 0000000..40c05c1 --- /dev/null +++ b/pages/mine/shop/choosetrade.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/choose.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/mineshop.js b/pages/mine/shop/mineshop.js new file mode 100644 index 0000000..30aaa9d --- /dev/null +++ b/pages/mine/shop/mineshop.js @@ -0,0 +1,153 @@ +// pages/mine/shop/mineshop.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + mineShopList: [], + instance: null, + currentPage: 1, + baseImageUrl: app.urls.baseImgUrl, + isOpenCell: false, + refresherTriggered: false + }, + onOpen(e) { + this.setData({ + isOpenCell: true + }) + }, + onClose(e) { + const { + position, + instance + } = e.detail + switch (position) { + case 'right': + case 'cell': + this.setData({ + isOpenCell: false + }) + instance.close() + break + } + + }, + //显示店铺详情 + showShopDetail(e) { + if (!this.data.isOpenCell) { + wx.navigateTo({ + url: './mineshopdetail?shopId=' + e.currentTarget.dataset.item.shopId, + }) + } + }, + //删除店铺 + doDelItem(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该店铺吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelShop.format({ + ids: e.currentTarget.dataset.item.shopId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + }) + _self.refreshView() + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + //编辑店铺 + doEditItem(e) { + wx.navigateTo({ + url: './shopedit?shopId=' + e.currentTarget.dataset.item.shopId, + }) + }, + //添加店铺 + toAddShop() { + wx.navigateTo({ + url: './addshop', + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + getMineShopList() { + wx.showLoading({ + title: '加载中...', + }) + let _self = this + app.http.get(app.urls.getMineShopList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + refresherTriggered: false + }) + _self.setData({ + mineShopList: res.data.rows + }) + _self.doOpenOneCell() + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + refresherTriggered: false + }) + }) + }, + //自动打开第一个条目 + doOpenOneCell() { + var cell = this.selectComponent('#swipe-item-0') + if (cell && app.globalData.isFirst) { + cell.open() + app.globalData.isFirst = false + } + }, + //刷新页面 + refreshView() { + this.setData({ + currentPage: 1, + refresherTriggered: true + }) + this.getMineShopList() + }, + onShow() { + this.refreshView() + }, + //认证 + doAuth(e) { + if (e.currentTarget.dataset.item.isCertification == 0) { + //去认证 + wx.navigateTo({ + url: './shopauthentication?shopId=' + e.currentTarget.dataset.item.shopId, + }) + } + } +}) \ No newline at end of file diff --git a/pages/mine/shop/mineshop.json b/pages/mine/shop/mineshop.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/mineshop.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/mineshop.wxml b/pages/mine/shop/mineshop.wxml new file mode 100644 index 0000000..f8fd844 --- /dev/null +++ b/pages/mine/shop/mineshop.wxml @@ -0,0 +1,54 @@ + + + 我的店铺 + + + + + + + + + + {{item.shopName}} + + + {{item.shopSummary}} + + + + {{item.openDate}} + + {{item.isCertification == 0 ? '未认证' :'已认证'}} + + + + + + + + + 删除 + + + 编辑 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/mineshop.wxss b/pages/mine/shop/mineshop.wxss new file mode 100644 index 0000000..74fcbb1 --- /dev/null +++ b/pages/mine/shop/mineshop.wxss @@ -0,0 +1,30 @@ +/* pages/mine/shop/mineshop.wxss */ +/* +.cardTitle { + color: #fff; + padding: 20rpx 40rpx; + font-size: 70rpx; + font-weight: 300; + position: relative; + text-align: center; + text-shadow: 0px 0px 6rpx rgba(0, 0, 0, 0.3) +} + +.cardTitle::before { + position: absolute; + width: 60rpx; + height: 6rpx; + border-radius: 20rpx; + display: block; +} + +.cardTitle::after { + position: absolute; + width: 140rpx; + border-radius: 6rpx; + height: 24rpx; + display: block; + bottom: 76rpx; + left: 90rpx; + opacity: 0.1; +} */ \ No newline at end of file diff --git a/pages/mine/shop/mineshopdetail.js b/pages/mine/shop/mineshopdetail.js new file mode 100644 index 0000000..8954964 --- /dev/null +++ b/pages/mine/shop/mineshopdetail.js @@ -0,0 +1,218 @@ +// pages/mine/shop/mineshopdetail.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopBean: null, + baseImageUrl: app.urls.baseImgUrl, + shopId: '', + show: false, + qrCode: '', + baseImg: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getShopDetail(options.shopId) + }, + getShopDetail(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopDetail.format({ + shopId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + shopBean: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //职位管理 + positionManage() { + wx.navigateTo({ + url: '../manage/shopposition?shopId=' + this.data.shopBean.shopId, + }) + }, + // 职员管理 + staffManage() { + wx.navigateTo({ + url: '../manage/shopstaff?shopId=' + this.data.shopBean.shopId, + }) + }, + // 会员管理 + memberManage() { + wx.navigateTo({ + url: '../manage/shopmember?shopId=' + this.data.shopBean.shopId, + }) + }, + // 商品类目管理 + catalogManage() { + wx.navigateTo({ + url: '../product/catalogmanage/catalogmanage?shopId=' + this.data.shopBean.shopId, + }) + }, + productManage() { + wx.navigateTo({ + url: '../product/productmanage/productlist?shopId=' + this.data.shopBean.shopId, + }) + }, + /** + * 获取添加员工二维码 + */ + addStaff() { + let _self = this + wx.showLoading({ + title: '获取中...', + }) + app.http.get(app.urls.getShopCode.format({ + shopId: _self.data.shopId, + type: '1' + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + qrCode: app.urls.baseImgUrl + res.data.data, + show: true + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + /** + * 获取添加会员二维码 + */ + addMember() { + let _self = this + wx.showLoading({ + title: '获取中...', + }) + app.http.get(app.urls.getShopCode.format({ + shopId: _self.data.shopId, + type: '1' + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (code == 200) { + _self.setData({ + qrCode: app.urls.baseImgUrl + res.data.data, + show: true + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + scanCode() { + let _self = this + wx.scanCode({ + onlyFromCamera: true, + success(res) { + _self.doAddMember(res.result) + }, + fail(err) { + console.log(err) + } + }) + }, + onClose() { + this.setData({ + show: false + }) + }, + doAddMember(res) { + console.log(res) + var result = JSON.parse(res) + console.log(result) + if (result.type == '2') { + //会员添加 + wx.showLoading({ + title: '会员注册中...', + }) + } else if (result.type == '1') { + //员工添加 + wx.showLoading({ + title: '员工注册中...', + }) + } + var url = app.urls.url + result.url + app.http.post(url, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (result.type == 2) { + wx.showToast({ + title: '会员注册成功', + icon: 'success' + }) + } else if (result.type == 1) { + wx.showToast({ + title: '员工注册成功,请等待审核', + icon: 'none' + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + showCertificationInfo(e) { + let _self = this + if (_self.data.shopBean.auditStatus == 0) { + if (_self.data.shopBean.shopCertificationId == '') { + //未提交审核 + wx.navigateTo({ + url: './shopauthentication?shopId=' + _self.data.shopId, + }) + } else { + //审核中 + wx.navigateTo({ + url: './shopauthenticationdetail?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } + } else if (_self.data.shopBean.auditStatus == 1) { + //审核通过 + wx.navigateTo({ + url: './shopauthenticationdetail?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } else { + //审核不通过 + wx.navigateTo({ + url: './shopauthenticationedit?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } + }, + onShow() { + this.getShopDetail(this.data.shopId) + } +}) \ No newline at end of file diff --git a/pages/mine/shop/mineshopdetail.json b/pages/mine/shop/mineshopdetail.json new file mode 100644 index 0000000..78c1815 --- /dev/null +++ b/pages/mine/shop/mineshopdetail.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-dialog": "/vant/dist/dialog/index" + } +} \ No newline at end of file diff --git a/pages/mine/shop/mineshopdetail.wxml b/pages/mine/shop/mineshopdetail.wxml new file mode 100644 index 0000000..f1ebae6 --- /dev/null +++ b/pages/mine/shop/mineshopdetail.wxml @@ -0,0 +1,196 @@ + + 店铺详情 + + + + + 基础信息 + + + + + + 认证信息 + + + + {{shopBean.shopCertificationId== '' ? '未认证' : '审核中'}} + + 已认证 + 审核未通过 + + + + + + 店铺名称 + + {{shopBean.shopName}} + + + + + 店铺地址 + + {{shopBean.shopAddress}} + + + + + 开业日期 + + {{shopBean.openDate}} + + + + + 是否开业 + + {{shopBean.isOpen==0? '未开业':'营业中'}} + + + + + 店铺Logo + + + + + + + + + + + + + + 宣传视频 + + + + + + + + + + 店铺简介 + + + + + {{shopBean.shopSummary}} + + + + + + 展示样式 + + + + + {{'样式'+shopBean.shopTemplateId}} + + + + + + + 店铺管理 + + + + + + + + + 职位管理 + + + + + + + + + + + 员工管理 + + + + + + + + + + 会员管理 + + + + + + + + + + 商品类目管理 + + + + + + + + + 商品管理 + + + + + + + + + + 会员二维码 + + + + + + + + + + 员工二维码 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/mineshopdetail.wxss b/pages/mine/shop/mineshopdetail.wxss new file mode 100644 index 0000000..7ed23b4 --- /dev/null +++ b/pages/mine/shop/mineshopdetail.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/mineshopdetail.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/shopauthentication.js b/pages/mine/shop/shopauthentication.js new file mode 100644 index 0000000..d8c1b0c --- /dev/null +++ b/pages/mine/shop/shopauthentication.js @@ -0,0 +1,315 @@ +// pages/mine/shop/shopauthentication.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopLicensePhotos: [], //店铺营业执照图片 + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + }, + // certificationImage: '', //照片 + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + //选择营业执照 + ChooseLicenseP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + //删除营业执照 + DelLicenseP(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLicensePhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLicensePhotos: this.data.shopLicensePhotos + }) + let _self = this + _self.setData({ + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + }) + } + } + }) + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + //营业执照 + let tempList = _self.data.shopLicensePhotos.concat(item) + _self.getAuthInfo(tempList) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + getAuthInfo(templist) { + let _self = this + app.http.get(app.urls.getAuthenticationInfo.format({ + id: templist[0].id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + shopLicensePhotos: templist, + }) + _self.setDataToView(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + textAreaInput(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + setDataToView(data) { + let _self = this + _self.setData({ + certificationName: data.licenseName == '无' ? '' : data.licenseName, //企业名称 + certificationType: data.licenseType == '无' ? '' : data.licenseType, //企业类型 + certificationNumber: data.licenseNumber == '无' ? '' : data.licenseNumber, //证书编号 + certificationId: data.licenseId == '无' ? '' : data.licenseId, //统一信用代码 + certificationComposition: data.licenseComposition == '无' ? '' : data.licenseComposition, //企业组成形式 + certificationLegalPerson: data.licenseLegalPerson == '无' ? '' : data.licenseLegalPerson, //法定代表人 + certificationBusiness: data.licenseBusiness == '无' ? '' : data.licenseBusiness, //企业营业范围 + certificationCapital: data.licenseCapital == '无' ? '' : data.licenseCapital, //企业注册资本 + certificationFoundTime: data.licenseFoundTime == '无' ? '' : data.licenseFoundTime, //企业注册时间 + certificationLicenseTerm: data.licenseTerm == '无' ? '' : data.licenseTerm, //营业期限 + certificationAddress: data.licenseResidence == '无' ? '' : data.licenseResidence, //企业地址 + certificationAuthority: data.licenseAuthority == '无' ? '' : data.licenseAuthority, //登记机关 + }) + }, + //进行认证 + authShop() { + let _self = this + if (_self.checkParams()) { + wx.showLoading({ + title: '认证中...', + }) + app.http.post(app.urls.doAuthentication, { + header: { + token: app.globalData.token + }, + data: { + certificationAddress: _self.data.certificationAddress, + certificationAuthority: _self.data.certificationAuthority, + certificationBusiness: _self.data.certificationBusiness, + certificationCapital: _self.data.certificationCapital, + certificationComposition: _self.data.certificationComposition, + certificationFoundTime: _self.data.certificationFoundTime, + certificationId: _self.data.certificationId, + certificationImage: _self.data.shopLicensePhotos[0].id, + certificationLegalPerson: _self.data.certificationLegalPerson, + certificationLicenseTerm: _self.data.certificationLicenseTerm, + certificationName: _self.data.certificationName, + certificationNumber: _self.data.certificationNumber, + certificationType: _self.data.certificationType, + shopId: _self.data.shopId + } + }) + .then(res => { + wx.hideLoading({}) + wx.showModal({ + title: '提示', + content: '信息审核中,(1至3个工作日完成),请耐心等待.', + success(res) { + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //校验参数 + checkParams() { + if (this.data.shopLicensePhotos.length <= 0) { + wx.showToast({ + title: '请上传营业执照相片', + icon: 'none' + }) + return false + } + // certificationName: '', //企业名称 + if (this.data.certificationName == '') { + wx.showToast({ + title: '请输入企业名称', + icon: 'none' + }) + return false + } + // certificationType: '', //企业类型 + if (this.data.certificationType == '') { + wx.showToast({ + title: '请输入企业类型', + icon: 'none' + }) + return false + } + // certificationNumber: '', //证书编号 + if (this.data.certificationNumber == '') { + wx.showToast({ + title: '请输入证书编号', + icon: 'none' + }) + return false + } + // certificationId: '', //统一信用代码 + if (this.data.certificationId == '') { + wx.showToast({ + title: '请输入统一信用代码', + icon: 'none' + }) + return false + } + // certificationComposition: '', //企业组成形式 + if (this.data.certificationComposition == '') { + wx.showToast({ + title: '请输入企业组成形式', + icon: 'none' + }) + return false + } + // certificationLegalPerson: '', //法定代表人 + if (this.data.certificationLegalPerson == '') { + wx.showToast({ + title: '请输入法定代表人', + icon: 'none' + }) + return false + } + // certificationBusiness: '', //企业营业范围 + if (this.data.certificationBusiness == '') { + wx.showToast({ + title: '请输入企业营业范围', + icon: 'none' + }) + return false + } + // certificationCapital: '', //企业注册资本 + if (this.data.certificationCapital == '') { + wx.showToast({ + title: '请输入企业注册资本', + icon: 'none' + }) + return false + } + // certificationFoundTime: '', //企业注册时间 + if (this.data.certificationFoundTime == '') { + wx.showToast({ + title: '请输入企业注册时间', + icon: 'none' + }) + return false + } + // certificationLicenseTerm: '', //营业期限 + if (this.data.certificationLicenseTerm == '') { + wx.showToast({ + title: '请输入营业期限', + icon: 'none' + }) + return false + } + // certificationAddress: '', //企业地址 + if (this.data.certificationAddress == '') { + wx.showToast({ + title: '请输入企业地址', + icon: 'none' + }) + return false + } + // certificationAuthority: '', //登记机关 + if (this.data.certificationAuthority == '') { + wx.showToast({ + title: '请输入登记机关', + icon: 'none' + }) + return false + } + return true + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/shopauthentication.json b/pages/mine/shop/shopauthentication.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/shopauthentication.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/shopauthentication.wxml b/pages/mine/shop/shopauthentication.wxml new file mode 100644 index 0000000..14def23 --- /dev/null +++ b/pages/mine/shop/shopauthentication.wxml @@ -0,0 +1,131 @@ + + + 店铺认证 + + + + + 店铺营业执照 + + + {{shopLicensePhotos.length}}/1 + + + + + + + + + + + + + + + + + + + + + 名称 + + + + + + + 类型 + + + + + + 证书编号 + + + + + + 统一信用代码 + + + + + + 企业组成形式 + + + + + + 法定代表人 + + + + + + 经营范围 + + + + + + + + + + 注册资本 + + + + + + 成立日期 + + + + + + 营业期限 + + + + + + 企业地址 + + + + + + + + + + 登记机关 + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/shopauthentication.wxss b/pages/mine/shop/shopauthentication.wxss new file mode 100644 index 0000000..56298a2 --- /dev/null +++ b/pages/mine/shop/shopauthentication.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/shopauthentication.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationdetail.js b/pages/mine/shop/shopauthenticationdetail.js new file mode 100644 index 0000000..8225b69 --- /dev/null +++ b/pages/mine/shop/shopauthenticationdetail.js @@ -0,0 +1,88 @@ +// pages/mine/shop/shopauthenticationdetail.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopCertificationId: '', + shopLicensePhotos: [], //店铺营业执照图片 + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + shopCertificationId: options.certificationId + }) + this.getAuthenticationInfo() + }, + getAuthenticationInfo() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopAuthenticationInfo.format({ + shopCertificationId: _self.data.shopCertificationId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setDataToView(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + setDataToView(data) { + let _self = this + if (data.certificationImage != '') { + let ids = data.certificationImage + _self.data.shopLicensePhotos.push({ + id: ids, + path: app.baseUrls.tradeUrl + app.baseImgUrl + ids + }) + } + _self.setData({ + certificationName: data.certificationName, //企业名称 + certificationType: data.certificationType, //企业类型 + certificationNumber: data.certificationNumber, //证书编号 + certificationId: data.certificationId, //统一信用代码 + certificationComposition: data.certificationComposition, //企业组成形式 + certificationLegalPerson: data.certificationLegalPerson, //法定代表人 + certificationBusiness: data.certificationBusiness, //企业营业范围 + certificationCapital: data.certificationCapital, //企业注册资本 + certificationFoundTime: data.certificationFoundTime, //企业注册时间 + certificationLicenseTerm: data.certificationLicenseTerm, //营业期限 + certificationAddress: data.certificationAddress, //企业地址 + certificationAuthority: data.certificationAuthority, //登记机关 + shopLicensePhotos: _self.data.shopLicensePhotos + }) + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + } +}) \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationdetail.json b/pages/mine/shop/shopauthenticationdetail.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/shopauthenticationdetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationdetail.wxml b/pages/mine/shop/shopauthenticationdetail.wxml new file mode 100644 index 0000000..b854f85 --- /dev/null +++ b/pages/mine/shop/shopauthenticationdetail.wxml @@ -0,0 +1,106 @@ + + + 店铺认证详情 + + + + + 店铺营业执照 + + + + + + + + + + + + + + 名称 + + {{certificationName}} + + + + 类型 + + {{certificationType}} + + + + 证书编号 + + {{certificationNumber}} + + + + 统一信用代码 + + {{certificationId}} + + + + 企业组成形式 + + {{certificationComposition}} + + + + 法定代表人 + + {{certificationLegalPerson}} + + + + 经营范围 + + + + + + {{certificationBusiness}} + + + + + 注册资本 + + {{certificationCapital}} + + + + 成立日期 + + {{certificationFoundTime}} + + + + 营业期限 + + {{certificationLicenseTerm}} + + + + 企业地址 + + + + + + {{certificationAddress}} + + + + + 登记机关 + + {{certificationAuthority}} + + + + + \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationdetail.wxss b/pages/mine/shop/shopauthenticationdetail.wxss new file mode 100644 index 0000000..e3340e5 --- /dev/null +++ b/pages/mine/shop/shopauthenticationdetail.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/shopauthenticationdetail.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationedit.js b/pages/mine/shop/shopauthenticationedit.js new file mode 100644 index 0000000..6119d10 --- /dev/null +++ b/pages/mine/shop/shopauthenticationedit.js @@ -0,0 +1,365 @@ +// pages/mine/shop/shopauthentication.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopCertificationId: '', + shopLicensePhotos: [], //店铺营业执照图片 + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + auditResult: '', //不通过原因 + auditStatus: 0, //状态 + }, + // certificationImage: '', //照片 + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + shopCertificationId: options.certificationId + }) + this.getAuthenticationInfo() + }, + getAuthenticationInfo() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopAuthenticationInfo.format({ + shopCertificationId: _self.data.shopCertificationId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setDataToView(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + //选择营业执照 + ChooseLicenseP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + //删除营业执照 + DelLicenseP(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLicensePhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLicensePhotos: this.data.shopLicensePhotos + }) + let _self = this + _self.setData({ + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + }) + } + } + }) + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + let pathStr = app.urls.baseImgUrl + JSON.parse(res).data + let item = { + id: JSON.parse(res).data, + path: pathStr + } + //营业执照 + let tempList = _self.data.shopLicensePhotos.concat(item) + _self.getAuthInfo(tempList) + }) + .catch(err => { + wx.hideLoading({}) + if (data.msg) { + app.dialog.msg(data.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + getAuthInfo(templist) { + let _self = this + app.restAjax.get(app.restAjax.path(app.apis.getAuthenticationInfo, [app.baseUrls.tradeUrl, templist[0].id]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + if (code == 200) { + _self.setData({ + shopLicensePhotos: templist, + }) + _self.setDataToView(data) + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + textAreaInput(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + setDataToView(data) { + let _self = this + if (data.certificationImage != '') { + let ids = data.certificationImage + _self.data.shopLicensePhotos.push({ + id: ids, + path: app.baseUrls.tradeUrl + app.baseImgUrl + ids + }) + } + _self.setData({ + certificationName: data.certificationName, //企业名称 + certificationType: data.certificationType, //企业类型 + certificationNumber: data.certificationNumber, //证书编号 + certificationId: data.certificationId, //统一信用代码 + certificationComposition: data.certificationComposition, //企业组成形式 + certificationLegalPerson: data.certificationLegalPerson, //法定代表人 + certificationBusiness: data.certificationBusiness, //企业营业范围 + certificationCapital: data.certificationCapital, //企业注册资本 + certificationFoundTime: data.certificationFoundTime, //企业注册时间 + certificationLicenseTerm: data.certificationLicenseTerm, //营业期限 + certificationAddress: data.certificationAddress, //企业地址 + certificationAuthority: data.certificationAuthority, //登记机关 + shopLicensePhotos: _self.data.shopLicensePhotos, + auditResult: data.auditResult, + auditStatus: data.auditStatus + }) + }, + //进行认证 + authShop() { + let _self = this + if (_self.checkParams()) { + wx.showLoading({ + title: '认证中...', + }) + app.http.get(app.urls.doUpdateAuthenticationInfo.format({ + shopCertificationId: _self.data.shopCertificationId + }), { + header: { + token: app.globalData.token + }, + data: { + certificationAddress: _self.data.certificationAddress, + certificationAuthority: _self.data.certificationAuthority, + certificationBusiness: _self.data.certificationBusiness, + certificationCapital: _self.data.certificationCapital, + certificationComposition: _self.data.certificationComposition, + certificationFoundTime: _self.data.certificationFoundTime, + certificationId: _self.data.certificationId, + certificationImage: _self.data.shopLicensePhotos[0].id, + certificationLegalPerson: _self.data.certificationLegalPerson, + certificationLicenseTerm: _self.data.certificationLicenseTerm, + certificationName: _self.data.certificationName, + certificationNumber: _self.data.certificationNumber, + certificationType: _self.data.certificationType, + shopId: _self.data.shopId + } + }) + .then(res => { + wx.hideLoading({}) + wx.showModal({ + title: '提示', + content: '信息审核中,(1至3个工作日完成),请耐心等待.', + success(res) { + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //校验参数 + checkParams() { + if (this.data.shopLicensePhotos.length <= 0) { + wx.showToast({ + title: '请上传营业执照相片', + icon: 'none' + }) + return false + } + // certificationName: '', //企业名称 + if (this.data.certificationName == '') { + wx.showToast({ + title: '请输入企业名称', + icon: 'none' + }) + return false + } + // certificationType: '', //企业类型 + if (this.data.certificationType == '') { + wx.showToast({ + title: '请输入企业类型', + icon: 'none' + }) + return false + } + // certificationNumber: '', //证书编号 + if (this.data.certificationNumber == '') { + wx.showToast({ + title: '请输入证书编号', + icon: 'none' + }) + return false + } + // certificationId: '', //统一信用代码 + if (this.data.certificationId == '') { + wx.showToast({ + title: '请输入统一信用代码', + icon: 'none' + }) + return false + } + // certificationComposition: '', //企业组成形式 + if (this.data.certificationComposition == '') { + wx.showToast({ + title: '请输入企业组成形式', + icon: 'none' + }) + return false + } + // certificationLegalPerson: '', //法定代表人 + if (this.data.certificationLegalPerson == '') { + wx.showToast({ + title: '请输入法定代表人', + icon: 'none' + }) + return false + } + // certificationBusiness: '', //企业营业范围 + if (this.data.certificationBusiness == '') { + wx.showToast({ + title: '请输入企业营业范围', + icon: 'none' + }) + return false + } + // certificationCapital: '', //企业注册资本 + if (this.data.certificationCapital == '') { + wx.showToast({ + title: '请输入企业注册资本', + icon: 'none' + }) + return false + } + // certificationFoundTime: '', //企业注册时间 + if (this.data.certificationFoundTime == '') { + wx.showToast({ + title: '请输入企业注册时间', + icon: 'none' + }) + return false + } + // certificationLicenseTerm: '', //营业期限 + if (this.data.certificationLicenseTerm == '') { + wx.showToast({ + title: '请输入营业期限', + icon: 'none' + }) + return false + } + // certificationAddress: '', //企业地址 + if (this.data.certificationAddress == '') { + wx.showToast({ + title: '请输入企业地址', + icon: 'none' + }) + return false + } + // certificationAuthority: '', //登记机关 + if (this.data.certificationAuthority == '') { + wx.showToast({ + title: '请输入登记机关', + icon: 'none' + }) + return false + } + return true + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationedit.json b/pages/mine/shop/shopauthenticationedit.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/shopauthenticationedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationedit.wxml b/pages/mine/shop/shopauthenticationedit.wxml new file mode 100644 index 0000000..66a887b --- /dev/null +++ b/pages/mine/shop/shopauthenticationedit.wxml @@ -0,0 +1,148 @@ + + + 认证信息修改 + + + + + + + + + + 未通过原因: + + + {{auditResult}} + + + + + + + + 店铺营业执照 + + + {{shopLicensePhotos.length}}/1 + + + + + + + + + + + + + + + + + + + + + 名称 + + + + + + + 类型 + + + + + + 证书编号 + + + + + + 统一信用代码 + + + + + + 企业组成形式 + + + + + + 法定代表人 + + + + + + 经营范围 + + + + + + + + + + 注册资本 + + + + + + 成立日期 + + + + + + 营业期限 + + + + + + 企业地址 + + + + + + + + + + 登记机关 + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationedit.wxss b/pages/mine/shop/shopauthenticationedit.wxss new file mode 100644 index 0000000..335448b --- /dev/null +++ b/pages/mine/shop/shopauthenticationedit.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/shopauthenticationedit.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/shopedit.js b/pages/mine/shop/shopedit.js new file mode 100644 index 0000000..b0712bd --- /dev/null +++ b/pages/mine/shop/shopedit.js @@ -0,0 +1,445 @@ +// pages/mine/shop/shopedit.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopBean: null, + StatusBar: app.globalData.StatusBar, + CustomBar: app.globalData.CustomBar, + startDate: "", + endDate: "", + shopName: "", //商店名称 + shopAddress: "", //商店地址 + index: null, + date: '2018-12-25', //营业时间 + shopLicensePhotos: [], //商店营业执照 + shopLogoPhotos: [], //商店Logo + shopVideos: [], + textareaBValue: '', //店铺简介, + isBusiness: true, //是否开业 + selTradeList: [], //行业类型 + selTemplateId: '1', + selTradeNames: '请选择行业' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getShopDetail() + }, + //获取商店详情 + getShopDetail() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopDetail.format({ + shopId: _self.data.shopId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + shopBean: res.data + }) + _self.setDataToView() + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //回写数据 + setDataToView() { + let _self = this + + if (_self.data.shopBean.shopLogo != '') { + let ids = _self.data.shopBean.shopLogo + _self.data.shopLogoPhotos.push({ + id: ids, + path: app.baseUrls.tradeUrl + app.baseImgUrl + ids + }) + + } + + if (_self.data.shopBean.shopVideo != '') { + let ids = _self.data.shopBean.shopVideo + let idsList = ids.split(',') + idsList.forEach(el => { + if (el != '') { + _self.data.shopVideos.push({ + id: el, + videoUrl: app.baseUrls.tradeUrl + app.baseImgUrl + el, + path: '/images/ic_video_default.png', + }) + } + }) + } + var ids = _self.data.shopBean.industryId + var idsList = ids.split(',') + var names = _self.data.shopBean.industryName + var nameList = names.split(',') + for (var i = 0; i < idsList.length; i++) { + if (idsList[i] != '') { + var item = { + id: idsList[i], + name: nameList[i] + } + _self.data.selTradeList.push(item) + } + } + //行业IDs + this.setData({ + shopName: _self.data.shopBean.shopName, + shopAddress: _self.data.shopBean.shopAddress, + textareaBValue: _self.data.shopBean.shopSummary, + isBusiness: _self.data.shopBean.isOpen == 0 ? false : true, + date: _self.data.shopBean.openDate, + selTemplateId: _self.data.shopBean.shopTemplateId, + shopLogoPhotos: _self.data.shopLogoPhotos, + shopVideos: _self.data.shopVideos, + selTradeNames: _self.data.shopBean.industryName, + selTradeList: _self.data.selTradeList + }) + }, + //更新 + doUpdateShop() { + if (this.checkParams()) { + wx.showLoading({ + title: '修改中...', + }) + // doUpdateShopInfo + let _self = this + let industryIds = '' + _self.data.selTradeList.forEach(el => { + industryIds += el.id + ',' + }) + app.http.put(app.urls.doUpdateShopInfo.format({ + shopId: _self.data.shopId + }), { + header: { + token: app.globalData.token + }, + data: { + shopName: _self.data.shopName, + shopAddress: _self.data.shopAddress, + shopSummary: _self.data.textareaBValue, + openDate: _self.data.date, + shopLogo: _self.data.shopLogoPhotos[0].id, + industryIds: industryIds, + shopTemplateId: _self.data.selTemplateId, + isOpen: _self.data.isBusiness ? '1' : '0', + shopVideo: _self.data.shopVideos.length > 0 ? _self.data.shopVideos[0].id : '' + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '修改成功', + icon: 'success', + success(res) { + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + PickerChange(e) { + this.setData({ + index: e.detail.value + }) + }, + //选择模板样式 + choosetemplate(e) { + this.setData({ + selTemplateId: e.detail.value + }) + }, + DateChange(e) { + this.setData({ + date: e.detail.value + }) + }, + + checkIsBusiness(e) { + this.setData({ + isBusiness: e.detail.value + }) + }, + //选择营业执照 + ChooseLicenseP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + //选择logo + ChooseLogoP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + //删除Logo + DelLogoP(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLogoPhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLogoPhotos: this.data.shopLogoPhotos + }) + } + } + }) + }, + //删除营业执照 + DelLicenseP(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLicensePhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLicensePhotos: this.data.shopLicensePhotos + }) + } + } + }) + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + let _self = this + app.http.uplaod(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + if (type == 2) { + //Logo + let tempList = _self.data.shopLogoPhotos.concat(item) + _self.setData({ + shopLogoPhotos: tempList + }) + } else { + //营业执照 + let tempList = _self.data.shopLicensePhotos.concat(item) + _self.setData({ + shopLicensePhotos: tempList + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + ViewLogoImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.shopVideos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + shopVideos: _self.data.shopVideos + }) + } + } + }) + }, + textareaBInput(e) { + this.setData({ + textareaBValue: e.detail.value + }) + }, + checkParams() { + var _self = this + if (_self.data.shopName == '') { + wx.showToast({ + title: '商店名称为必填项', + icon: 'none' + }) + return false + } + if (_self.data.shopAddress == '') { + wx.showToast({ + title: '店铺地址为必填项', + icon: 'none' + }) + return false + } + if (_self.data.selTradeList.length <= 0) { + wx.showToast({ + title: '请选择行业', + icon: 'none' + }) + return false + } + if (_self.data.date == '') { + wx.showToast({ + title: '请选择开业时间', + icon: 'none' + }) + return false + } + if (_self.data.shopLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传店铺Logo', + icon: 'none' + }) + return false + } + + return true + }, + showModal(e) { + this.setData({ + modalName: e.currentTarget.dataset.target + }) + }, + hideModal(e) { + this.setData({ + modalName: null + }) + }, + showChooseTrade() { + wx.navigateTo({ + url: './choosetrade', + }) + }, + onShow() { + let _self = this + if (_self.data.selTradeList.length > 0) { + var names = '' + _self.data.selTradeList.forEach(el => { + names += el.name + ',' + }) + _self.setData({ + selTradeNames: names + }) + } + }, + //选择视屏 + chooseVideo() { + let _self = this + wx.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], //从相册选择 + maxDuration: 30, + success: (res) => { + _self.doUploadVideo(res) + } + }); + }, + doUploadVideo(e) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadVideo, { + name: 'video', + path: e.tempFiles[0].tempFilePath, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + let pathStr = e.tempFiles[0].thumbTempFilePath + var id = JSON.parse(res).data + let videoU = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr, + videoUrl: videoU + } + let tempList = _self.data.shopVideos.concat(item) + _self.setData({ + shopVideos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/shopedit.json b/pages/mine/shop/shopedit.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/shopedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/shopedit.wxml b/pages/mine/shop/shopedit.wxml new file mode 100644 index 0000000..b5d120c --- /dev/null +++ b/pages/mine/shop/shopedit.wxml @@ -0,0 +1,165 @@ + + 店铺信息修改 + + +
+ + + + 店铺名称 + + + + + + + 店铺地址 + + + + + + + 行    业 + + + {{selTradeNames}} + + + + + + + 开业日期 + + + + {{date}} + + + + + + + 是否开业 + + + + + + + + + 店铺Logo + + + {{shopLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + 宣传视频 + + + {{shopVideos.length}}/1 + + + + + + + + + + + + + + + + + + + 店铺简介 + + + + + + + + + + + 展示样式 + + + + + + + 样式一 + + + + 样式二 + + + + 样式三 + + + + 样式四 + + + + + + +
+
+ + + \ No newline at end of file diff --git a/pages/mine/shop/shopedit.wxss b/pages/mine/shop/shopedit.wxss new file mode 100644 index 0000000..b466c0e --- /dev/null +++ b/pages/mine/shop/shopedit.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/shopedit.wxss */ \ No newline at end of file