From 9e017fd508b7c65b134c6992a2978a3c3d021fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E6=96=8C?= <1134087124@qq.com> Date: Fri, 18 Aug 2023 15:25:08 +0800 Subject: [PATCH] wanshan --- .hbuilderx/launch.json | 17 ++++---- http/interface.js | 10 +++-- main.js | 2 +- manifest.json | 34 +++++++++++++++- pages.json | 2 +- pages/goodDetail/goodDetail.vue | 69 ++++++++++++++++++--------------- pages/login/login.vue | 12 ++++++ pages/management/management.vue | 46 ++++++++++++++++++++-- 8 files changed, 143 insertions(+), 49 deletions(-) diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 0b0655a..520ede6 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -5,12 +5,15 @@ "playground" : "custom", "type" : "uni-app:app-android" }, - { - "app-plus" : - { - "launchtype" : "local" - }, - "type" : "uniCloud" - } + { + "app-plus" : { + "launchtype" : "local" + }, + "type" : "uniCloud" + }, + { + "playground" : "custom", + "type" : "uni-app:app-ios" + } ] } diff --git a/http/interface.js b/http/interface.js index 52b179d..066b8c1 100644 --- a/http/interface.js +++ b/http/interface.js @@ -4,7 +4,7 @@ */ export default { config: { - baseUrl: "http://172.16.100.93:8015", + baseUrl: "https://stock.szjixun.cn", header: { "Content-Type": "application/json;charset=UTF-8", // 'Content-Type':'application/x-www-form-urlencoded' @@ -50,11 +50,13 @@ export default { response = newResponse; } } + console.log(response); if (response.data.status === 401) { - uni.removeStorageSync("oa-token"); - uni.removeStorageSync("oa-user-info"); + uni.$u.toast('登录过期,请重新登录'); + uni.removeStorageSync("token"); + uni.removeStorageSync("userInfo"); uni.redirectTo({ - url: "/pages/login/index", + url: "/pages/login/login", }); } // 统一的响应日志记录 diff --git a/main.js b/main.js index 270f9dd..2f8b004 100644 --- a/main.js +++ b/main.js @@ -7,7 +7,7 @@ import api from '@/http/' Vue.use(uView) Vue.prototype.$common = common; Vue.prototype.$api = api; -Vue.prototype.$baseUrl = "http://172.16.100.93:8015"; // "http://114.218.158.24:9022", "http://58.210.42.242:9085" +Vue.prototype.$baseUrl = "https://stock.szjixun.cn"; // "http://114.218.158.24:9022", "http://58.210.42.242:9085" Vue.config.productionTip = false App.mpType = 'app' diff --git a/manifest.json b/manifest.json index 97098d0..763bac7 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "inv-app", + "name" : "艺邑库存", "appid" : "__UNI__6DE03A4", "description" : "", "versionName" : "1.0.0", @@ -50,6 +50,38 @@ /* SDK配置 */ "sdkConfigs" : { "ad" : {} + }, + "icons" : { + "android" : { + "hdpi" : "unpackage/res/icons/72x72.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" + }, + "ios" : { + "appstore" : "unpackage/res/icons/1024x1024.png", + "ipad" : { + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "iphone" : { + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + } + } } } }, diff --git a/pages.json b/pages.json index b82288c..9692de0 100644 --- a/pages.json +++ b/pages.json @@ -21,7 +21,7 @@ "style" : { "navigationBarTitleText": "", - "enablePullDownRefresh": false, + "enablePullDownRefresh": true, "app-plus": { "titleNView": false // 禁用原生导航 } diff --git a/pages/goodDetail/goodDetail.vue b/pages/goodDetail/goodDetail.vue index b39bae1..8f610ed 100644 --- a/pages/goodDetail/goodDetail.vue +++ b/pages/goodDetail/goodDetail.vue @@ -158,7 +158,6 @@ label="商品名称" prop="goodsInfo.title" borderBottom - ref="title"> { + // 不可以小于0 + if (this.model.goodsInfo.changeStock <= 0) { + uni.$u.toast("增加数量不可以小于0"); + return; + } let data = { ID: this.model.goodsInfo.ID, changeStock: parseInt(this.model.goodsInfo.changeStock), - } + }; let res = await this.$api.management.addNum(data); if (res.status == 0) { uni.$u.toast("增加成功"); @@ -430,6 +434,35 @@ page { font-size: 30rpx; border: 0; } + /deep/ .u-form { + margin-top: 20rpx; + background-color: #fff; + border-radius: 20rpx; + padding: 20rpx 40rpx; + } + /deep/ .u-input { + background-color: #dcdee8; + height: 24rpx; + } + /deep/ .u-form-item__body__left__content { + border-right: 1px solid #ebebeb; + padding-right: 40rpx; + } + /deep/ .u-form-item__body__right { + padding-left: 30rpx; + } + /deep/ .u-form-item__body__left__content__required { + color: #1936c9; + } + /deep/ .u-modal__title { + color: #1936c9; + } + /deep/ .u-modal__content { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + } } .barcode-box { display: flex; @@ -470,26 +503,7 @@ page { border-radius: 30rpx; } } -/deep/ .u-form { - margin-top: 20rpx; - background-color: #fff; - border-radius: 20rpx; - padding: 20rpx 40rpx; -} -/deep/ .u-input { - background-color: #dcdee8; - height: 24rpx; -} -/deep/ .u-form-item__body__left__content { - border-right: 1px solid #ebebeb; - padding-right: 40rpx; -} -/deep/ .u-form-item__body__right { - padding-left: 30rpx; -} -/deep/ .u-form-item__body__left__content__required { - color: #1936c9; -} + .bottom-btn-box { display: flex; justify-content: space-between; @@ -503,13 +517,4 @@ page { border: none; } } -/deep/ .u-modal__title { - color: #1936c9; -} -/deep/ .u-modal__content { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; -} diff --git a/pages/login/login.vue b/pages/login/login.vue index 5cbcb05..58a3a8f 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -77,6 +77,18 @@ export default { ); }, }, + onShow() { + // 如果已经登录,跳转到首页 + if (uni.getStorageSync("token")) { + uni.redirectTo({ + url: "/pages/management/management", + }); + } else { + uni.redirectTo({ + url: "/pages/login/login", + }); + } + }, methods: { phoneVail(value) { if (value) { diff --git a/pages/management/management.vue b/pages/management/management.vue index b04aa0e..da3cd24 100644 --- a/pages/management/management.vue +++ b/pages/management/management.vue @@ -31,8 +31,17 @@ 全部 - 按库存更新排序 + {{ sortByName }} + @@ -202,11 +211,21 @@ export default { changeStock: "", image: "", }, + columns: [["按库存更新排序", "入库时间倒序", "库存倒序"]], + pcikerShow: false, + sortByName: "按库存更新排序", + sortBy: "stockChangeDesc", }; }, mounted() { this.getManagementList(); }, + onPullDownRefresh() { + this.managementList = []; + this.page = 1; + this.getManagementList(); + uni.stopPullDownRefresh(); + }, methods: { handleScroll() { if (this.total > this.managementList.length) { @@ -224,12 +243,13 @@ export default { await this.$api.management .manageList({ title: this.title, + sortBy: this.sortBy, page: this.page, PageSize: this.PageSize, }) .then((res) => { this.total = res.data.count; - this.managementList = this.managementList.concat(res.data.data); + this.managementList = this.managementList.concat(res.data.data || []); }); }, // 去我的 @@ -285,6 +305,21 @@ export default { }, }); }, + showPicker() { + this.pcikerShow = true; + }, + pickerConfirm(e) { + console.log(e); + this.sortByName = e.value[0]; + this.sortBy = e.indexs[0] == 0 ? "stockChangeDesc" :e.indexs[0] == 1 ? "createdDesc" : "stockSizeDesc"; + this.pcikerShow = false; + this.managementList = []; + this.page = 1; + this.getManagementList(); + }, + pickerCancel(e) { + this.pcikerShow = false; + }, // 生成新商品 goCreateNew() { this.showCreate = false; @@ -304,9 +339,14 @@ export default { }); }, async goOutNum() { + // 不可以小于0 + if (parseInt(this.goodsInfo.changeStock) <= 0) { + uni.$u.toast("出库数量不可小于0"); + return; + } let data = { ID: this.goodsInfo.ID, - changeStock: 0-parseInt(this.goodsInfo.changeStock), + changeStock: 0 - parseInt(this.goodsInfo.changeStock), }; let res = await this.$api.management.addNum(data); if (res.status == 0) {