Commit 7f8864fd authored by qipeng's avatar qipeng

照片价格计算

parent f108024e
......@@ -31,29 +31,29 @@
<view class="album-subject">
<view class="subject-List" v-for="(item,index) in previewData" :key="index" @click="projectCheckPhoto(index)" >
<image class="list-image" :src="item.faceSourceUrl" ></image>
<u-checkbox v-model="item.checkType" v-if="checkTypeFun==true" @click.stop.native="()=>{}" @change="stopPhoto($event)" shape="circle" class="list-uCheck"></u-checkbox>
<u-checkbox v-model="item.checkType" v-if="checkTypeFun==true" @click.stop.native="()=>{}" @change="stopPhoto(index)" shape="circle" class="list-uCheck"></u-checkbox>
<view class="list-mask">预览</view>
</view>
</view>
<!--脚部-->
<view class="album-bottom">
<view class="bottom-left" v-if="maskDetail==false">
<view class="left-oldMoney">15.00</view>
<view class="left-newMoney">10.00</view>
<view class="left-oldMoney">{{originalPrice}}</view>
<view class="left-newMoney">{{sellingPrice}}</view>
<view class="left-detail" @click="maskDetail=true">
<text>明细</text>
<u-icon name="arrow-up"></u-icon>
</view>
<view class="left-num">1</view>
<view class="left-mask">
<view class="left-num" v-if="priceNum>0">{{priceNum}}</view>
<view class="left-mask" v-if="priceNum>0">
多够更省
<view class="mask-transparent"></view>
</view>
</view>
<view class="bottom-Detail" v-if="maskDetail==true">
<view class="detail-total">合计:¥8.00</view>
<view class="detail-favorable">优惠减:¥2.00</view>
<view class="detail-total">合计:¥{{sellingPrices}}</view>
<view class="detail-favorable">优惠减:¥{{favorablePrice}}</view>
</view>
<view class="bootom-btn">去下载</view>
</view>
......@@ -75,7 +75,7 @@
</template>
</view>
<view class="maskPreview-check" v-if="checkTypeFun==true">
<u-checkbox v-model="previewData[previewNum].checkType" @click.stop.native="()=>{}" @change="stopPhoto($event)" shape="circle" class="maskPreview-Check"></u-checkbox>
<u-checkbox v-model="previewData[previewNum].checkType" @click.stop.native="()=>{}" @change="stopPhoto(previewNum)" shape="circle" class="maskPreview-Check"></u-checkbox>
</view>
</view>
<!--明细-->
......@@ -88,14 +88,15 @@
<view class="content-label">我的相片</view>
<view class="content-money">
<view class="money-name">相片</view>
<view class="money-text">1*10.00=10.00</view>
<view class="money-text">{{priceNum}}*{{sellingPrice}}={{sellingPrices}}</view>
</view>
<view class="content-favorable">
<view class="favorable-name">优惠</view>
<view class="favorable-text">-¥2.00</view>
<view class="favorable-text">-¥{{favorablePrice}}</view>
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
......@@ -103,11 +104,13 @@
import uPicker from '@/uview-ui/components/u-picker/u-picker.vue'
import uCheckboxGroup from '@/uview-ui/components/u-checkbox-group/u-checkbox-group.vue'
import uCheckbox from '@/uview-ui/components/u-checkbox/u-checkbox'
import uToast from '@/uview-ui/components/u-toast/u-toast.vue'
export default {
components: {
uPicker,
uCheckboxGroup,
uCheckbox,
uToast
},
data() {
return {
......@@ -144,14 +147,20 @@ export default {
touchRight: 0,
touchType: 0, //向左0++ 向右1--
//左右滑动 监听结束
originalPrice:0,//原价单价
originalPrices:0,//原价
sellingPrice:0,//售价单价
sellingPrices:0,//售价
favorablePrice:0,//优惠
priceNum:0,//选购了多少照片
}
},
onLoad(option) {
this.openid = uni.getStorageSync('openid') //获取openid
console.log(option)
this.faceIds = JSON.parse(option.faceIds)
this.location = JSON.parse(uni.getStorageSync('location'))
this.merchantId = uni.getStorageSync('merchantId')
this.merchantId = 'z0015605022691a5945bbe463141668c'//uni.getStorageSync('merchantId')
this.obtainProvince()//获取省市区
this.inquireMerchant()//查询所有商户
this.getPhotos()//照片列表
......@@ -166,7 +175,7 @@ export default {
this.option = res.data
}else{
this.$refs.uToast.show({
title: ret.message,
title: res.message,
type: 'error',
})
}
......@@ -186,7 +195,7 @@ export default {
this.merchantList = res.data
}else{
this.$refs.uToast.show({
title: ret.message,
title: res.message,
type: 'error',
})
}
......@@ -203,10 +212,12 @@ export default {
this.previewData = res.data
this.previewData.forEach((item,index)=>{
item['checkType'] = false
this.originalPrice = item.originalPrice//原价.
this.sellingPrice = item.sellingPrice//售价
})
}else{
this.$refs.uToast.show({
title: ret.message,
title: res.message,
type: 'error',
})
}
......@@ -229,12 +240,19 @@ export default {
this.previewNum = index
this.maskPreviewType = true
},
stopPhoto(){//刷新显示
stopPhoto(index){//刷新显示
if(this.checkProjectAll==true){
this.checkProjectAll=false
}
if(this.previewData[index].checkType==false){
this.previewData[index].checkType = true
}else{
this.previewData[index].checkType = false
}
this.checkTypeFun = false
this.checkTypeFun = true
if(this.checkProjectAll==true){
this.checkProjectAll=false
}
this.checkMonkey()
},
checkProjectAllFun(){//是否全选
if(this.checkProjectAll==true){
......@@ -248,7 +266,20 @@ export default {
item.checkType = true
})
}
this.checkMonkey()
},
checkMonkey(){//明细价格计算
this.originalPrices = 0//原价
this.sellingPrices = 0//售价
this.priceNum = 0
this.previewData.forEach((item,index)=>{
if(item.checkType==true){
this.originalPrices += item.originalPrice//原价
this.sellingPrices += item.sellingPrice//售价
this.priceNum++
}
})
},
projectMoreFun() { //更多产品显示
if (this.projectMoreType == false) {
......@@ -566,7 +597,7 @@ export default {
border-radius: 28rpx;
opacity: 0.5;
position: absolute;
left: 350rpx;
left: 230rpx;
top: -24rpx;
z-index: 23;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment