|
|
@@ -11,6 +11,9 @@
|
|
|
font-size: 28rpx;
|
|
|
font-weight: 700;
|
|
|
}
|
|
|
+ .flex-space{
|
|
|
+ width:500rpx;
|
|
|
+ }
|
|
|
.flowers-list{
|
|
|
padding: 15rpx 0;
|
|
|
.flowers-name{width: 150rpx}
|
|
|
@@ -37,29 +40,31 @@
|
|
|
width: 80%;
|
|
|
height: 80rpx;
|
|
|
color: #FFFFFF;
|
|
|
- margin-top: 150rpx;
|
|
|
- background: #6699ff;
|
|
|
+ margin-top: 50rpx;
|
|
|
+ background: #3385FF;
|
|
|
border-radius: 10rpx;
|
|
|
+ font-size:30rpx;
|
|
|
}
|
|
|
</style>
|
|
|
<template>
|
|
|
<appResult :title="title?title:'成功'">
|
|
|
- <view class="flowers-list-box">
|
|
|
- <view class="flex title">以下花材售价已变更,如需要请修改:</view>
|
|
|
- <view class="flex-space flowers-list" v-for="(res,i) in flowersList" :key="i">
|
|
|
- <view class="ov-1x flowers-name">{{res.name}}</view>
|
|
|
- <view class="flex flowers-val">
|
|
|
- <input type="digit" v-model="res.price" @focus="priceFocus(i)"> 元
|
|
|
- </view>
|
|
|
- <view class="flex-center flowers-btn" @tap="changePriceFun(res.id,res.price)">修改</view>
|
|
|
- </view>
|
|
|
+ <view class="flowers-list-box">
|
|
|
+ <view class="flex title">采购已入库,建议修改售价:</view>
|
|
|
+ <view class="flex-space flowers-list" v-for="(res,i) in flowersList" :key="i">
|
|
|
+ <view class="ov-1x flowers-name">{{res.name}}</view>
|
|
|
+ <view class="flex flowers-val">
|
|
|
+ <input type="digit" v-model="res.autoPrice" @focus="priceFocus(i)" @input="updatePrice(res.id,res.autoPrice)"> 元
|
|
|
</view>
|
|
|
- <navigator open-type="switchTab" class="flex-center goHome" url="/admin/home/workbench">返回首页</navigator>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <button class="admin-button-com big blue" style="width:80%;margin-top:50rpx;" @click="commitChange">保存修改</button>
|
|
|
+
|
|
|
+ <navigator open-type="switchTab" class="flex-center goHome" @click="goBackHome" >返回首页</navigator>
|
|
|
</appResult>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import { getAllProductDataApi } from "@/api/product/index";
|
|
|
- import { changePriceByIdApi } from '@/api/product/index'
|
|
|
+import { getAllProductDataApi } from "@/api/product/index";
|
|
|
+import { batchUpdatePrice } from '@/api/product/index'
|
|
|
import appResult from "@/components/app-result";
|
|
|
export default {
|
|
|
name: "pageSuccess",
|
|
|
@@ -71,6 +76,7 @@ export default {
|
|
|
title:'',
|
|
|
flowersItemInfo:'',
|
|
|
flowersList:[],
|
|
|
+ productList:[],
|
|
|
};
|
|
|
},
|
|
|
onShow(){
|
|
|
@@ -84,37 +90,56 @@ export default {
|
|
|
uni.removeStorageSync('flowersItemInfo');
|
|
|
uni.navigateBack({delta:2})
|
|
|
},
|
|
|
- methods: {
|
|
|
- priceFocus(i){
|
|
|
- this.flowersList[i].price = ''
|
|
|
- },
|
|
|
- closeLayer() {
|
|
|
- uni.navigateBack({delta: 3});
|
|
|
- },
|
|
|
- getList(){
|
|
|
- let productIdArr = '';
|
|
|
- this.flowersItemInfo.forEach((ele)=>{
|
|
|
- productIdArr += ele.productId+','
|
|
|
+ methods: {
|
|
|
+ priceFocus(i){
|
|
|
+ this.flowersList[i].autoPrice = ''
|
|
|
+ },
|
|
|
+ closeLayer() {
|
|
|
+ uni.navigateBack({delta: 3});
|
|
|
+ },
|
|
|
+ getList(){
|
|
|
+ let productIdArr = '';
|
|
|
+ let that = this
|
|
|
+ this.flowersItemInfo.forEach((ele)=>{productIdArr += ele.productId+','})
|
|
|
+ getAllProductDataApi({ids : productIdArr.substring(0, productIdArr.lastIndexOf(',')),}).then((res)=>{
|
|
|
+ that.flowersList = res.data.list;
|
|
|
+
|
|
|
+ that.productList = [];
|
|
|
+ console.log('that.productList',that.productList)
|
|
|
+ that.flowersList.forEach(function(item,index,arr){
|
|
|
+ that.productList.push({id:item.id,price:item.price})
|
|
|
})
|
|
|
- getAllProductDataApi({ids : productIdArr.substring(0, productIdArr.lastIndexOf(',')),}).then((res)=>{
|
|
|
- console.log(res)
|
|
|
- this.flowersList = res.data.list;
|
|
|
- });
|
|
|
- },
|
|
|
- changePriceFun(id,price){
|
|
|
- if(price) {
|
|
|
- changePriceByIdApi({
|
|
|
- productId: id,
|
|
|
- price: price
|
|
|
- }).then(res => {
|
|
|
- uni.showToast({title:'修改成功'})
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$msg('金额不能为空')
|
|
|
+ console.log('that.productList',that.productList)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ updatePrice(id,price){
|
|
|
+ let arr = this.productList.map((ele)=>{
|
|
|
+ if(ele.id == id){
|
|
|
+ return {id:id,price:price}
|
|
|
}
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
+ return ele
|
|
|
+ })
|
|
|
+ this.productList = arr
|
|
|
+ console.log(this.productList)
|
|
|
+ },
|
|
|
+ commitChange(){
|
|
|
+ let that = this
|
|
|
+ batchUpdatePrice({data:JSON.stringify(this.productList),type:'price'}).then(res => {
|
|
|
+ uni.showToast({title:res.msg})
|
|
|
+ if(res.code == 1){
|
|
|
+ setTimeout(function(){
|
|
|
+ that.goBackHome()
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ goBackHome() {
|
|
|
+ this.$util.pageTo({
|
|
|
+ url: "/admin/home/workbench",
|
|
|
+ type: 4,
|
|
|
+ query: { tabIndex: 0 },
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|