123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <template>
- <view class="content flex flex_column">
- <view class="uni-icon-error tits">以下产品需设置结算价(即修理厂的进货价),否则无法上架入库</view>
- <view class="proudct-body">
- <view class="partList-list-box" v-for="(item,index) in partList" :key="item.id">
- <view class="product flex align_center">
- <view class="flex align_center justify_between">
- <view class="pimgs">
- <u-image :src="item.product.images?item.product.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
- </view>
- <view class="pinfo">
- <view class="pname">
- <text>{{item.shelfPlaceCode}}</text>
- {{item.productCode}}
- </view>
- <view class="pname pname1">
- {{item.product.productName}}
- </view>
- </view>
- </view>
- </view>
- <view class="pcurnums flex align_center justify_end">
- <text>结算价</text>
- <view class="u-ninput">
- <u-input trim border type="digit" clearable @blur="numberToFixed(item,2,999999)" v-model="item.cost" placeholder="请输入价格,最多两位小数"/>
- </view>
- </view>
- </view>
- </view>
- <view class="footer-bar">
- <u-button type='primary' shape="circle" size="medium" @click="submitForm">设置完成</u-button>
- </view>
- </view>
- </template>
- <script>
- import { clzConfirm, numberToFixed } from '@/libs/tools';
- import {updateBatchById, shelfCartConfirm} from '@/api/shelfCart.js'
- export default {
- data() {
- return {
- partList:[],
- }
- },
- onLoad() {
- this.partList = this.$store.state.vuex_tempData
- this.partList.map(item => {
- item.cost = ''
- })
- },
- onUnload() {
- this.$store.state.vuex_tempData = null
- },
- methods: {
- // 小数点后两位
- numberToFixed: function (item, num, max) {
- let val = item.cost
- let ret = numberToFixed(val, num, max)
- this.$set(item,'cost',Number(ret <= 0 ? '' : ret))
- this.partList = JSON.parse(JSON.stringify(this.partList))
- },
- submitForm(){
- const hasEmpty = this.partList.filter(item => !item.cost)
- console.log(hasEmpty)
- if(hasEmpty.length){
- this.toashMsg("请输入结算价")
- }else{
- uni.showLoading({
- mask: true,
- title: '正在设置价格...'
- })
- updateBatchById(this.partList).then(res => {
- uni.hideLoading()
- if(res.status == 200){
- uni.$emit("setCostOk")
- uni.navigateBack()
- }
- })
- }
- }
- }
- }
- </script>
- <style lang="less">
- .content{
- width: 100%;
- height: 100vh;
- .tits{
- padding: 20upx 30upx;
- color: darkorange;
- font-size: 24rpx;
- }
- .proudct-body{
- flex-grow: 1;
- width: 100%;
- overflow: auto;
- background-color: #fff;
- padding: 0 20upx;
- }
- .partList-list-box{
- padding: 10px 0;
- border-bottom: 2rpx solid #f5f5f5;
- .product{
- flex-grow: 1;
- .pinfo{
- flex-grow: 1;
- padding-left: 20rpx;
- .pname{
- color: #191919;
- margin-bottom: 5rpx;
- text{
- font-weight: normal;
- margin-right: 10rpx;
- padding: 0 10rpx;
- background: rgba(3, 54, 146, 0.15);
- border-radius: 30rpx;
- color: #033692;
- font-size: 24rpx;
- }
- }
- }
- }
- .pcurnums{
- color: #999;
- .u-ninput{
- width: 60%;
- padding: 0 10rpx;
- }
- }
- }
- .footer-bar{
- padding: 20upx;
- button{
- width: 80%;
- }
- text-align: center;
- }
- }
- </style>
|