From 1113721c0e068c57adbc15149cce15563960a7f2 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期三, 18 六月 2025 23:03:25 +0800 Subject: [PATCH] Merge branch 'dev' of http://42.193.1.25:9521/r/lmk-shop-wx into dev --- pages/goods-manager/updateSkus/updateSkus.vue | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 114 insertions(+), 0 deletions(-) diff --git a/pages/goods-manager/updateSkus/updateSkus.vue b/pages/goods-manager/updateSkus/updateSkus.vue new file mode 100644 index 0000000..f781929 --- /dev/null +++ b/pages/goods-manager/updateSkus/updateSkus.vue @@ -0,0 +1,114 @@ +<template> + <view> + <view class="container"> + <view class="item" v-for="item in skuList" :key="item.id"> + <text class="label">{{ item.simpleSpecs }}</text> + <input class="input" placeholder="璇疯緭鍏ュ簱瀛樻暟閲�" value="{{item.quantity}}" @input="onInput" + data-id="{{item.id}}" /> + </view> + </view> + <button type="default" class="btn" @click="updateSkus()"> + <u-icon name="plus-circle"></u-icon> + 鏇存柊 + </button> + </view> +</template> +<script> + +import * as API_GOODS from "@/api/goods.js"; +export default { + data() { + return { + routerVal: {}, + skuParams: [], + skuList: [] + } + }, + onShow() { + var goodsId = this.routerVal.goodsId + let params = { + goodsId: goodsId, + pageSize: 100 + }; + API_GOODS.getGoodsSkuData(params).then((res) => { + this.skuList = res.data.result.records + res.data.result.records.forEach(item => { + this.skuParams.push({ skuId: item.id, quantity: item.quantity }) + }); + }) + }, + onLoad(option) { + uni.showLoading({ + title: "鍔犺浇涓�", + }); + this.routerVal = option; + + uni.hideLoading(); + }, + methods: { + onInput(e) { + var id = e.currentTarget.dataset.id + for (let index = 0; index < this.skuParams.length; index++) { + if (this.skuParams[index].skuId == id) + this.skuParams[index].quantity = e.detail.value + } + }, + updateSkus() { + API_GOODS.updateStocks(this.skuParams).then((res) => { + if (res.data.code == 200) { + uni.showToast({ + title: "鏇存柊鎴愬姛", + icon: "success", + duration: 2000, + }); + setTimeout(() => { + uni.navigateBack({ + delta: 1, + }); + }) + } + }) + } + } +} +</script> +<style lang="scss" scoped> +/* WXSS 鏂囦欢 */ +.container { + padding: 20px; +} + +.item { + display: flex; + align-items: center; + margin-bottom: 20px; +} + +.label { + width: 80px; + text-align: right; + margin-right: 15px; +} + +.input { + flex: 1; + border: 1px solid #ddd; + padding: 10px; + border-radius: 4px; +} + +.btn { + background: $light-color; + position: fixed; + width: 690rpx; + bottom: 60rpx; + height: 80rpx; + left: 30rpx; + font-size: 30rpx; + line-height: 80rpx; + + .u-icon { + margin-right: 10rpx; + } +} +</style> \ No newline at end of file -- Gitblit v1.8.0