123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <template>
- <view class="uploadReceptPopup">
- <wd-popup
- v-model="props.show"
- position="bottom"
- :safe-area-inset-bottom="true"
- custom-style="max-height: 922rpx;border-radius: 40rpx 40rpx 0 0;"
- @close="handleClose"
- >
- <view class="topTitle">
- <text>上传小票</text>
- <text class="tips">(*先选择优惠力度再上传)</text>
- </view>
- <radio-group class="receptBox" @change="radioChange">
- <label
- v-for="item in props.list"
- :key="item.id"
- class="radioItem"
- :class="item.checked ? 'active' : 'static'"
- >
- <view class="left">
- <image class="icon" :src="imgObj.icon1" mode="scaleToFill" />
- <text class="label"
- >满{{ item.thresholdAmount }}返{{ item.cashbackAmount }}</text
- >
- </view>
- <radio
- class="radio"
- color="#225036"
- :value="item.id"
- style="transform: scale(0.9)"
- :checked="item.checked"
- />
- </label>
- </radio-group>
- <view class="btnBox">
- <view class="play" @click="toUploadImage">去上传图片</view>
- <!-- <view class="phone" @click="toUploadImage('album')"
- >从手机相册选择</view
- > -->
- <wd-gap height="16rpx" bg-color="#F7F8F9"></wd-gap>
- <view @click="handleClose">取消</view>
- </view>
- </wd-popup>
- </view>
- </template>
- <script lang="ts" setup>
- import { reactive, ref } from "vue";
- import { imgObj } from "../utils/source";
- import { useDraw } from "@/hooks/useDraw";
- import { receptProp } from "../utils/interface";
- import { validate } from "@/services/ams";
- const props = defineProps({
- show: {
- type: Boolean,
- default: false,
- },
- id: {
- type: String,
- defalut: "",
- },
- list: Array<receptProp>,
- });
- const openid = uni.getStorageSync("openid");
- const emit = defineEmits(["update:show"]);
- const value = ref("1");
- const toUploadImage = (type: string) => {
- if (!discountId.value)
- return uni.showToast({
- title: "请先选择优惠力度",
- icon: "error",
- });
- const params = {
- openid,
- marketingActivityId: props.id,
- discountId: discountId.value,
- };
- validate(params)
- .then((res: any) => {
- if (res.valid) {
- uni.navigateTo({
- url: `/pagesOne/winner/uploadImage?discountId=${discountId.value}&discountLevel=${discountLevel.value}`,
- });
- return;
- }
- uni.showToast({
- title: "该活动力度次数您已经用完啦,换一个活动力度参与吧",
- icon: "none",
- });
- return;
- })
- .catch((err) => {
- uni.showToast({
- title: err.msg,
- icon: "none",
- });
- });
- emit("update:show", false);
- };
- const discountId = ref<string>("");
- const discountLevel = ref<string>("");
- const radioChange = (e: any) => {
- discountId.value = e.detail.value;
- const obj = props.list!.filter((item) => item.id === e.detail.value)[0];
- discountLevel.value = `满${obj.thresholdAmount}返${obj.cashbackAmount}`;
- };
- const { handleClose } = useDraw(props, emit);
- </script>
- <style lang="scss">
- .uploadReceptPopup {
- .topTitle {
- font-size: 36rpx;
- color: #1f1f39;
- height: 80rpx;
- text-align: center;
- margin-top: 26rpx;
- .tips {
- font-size: 20rpx;
- color: #bfc8db;
- }
- }
- .receptBox {
- max-height: 350rpx;
- overflow-y: scroll;
- }
- .radioItem {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 60rpx;
- height: 80rpx;
- box-sizing: border-box;
- color: #333;
- font-size: 32rpx;
- .left {
- display: flex;
- align-items: center;
- }
- .icon {
- width: 36rpx;
- height: 36rpx;
- margin-right: 20rpx;
- }
- &.active {
- background-color: #f7f8f9;
- }
- &.static {
- background-color: #fff;
- }
- }
- .radioItem:focus {
- background-color: pink;
- }
- .btnBox {
- font-size: 36rpx;
- color: #555d6c;
- margin-top: 48rpx;
- > view {
- text-align: center;
- width: 100%;
- line-height: 108rpx;
- }
- .play {
- background: #f7f8f9;
- }
- }
- }
- </style>
|