|
|
@@ -106,7 +106,7 @@
|
|
|
type="top"
|
|
|
maxHeight="90vh"
|
|
|
>
|
|
|
- <selectSettle :totalShop="totalShop"></selectSettle>
|
|
|
+ <selectSettle @settleReturn="settleReturn" ref="selectSettle" :totalShop="totalShop"></selectSettle>
|
|
|
</uniPopup>
|
|
|
<NotLogin></NotLogin>
|
|
|
</view>
|
|
|
@@ -121,7 +121,7 @@ import keyboardSetFlower from '@/components/app-boardSet-flower.vue'
|
|
|
import selectSettle from './components/select-settle.vue'
|
|
|
import selectUser from './components/select-user.vue'
|
|
|
import shopTypeSelect from './components/shopTypeSelect.vue'
|
|
|
-import { createOrder } from '@/api/home/index'
|
|
|
+import { createCreateOrder, wastageCreateOrder } from '@/api/home/index'
|
|
|
export default {
|
|
|
name: "workbench",
|
|
|
components: { NotLogin,uniPopup,selectUser,shopTypeSelect,keyboardSetFlower,selectSettle },
|
|
|
@@ -139,7 +139,8 @@ export default {
|
|
|
bigUnit: 0,
|
|
|
smallUnit:0,
|
|
|
totalPrice: 0
|
|
|
- }
|
|
|
+ },
|
|
|
+ selectItemUser:{}
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -156,41 +157,71 @@ export default {
|
|
|
},
|
|
|
watch:{
|
|
|
shopList(){
|
|
|
- if(this.$util.isEmpty(this.shopList)) {
|
|
|
- this.totalShop = {
|
|
|
- bigUnit: 0,
|
|
|
- smallUnit:0,
|
|
|
- totalPrice: 0
|
|
|
- }
|
|
|
+ if(this.$util.isEmpty(this.shopList)) {
|
|
|
+ this.totalShop = {
|
|
|
+ bigUnit: 0,
|
|
|
+ smallUnit:0,
|
|
|
+ totalPrice: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.totalShop = this.shopList.reduce((total,val)=>{
|
|
|
+ // 0 大单位 1小单位
|
|
|
+ if(val.unitType === 0) {
|
|
|
+ total.bigUnit = total.bigUnit + (val.currentNum *1)
|
|
|
+ }else {
|
|
|
+ total.smallUnit = total.smallUnit +(1*val.currentNum)
|
|
|
}
|
|
|
- this.totalShop = this.shopList.reduce((total,val)=>{
|
|
|
- // 0 大单位 1小单位
|
|
|
- if(val.unitType === 0) {
|
|
|
- total.bigUnit = total.bigUnit + (val.currentNum *1)
|
|
|
- }else {
|
|
|
- total.smallUnit = total.smallUnit +(1*val.currentNum)
|
|
|
- }
|
|
|
- total.totalPrice = total.totalPrice + (1*val.currentNum) * (val.currentUnitPrice*1)
|
|
|
- return total
|
|
|
- },{
|
|
|
- bigUnit: 0,
|
|
|
- smallUnit:0,
|
|
|
- totalPrice: 0
|
|
|
- })
|
|
|
+ total.totalPrice = total.totalPrice + (1*val.currentNum) * (val.currentUnitPrice*1)
|
|
|
+ return total
|
|
|
+ },{
|
|
|
+ bigUnit: 0,
|
|
|
+ smallUnit:0,
|
|
|
+ totalPrice: 0
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 结算创建订单
|
|
|
+ async setCreateOrder(){
|
|
|
+ try {
|
|
|
+ let arr = this.shopList.map(i=>({
|
|
|
+ productId:i.id,
|
|
|
+ unitType: i.unitType,
|
|
|
+ num: i.currentNum,
|
|
|
+ property: i.property,
|
|
|
+ unitPrice: i.currentUnitPrice
|
|
|
+ }))
|
|
|
+ const {settleId,payId,payUserId,isPrint,proceeds,freight} = this.$refs.selectSettle
|
|
|
+ await createCreateOrder({
|
|
|
+ customId: this.selectItemUser.id,
|
|
|
+ product: JSON.stringify(arr),
|
|
|
+ modifyPrice: proceeds,
|
|
|
+ sendType: 1,
|
|
|
+ hasPay: settleId,
|
|
|
+ payWay: payId,
|
|
|
+ getUserId: payUserId,
|
|
|
+ needPrint: isPrint,
|
|
|
+ sendCost: freight,
|
|
|
+ remark:''
|
|
|
+ })
|
|
|
+ this.isShowSettle = false
|
|
|
+ this.$msg('订单创建成功')
|
|
|
+ }catch(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async settleReturn(){
|
|
|
+ this.setCreateOrder()
|
|
|
+ },
|
|
|
selectCurrentActive(item){
|
|
|
this.selectCurrentActiveItem = item
|
|
|
},
|
|
|
selectUserReturn(val){
|
|
|
- this.isShowUser = false
|
|
|
+ this.selectItemUser = val
|
|
|
+ this.isShowUser = false
|
|
|
},
|
|
|
init() {
|
|
|
},
|
|
|
- // selectItem(){
|
|
|
- // this.isShowFllowNum = true
|
|
|
- // },
|
|
|
selectUser(){
|
|
|
this.isShowUser = true
|
|
|
},
|
|
|
@@ -201,7 +232,20 @@ export default {
|
|
|
}
|
|
|
this.$util.confirmModal({content:'确定报损吗?'},
|
|
|
async() => {
|
|
|
- // that.paySuccess(parameter)
|
|
|
+ try {
|
|
|
+ let arr = this.shopList.map(i=>({
|
|
|
+ productId:i.id,
|
|
|
+ unitType: i.unitType,
|
|
|
+ num: i.currentNum
|
|
|
+ }))
|
|
|
+ await wastageCreateOrder({
|
|
|
+ product: JSON.stringify(arr)
|
|
|
+ })
|
|
|
+ this.$msg("报损成功!");
|
|
|
+ }catch(err) {
|
|
|
+ console.log(err)
|
|
|
+ }
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
settle(){
|
|
|
@@ -209,6 +253,10 @@ export default {
|
|
|
this.$msg('请选择结算商品')
|
|
|
return false
|
|
|
}
|
|
|
+ if(this.$util.isEmpty(this.selectItemUser)) {
|
|
|
+ this.$msg('请选择客户')
|
|
|
+ return false
|
|
|
+ }
|
|
|
this.isShowSettle = true
|
|
|
|
|
|
},
|