|
|
@@ -50,27 +50,14 @@
|
|
|
<view class="select-view">
|
|
|
<view class="select-cmd_bx">
|
|
|
<view class="num_bx">
|
|
|
-
|
|
|
- <!-- #ifdef APP-PLUS -->
|
|
|
- <input v-model="customData.bigCount" type="number" v-if="globalUnitType == 0" @focus="customData.bigCount = null" placeholder="扎数" />
|
|
|
- <input v-model="customData.smallCount" type="number" v-else @focus="customData.smallCount = null" placeholder="支数" />
|
|
|
- <!-- #endif -->
|
|
|
- <!-- #ifdef MP-WEIXIN -->
|
|
|
- <input v-model="customData.bigCount" type="number" v-if="globalUnitType == 0" @focus="customData.bigCount = null" :focus="isAddInputFocus" placeholder="扎数" />
|
|
|
- <input v-model="customData.smallCount" type="number" v-else @focus="customData.smallCount = null" :focus="isAddInputFocus" placeholder="支数" />
|
|
|
- <!-- #endif -->
|
|
|
-
|
|
|
- <input v-model="customData.userPrice" @focus="customData.userPrice = null" type="digit" placeholder="单价" />
|
|
|
-
|
|
|
- <text v-if="Number(customData.bigCount)>0">¥{{customData.userPrice && customData.bigCount ? parseFloat((customData.userPrice*customData.bigCount).toFixed(2)):0}}</text>
|
|
|
- <text v-else>¥{{customData.userPrice && customData.smallCount ? parseFloat((customData.userPrice*customData.smallCount).toFixed(2)):0}}</text>
|
|
|
-
|
|
|
+ <input v-model="customData.bigCount" type="number" v-if="cgUnitType == 0" @focus="customData.bigCount = null" placeholder="扎数" @input="bigCountChange" />
|
|
|
+ <input v-model="customData.smallCount" type="number" v-else @focus="customData.smallCount = null" placeholder="支数" @input="smallCountChange" />
|
|
|
+ <input v-model="customData.userPrice" @focus="customData.userPrice = null" type="digit" placeholder="单价" @input="userPriceChange" />
|
|
|
+ <input v-model="customData.totalPrice" @focus="customData.totalPrice = null" type="digit" placeholder="总价" @input="totalPriceChange" />
|
|
|
</view>
|
|
|
+ <view v-if="customData.aboutPrice == 1" style="margin-top:8upx;text-align:center;color:blue;">单价为近似值</view>
|
|
|
+ <view v-else style="margin-top:8upx;text-align:center;">----</view>
|
|
|
</view>
|
|
|
-
|
|
|
- <image @click="switchGlobalUnitType" :src="`${constant.imgUrl}/icon/switch/switch128.png`" mode="widthFix"
|
|
|
- style="width:60upx;height:60upx;position:absolute;top:32upx;left:30upx;" ></image>
|
|
|
-
|
|
|
</view>
|
|
|
</template>
|
|
|
</modal-module>
|
|
|
@@ -102,6 +89,7 @@ import FooterCart from "@/components/module/app-footer-cart";
|
|
|
import productMins from "@/mixins/product2";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import { delStatusUpdate } from '@/api/product';
|
|
|
+import { getShopInfoApi } from "@/api/common";
|
|
|
export default {
|
|
|
name: "purchase",
|
|
|
components: {
|
|
|
@@ -123,7 +111,8 @@ export default {
|
|
|
showSubmitModel: false,
|
|
|
autoLoad: false,//不自动请求花材数据
|
|
|
showButton:[{text: '取消',plain: true}, {text: '确定',plain: false}],
|
|
|
- globalCheckStock:false
|
|
|
+ globalCheckStock:false,
|
|
|
+ cgUnitType:0
|
|
|
};
|
|
|
},
|
|
|
computed:{
|
|
|
@@ -132,10 +121,18 @@ export default {
|
|
|
let price = 0;
|
|
|
if (this.selectList) {
|
|
|
for (const item of this.selectList) {
|
|
|
- if(Number(item.bigCount)>0){
|
|
|
- price += Number(item.userPrice)*Number(item.bigCount)
|
|
|
+ if(this.cgUnitType == 0){
|
|
|
+ if(item.aboutPrice == 1){
|
|
|
+ price += Number(item.totalPrice)
|
|
|
+ }else{
|
|
|
+ price += Number(item.userPrice)*Number(item.bigCount)
|
|
|
+ }
|
|
|
}else{
|
|
|
- price += Number(item.userPrice)*Number(item.smallCount)
|
|
|
+ if(item.aboutPrice == 1){
|
|
|
+ price += Number(item.totalPrice)
|
|
|
+ }else{
|
|
|
+ price += Number(item.userPrice)*Number(item.smallCount)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -154,8 +151,75 @@ export default {
|
|
|
if(this.option.ghsName){
|
|
|
uni.setNavigationBarTitle({ title: this.option.ghsName })
|
|
|
}
|
|
|
+ let that = this
|
|
|
+ getShopInfoApi().then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ this.cgUnitType = res.data.shopInfo && res.data.shopInfo.cgUnitType ? res.data.shopInfo.cgUnitType : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
+ totalPriceChange(){
|
|
|
+ if(Number(this.customData.totalPrice)>0){
|
|
|
+ if(this.cgUnitType == 0){
|
|
|
+ if(Number(this.customData.bigCount)>0){
|
|
|
+ let a = Number(this.customData.totalPrice)/Number(this.customData.bigCount)
|
|
|
+ this.customData.userPrice = Math.floor(a*100)/100
|
|
|
+
|
|
|
+ let newNum = Number(this.customData.userPrice)*Number(this.customData.bigCount)
|
|
|
+ newNum = parseFloat(newNum.toFixed(2))
|
|
|
+ if(Number(this.customData.totalPrice) > Number(newNum)){
|
|
|
+ this.customData.aboutPrice = 1
|
|
|
+ }else{
|
|
|
+ this.customData.aboutPrice = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(Number(this.customData.smallCount)>0){
|
|
|
+ let a = Number(this.customData.totalPrice)/Number(this.customData.smallCount)
|
|
|
+ this.customData.userPrice = Math.floor(a*100)/100
|
|
|
+ let newNum = Number(this.customData.userPrice)*Number(this.customData.smallCount)
|
|
|
+ newNum = parseFloat(newNum.toFixed(2))
|
|
|
+ if(Number(this.customData.totalPrice) > Number(newNum)){
|
|
|
+ this.customData.aboutPrice = 1
|
|
|
+ }else{
|
|
|
+ this.customData.aboutPrice = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ userPriceChange(){
|
|
|
+ if(Number(this.customData.userPrice)>0){
|
|
|
+ if(this.cgUnitType == 0){
|
|
|
+ if(Number(this.customData.bigCount)>0){
|
|
|
+ this.customData.totalPrice = Number(this.customData.bigCount)*Number(this.customData.userPrice)
|
|
|
+ this.customData.totalPrice = parseFloat(this.customData.totalPrice.toFixed(2))
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(Number(this.customData.smallCount)>0){
|
|
|
+ this.customData.totalPrice = Number(this.customData.smallCount)*Number(this.customData.userPrice)
|
|
|
+ this.customData.totalPrice = parseFloat(this.customData.totalPrice.toFixed(2))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ bigCountChange(){
|
|
|
+ if(Number(this.customData.bigCount)>0){
|
|
|
+ if(Number(this.customData.userPrice)>0){
|
|
|
+ this.customData.totalPrice = Number(this.customData.bigCount)*Number(this.customData.userPrice)
|
|
|
+ this.customData.totalPrice = parseFloat(this.customData.totalPrice.toFixed(2))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ smallCountChange(){
|
|
|
+ if(Number(this.customData.smallCount)>0){
|
|
|
+ if(Number(this.customData.userPrice)>0){
|
|
|
+ this.customData.totalPrice = Number(this.customData.smallCount)*Number(this.customData.userPrice)
|
|
|
+ this.customData.totalPrice = parseFloat(this.customData.totalPrice.toFixed(2))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
delProduct(info){
|
|
|
let that = this
|
|
|
that.$util.confirmModal({content:'确认删除?'},() => {
|