|
|
@@ -3,11 +3,11 @@
|
|
|
<view class="active" @click="changeProperty">{{property==1 ? '花材' : '成品'}}</view>
|
|
|
<view @click="gosettleCommit">结算 </view>
|
|
|
<view @click="gatheringFn()">收款</view>
|
|
|
- <view @click="breakage">报损</view>
|
|
|
<view @click="resetCustomer">选客</view>
|
|
|
<view @click="calcFn">{{calc == 'add' ? '+' : '-'}}</view>
|
|
|
+ <view @click="toWastage">报损</view>
|
|
|
<view @click="clearItemFn">清空</view>
|
|
|
- <view @click="logout">退出</view>
|
|
|
+ <view @click="logoutFn">退出</view>
|
|
|
|
|
|
<!-- 清空 -->
|
|
|
<uni-popup ref="clearItemRef" type="dialog">
|
|
|
@@ -18,6 +18,10 @@
|
|
|
<uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认退出?" @confirm="confirmLogout"></uni-popup-dialog>
|
|
|
</uni-popup>
|
|
|
|
|
|
+ <uni-popup ref="wastageRef" type="dialog">
|
|
|
+ <uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="提示" content="确认报损?" @confirm="confirmWastage"></uni-popup-dialog>
|
|
|
+ </uni-popup>
|
|
|
+
|
|
|
<!-- 结算弹框 -->
|
|
|
<uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
|
|
|
<settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop"></settlePop>
|
|
|
@@ -38,7 +42,9 @@
|
|
|
<script>
|
|
|
import settlePop from './settlePop.vue'
|
|
|
import toPayWay from './toPay.vue'
|
|
|
-import { createCreateOrder, wastageCreateOrder } from '@/api/home/index'
|
|
|
+import { wastageCreateOrder } from '@/api/home/index'
|
|
|
+import { createOrder} from '@/api/order'
|
|
|
+import {goodsWastage} from '@/api/wastage'
|
|
|
import productMins from "@/mixins/product"
|
|
|
import { allProduct } from '@/api/product'
|
|
|
import selectPrice from './selectPrice.vue'
|
|
|
@@ -94,7 +100,7 @@ export default {
|
|
|
},
|
|
|
confirmSelectPrice(params){
|
|
|
uni.showLoading({mask:true})
|
|
|
- createCreateOrder({orderName:params.name,lsGoodsPrice:params.price,modifyPrice:params.price}).then(res=>{
|
|
|
+ createOrder({orderName:params.name,lsGoodsPrice:params.price,modifyPrice:params.price}).then(res=>{
|
|
|
uni.hideLoading()
|
|
|
if(res.code == 1){
|
|
|
this.$refs.gatheringRef.close()
|
|
|
@@ -156,8 +162,8 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
uni.showLoading({mask:true})
|
|
|
- let product = this.selectList.map(i=>({ productId:i.id, unitType: i.unitType, num: i.currentNum, property: i.property, unitPrice: i.unitPrice }))
|
|
|
- createCreateOrder({...params,product:JSON.stringify(product)}).then(res=>{
|
|
|
+ let product = this.selectList.map(i=>({ productId:i.id, unitType: i.unitType||0, num: i.currentNum, property: i.property, unitPrice: i.unitPrice }))
|
|
|
+ createOrder({...params,product:JSON.stringify(product)}).then(res=>{
|
|
|
uni.hideLoading()
|
|
|
if(res.code == 1){
|
|
|
console.log(res.data)
|
|
|
@@ -184,28 +190,51 @@ export default {
|
|
|
this.$util.hitRemind()
|
|
|
console.log(price)
|
|
|
},
|
|
|
- breakage(){
|
|
|
+ toWastage(){
|
|
|
this.$util.hitRemind()
|
|
|
if(this.$util.isEmpty(this.selectList)) {
|
|
|
this.$msg('请选择报损花材')
|
|
|
return false
|
|
|
}
|
|
|
- this.$util.confirmModal({content:'确定报损吗?'},
|
|
|
- async() => {
|
|
|
- try {
|
|
|
- let arr = this.itemList.map(i=>({
|
|
|
- productId:i.id,
|
|
|
- unitType: i.unitType,
|
|
|
- num: i.thatNum
|
|
|
- }))
|
|
|
- wastageCreateOrder({
|
|
|
- product: JSON.stringify(arr)
|
|
|
- })
|
|
|
- this.$msg("报损成功!");
|
|
|
- }catch(err) {
|
|
|
- console.log(err)
|
|
|
- }
|
|
|
+ this.$refs.wastageRef.open('center')
|
|
|
+ },
|
|
|
+ confirmWastage(){
|
|
|
+ this.$util.hitRemind()
|
|
|
+ if(this.$util.isEmpty(this.selectList)) {
|
|
|
+ this.$msg('请选择报损花材')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let hasGoods = this.selectList.some((item) => {
|
|
|
+ return item.property == 0
|
|
|
+ })
|
|
|
+ let hasItem = this.selectList.some((item) => {
|
|
|
+ return item.property == 1
|
|
|
})
|
|
|
+ if(hasGoods == true && hasItem == true){
|
|
|
+ this.$msg('成品和花材要分别进行报损')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(hasItem == true){
|
|
|
+ let product = this.selectList.map(i=>({
|
|
|
+ productId:i.id, unitType: i.unitType||0, num: i.currentNum, property: i.property, unitPrice: i.unitPrice,
|
|
|
+ }))
|
|
|
+ wastageCreateOrder({ product: JSON.stringify(product) }).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ this.$refs.wastageRef.close()
|
|
|
+ this.$msg("报损成功!")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ let goodsList = this.selectList.map(i=>({
|
|
|
+ goodsId:i.id, num: i.currentNum, property: i.property, unitPrice: i.unitPrice,name:i.name,cover:i.shortCover
|
|
|
+ }))
|
|
|
+ goodsWastage({ goodsList: JSON.stringify(goodsList) }).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ this.$refs.wastageRef.close()
|
|
|
+ this.$msg("报损成功!")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
gosettleCommit(){
|
|
|
this.$util.hitRemind()
|
|
|
@@ -227,14 +256,17 @@ export default {
|
|
|
//确认清空花材
|
|
|
confirmClearItem(){
|
|
|
this.$util.hitRemind()
|
|
|
+ this.removeFromSaveDirect()
|
|
|
},
|
|
|
confirmLogout(){
|
|
|
this.$util.hitRemind()
|
|
|
uni.clearStorage()
|
|
|
this.$store.commit("setLoginInfo", {})
|
|
|
+ // #ifdef APP-PLUS
|
|
|
plus.runtime.restart()
|
|
|
+ // #endif
|
|
|
},
|
|
|
- logout(){
|
|
|
+ logoutFn(){
|
|
|
this.$util.hitRemind()
|
|
|
this.$refs.logoutRef.open()
|
|
|
},
|