|
@@ -1,15 +1,15 @@
|
|
|
<template>
|
|
|
<view class="container theme-vote-container">
|
|
|
<view class="content-top">
|
|
|
- <view class="title"> 关于低糖三得利乌龙茶好不好喝的投票活动首段文字介绍</view>
|
|
|
+ <view class="title"> {{ detailDate.ActivityTypeName }}</view>
|
|
|
<view class="time">
|
|
|
- <view class=""> 最多可选3项</view>
|
|
|
- <view class="">截止时间:2023.01.01 </view>
|
|
|
+ <view class=""> 最多可选{{ detailDate.MaxChooseTotal }}项</view>
|
|
|
+ <view class="">截止时间:{{ detailDate.EndTime }} </view>
|
|
|
</view>
|
|
|
<view class="radio-content">
|
|
|
<van-checkbox-group v-model="result" @change="onChange">
|
|
|
- <view class="radio-li" v-for="(item, index) in radioList" :key="item.val">
|
|
|
- <van-checkbox :class="`checkboxes${index}`" :disabled="item.disabledRadio" :name="item.val" checked-color="#FBD979"> {{ item.name }} </van-checkbox>
|
|
|
+ <view class="radio-li" v-for="(item, index) in listTheme" :key="item.QuestionnaireThemeId">
|
|
|
+ <van-checkbox :class="[`checkboxes${index}`]" :disabled="item.DisabledRadio" :name="item.QuestionnaireThemeId" checked-color="#FBD979"> {{ item.ActivityTheme }} </van-checkbox>
|
|
|
</view>
|
|
|
</van-checkbox-group>
|
|
|
</view>
|
|
@@ -22,81 +22,63 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { purchaserApi } from "@/config/modules/purchaser.js";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
advice_content: "",
|
|
|
- result: 1,
|
|
|
- radioList: [
|
|
|
- {
|
|
|
- name: "主题活动1",
|
|
|
- val: 1,
|
|
|
- disabledRadio: false,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动2",
|
|
|
- disabledRadio: false,
|
|
|
- val: 2,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动3",
|
|
|
- disabledRadio: false,
|
|
|
- val: 3,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动5",
|
|
|
- disabledRadio: false,
|
|
|
- val: 5,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动6",
|
|
|
- disabledRadio: false,
|
|
|
- val: 6,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动7",
|
|
|
- disabledRadio: false,
|
|
|
- val: 7,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动8",
|
|
|
- disabledRadio: false,
|
|
|
- val: 8,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动12",
|
|
|
- disabledRadio: false,
|
|
|
- val: 12,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动11",
|
|
|
- disabledRadio: false,
|
|
|
- val: 11,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "主题活动10",
|
|
|
- disabledRadio: false,
|
|
|
- val: 10,
|
|
|
- },
|
|
|
- ],
|
|
|
+ result: [],
|
|
|
+ listTheme: [],
|
|
|
+ detailDate: {},
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
onChange(event) {
|
|
|
- if (event.detail.length >= 3) {
|
|
|
- this.radioList.forEach((item) => {
|
|
|
+ if (event.detail.length >= this.detailDate.MaxChooseTotal) {
|
|
|
+ this.listTheme.forEach((item) => {
|
|
|
if (!event.detail.includes(item.val + "")) {
|
|
|
- item.disabledRadio = true;
|
|
|
+ item.DisabledRadio = true;
|
|
|
}
|
|
|
});
|
|
|
this.result = event.detail;
|
|
|
} else {
|
|
|
this.result = event.detail;
|
|
|
- this.radioList.forEach((item) => {
|
|
|
- item.disabledRadio = false;
|
|
|
+ this.listTheme.forEach((item) => {
|
|
|
+ item.DisabledRadio = false;
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ //
|
|
|
+ async submitBtn() {
|
|
|
+ const res = await purchaserApi.questionnaireVote_add({
|
|
|
+ QuestionnaireId: this.detailDate.QuestionnaireId ? this.detailDate.QuestionnaireId : "",
|
|
|
+ QuestionnaireThemeIds: this.result.map((item) => Number(item)),
|
|
|
+ Content: this.advice_content,
|
|
|
+ });
|
|
|
+ if (res.Ret === 200) {
|
|
|
+ uni.navigateBack({
|
|
|
+ fail() {
|
|
|
+ uni.switchTab({
|
|
|
+ url: "/pages/index/index",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取详情
|
|
|
+ async getDetails() {
|
|
|
+ const res = await purchaserApi.questionnaireDetail({
|
|
|
+ IsBestNew: true,
|
|
|
+ QuestionnaireId: 2,
|
|
|
+ });
|
|
|
+ if (res.Ret === 200) {
|
|
|
+ this.detailDate = res.Data.Detail;
|
|
|
+ this.listTheme = res.Data.Detail.ListTheme || [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ this.getDetails();
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -161,7 +143,7 @@ export default {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
- background-color: #FBD879;
|
|
|
+ background-color: #fbd879;
|
|
|
font-size: 28rpx;
|
|
|
font-weight: 600;
|
|
|
}
|