Przeglądaj źródła

【feat】【v3】

1.完善页面配置
2.移除无效代码
3.完善用户用心、商城、任务编辑页面
4.新增奖励列表页面、奖励编辑页面、账户列表页面、账户转账页面、账户编辑页面
ChenYL 9 miesięcy temu
rodzic
commit
e87cfac91d

+ 76 - 0
src/apis/accountApi.js

@@ -0,0 +1,76 @@
+// 账户API
+
+import request from "@/utils/request";
+
+/**
+ * 查询账户信息
+ */
+export function queryAccountInfo() {
+  return request({
+    url: "/account/queryAccountInfo",
+    method: "get"
+  });
+}
+
+/**
+ * 查询账户列表
+ */
+export function queryAccountList() {
+  return request({
+    url: "/account/queryAccountList",
+    method: "get"
+  });
+}
+
+/**
+ * 查询账户
+ */
+export function queryAccount(data) {
+  return request({
+    url: "/account/queryAccount",
+    method: "get",
+    data
+  });
+}
+
+/**
+ * 保存账户信息
+ * @param {Object} data
+ */
+export function saveAccount(data) {
+  return request({
+  url: "/account/saveAccount",
+  method: "post",
+  data,
+  loading: true,
+  loadingText: "正在保存账户信息,请稍后..."
+  });
+}
+
+/**
+ * 删除账户
+ * @param {Object} params
+ */
+export function deleteAccount(params) {
+  return request({
+	url: "/account/deleteAccount",
+	method: "DELETE",
+	  params,
+	  loading: true,
+	  loadingText: "正在删除账户,请稍后..."
+  });
+}
+
+/**
+ * 转账
+ * @param {Object} data
+ */
+export function transfer(data) {
+  return request({
+  url: "/account/transfer",
+  method: "post",
+  data,
+  loading: true,
+  loadingText: "正在转账,请稍后..."
+  });
+}

+ 3 - 1
src/apis/apis.js

@@ -6,6 +6,7 @@ import * as scratchApi from './scratchApi.js';
 import * as settleApi from './settleApi.js';
 import * as dictApi from './dictApi.js';
 import * as tokenApi from './tokenApi.js';
+import * as accountApi from './accountApi.js';
 
 export {
 	loginApi,
@@ -15,5 +16,6 @@ export {
 	scratchApi,
 	settleApi,
 	dictApi,
-	tokenApi
+	tokenApi,
+	accountApi
 }

+ 37 - 12
src/apis/rewardApi.js

@@ -1,25 +1,50 @@
 import request from "@/utils/request";
 
 /**
- * 查询奖励
+ * 查询奖励列表
  */
-export function queryClaimRewardRecords(data) {
+export function queryRewardList() {
 	return request({
-		url: '/reward/queryClaimRewardRecords',
-		method: 'post',
-		data
+		url: '/reward/queryRewardList',
+		method: 'get'
 	});
 }
 
 /**
- * 领取奖励
+ * 查询奖励
  */
-export function claimReward(data) {
+export function queryReward(data) {
 	return request({
-		url: '/reward/claimReward',
-		method: 'post',
-		data,
-		loading: true,
-		loadingText: '领取中...'
+		url: '/reward/queryReward',
+		method: 'get',
+		data
 	});
+}
+
+/**
+ * 删除奖励
+ * @param {Object} params
+ */
+export function deleteReward(params) {
+  return request({
+	url: "/reward/deleteReward",
+	method: "DELETE",
+	  params,
+	  loading: true,
+	  loadingText: "正在删除奖励,请稍后..."
+  });
+}
+
+/**
+ * 保存奖励信息
+ * @param {Object} data
+ */
+export function saveReward(data) {
+  return request({
+	url: "/reward/saveReward",
+	method: "post",
+	data,
+	loading: true,
+	loadingText: "正在保存奖励信息,请稍后..."
+  });
 }

+ 14 - 24
src/common/router.js

@@ -34,39 +34,29 @@ const router = {
 	TASK_DETAIL_PAGE: '/pages/task/taskDetail',
 
 	/**
-	 * 主页
+	 * 账户列表
 	 */
-	INDEX_URL: '/pages/index',
-	
-	/**
-	 * 用户中心
-	 */
-	USER_INFO_URL: '/pages/user-info',
-	
-	/**
-	 * 打卡任务编辑页
-	 */
-	PUNCHIN_EDIT_URL: '/pages/punchin-edit',
-	
+	ACCOUNT_LIST_PAGE: '/pages/account/accountList',
+
 	/**
-	 * 打卡任务详情
+	 * 账户编辑页
 	 */
-	PUNCHIN_DETAIL_URL: '/pages/punchin-detail',
-	
+	ACCOUNT_EDIT_PAGE: '/pages/account/accountEdit',
+
 	/**
-	 * 结算
+	 * 账户转账页
 	 */
-	SETTLE_LIST_URL: '/pages/settle-list',
-	
+	ACCOUNT_TRANSFER_PAGE: '/pages/account/accountTransfer',
+
 	/**
-	 * 奖励领取记录页
+	 * 奖励列表
 	 */
-	REWARD_RECORD_LIST_URL: '/pages/reward-record-list',
-	
+	REWARD_LIST_PAGE: '/pages/reward/rewardList',
+
 	/**
-	 * 刮刮乐投入与中奖记录
+	 * 奖励编辑
 	 */
-	SCRATCH_RECORD_LIST_URL: '/pages/scratch-record-list'
+	REWARD_EDIT_PAGE: '/pages/reward/rewardEdit',
 };
 
 export default router;

+ 32 - 0
src/pages.json

@@ -70,6 +70,38 @@
 				"navigationBarTitleText": "任务详情",
 				"enablePullDownRefresh": true
 			}
+		},
+		{
+			"path": "pages/account/accountList",
+			"style": {
+				"navigationBarTitleText": "账户列表",
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/account/accountTransfer",
+			"style": {
+				"navigationBarTitleText": "转账"
+			}
+		},
+		{
+			"path": "pages/account/accountEdit",
+			"style": {
+				"navigationBarTitleText": "账户编辑"
+			}
+		},
+		{
+			"path": "pages/reward/rewardList",
+			"style": {
+				"navigationBarTitleText": "奖励列表",
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/reward/rewardEdit",
+			"style": {
+				"navigationBarTitleText": "奖励编辑"
+			}
 		}
 	],
 	"tabBar": {

+ 106 - 0
src/pages/account/accountEdit.vue

@@ -0,0 +1,106 @@
+<template>
+  <view class="edit-container">
+    <uni-forms ref="accountForm" :modelValue="accountFormData" :label-width="250" label-position="top"
+      :rules="rewardFormRules">
+
+      <uni-forms-item label="账户名称" required name="accountName">
+        <uni-easyinput v-model="accountFormData.accountName" placeholder="奖励名称" />
+      </uni-forms-item>
+
+      <!-- 按钮组 -->
+      <view class="button-container">
+        <button type="default" style="width:300rpx;" @click="cancel()">取消</button>
+        <button type="primary" style="color:#ffffff;backgroundColor:#2A82E4;width:300rpx;"
+          @click="saveReward()">保存</button>
+      </view>
+
+    </uni-forms>
+  </view>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { onLoad } from '@dcloudio/uni-app';
+import { accountApi } from '@/apis/apis';
+
+// 组件
+/**
+ * 账户表单
+ */
+const accountForm = ref(null);
+
+// 属性
+
+/**
+ * 账户表单数据
+ */
+const accountFormData = ref({
+
+});
+
+/**
+ * 打卡任务表单规则
+ */
+const rewardFormRules = ref({
+  accountName: {
+    rules: [{
+      required: true,
+      errorMessage: '账户名称不能为空'
+    },
+    {
+      minLength: 2,
+      maxLength: 30,
+      errorMessage: '长度在 {minLength} 到 {maxLength} 个字符',
+    }]
+  }
+});
+
+// 方法
+/**
+ * 保存奖励
+ */
+const saveReward = () => {
+  accountForm.value.validate(['id']).then(() => {
+    return accountApi.saveAccount(accountFormData.value)
+  }).then(datt => {
+    uni.showToast({
+      title: '保存成功',
+      icon: 'success',
+      duration: 2000
+    });
+    setTimeout(() => {
+      uni.navigateBack();
+    }, 2000);
+  });
+}
+
+/**
+ * 后退
+ */
+const cancel = () => {
+  uni.navigateBack();
+}
+
+onLoad(async (e) => {
+  if (e.id) {
+    const res = await accountApi.queryAccount({ "id": e.id });
+    accountFormData.value = res;
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+.edit-container {
+  margin: 16rpx;
+
+  .button-container {
+    background-color: #FFFFFF;
+    display: flex;
+    /* 使用Flexbox布局 */
+    justify-content: space-between;
+    /* 按钮之间的空间分布 */
+    padding: 20rpx;
+    /* 容器两侧的空白填充 */
+  }
+}
+</style>

+ 265 - 0
src/pages/account/accountList.vue

@@ -0,0 +1,265 @@
+<template>
+  <view class="account-header">
+    <view v-if="accountNum > 0">账户({{ generalAccountList.length }}个)
+    </view>
+    <view v-else>账户</view>
+    <view>
+      <span @click="goAccountEditPage()">添加</span>
+      <span class="account-btn-delimiter">|</span>
+      <span @click="goAccountTransferPage()">转账</span>
+    </view>
+  </view>
+
+  <view class="account-container">
+    <view class="account" @click="goAccountEditPage(basicAccount.id)" v-if="basicAccount">
+      <span class="account-name">{{ basicAccount.accountName }}</span>
+      <span class="account-points">{{ basicAccount.points }}</span>
+    </view>
+
+    <view class="general-account-item" v-for="account in generalAccountList" :key="account.id">
+      <view class="item-box">
+        <view class="item-header">
+          <span class="item-title">{{ account.accountName }}</span>
+        </view>
+        <view class="item-points">{{ account.points }}积分</view>
+      </view>
+      <view class="btn-group">
+        <view class="btn-item" @click="deleteDialogOpen(account.id)">删除</view>
+        <view class="btn-item" @click="goAccountEditPage(account.id)">编辑</view>
+      </view>
+    </view>
+  </view>
+
+  <!-- 删除确认框 -->
+  <uni-popup ref="deleteDialog" type="dialog">
+    <uni-popup-dialog mode="base" :before-close="true" title="删除提示" content="确认删除当前奖励?" @confirm="deleteDialogConfirm"
+      @close="deleteDialogClose"></uni-popup-dialog>
+  </uni-popup>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { onShow, onPullDownRefresh } from '@dcloudio/uni-app';
+import { accountApi } from '@/apis/apis';
+import router from '@/common/router';
+
+
+// 组件
+/**
+ * 删除弹出框
+ */
+const deleteDialog = ref(null);
+
+// 属性
+/**
+ * 账户数量
+ */
+const accountNum = ref(0);
+
+/**
+ * 基本账户
+ */
+const basicAccount = ref(null);
+
+/**
+ * 一般账户列表
+ */
+const generalAccountList = ref(null);
+
+// 方法
+/**
+ * 跳转编辑页面
+ */
+const goAccountEditPage = (id) => {
+  uni.navigateTo({
+    url: id ? router.ACCOUNT_EDIT_PAGE + "?id=" + id : router.ACCOUNT_EDIT_PAGE
+  });
+};
+
+/**
+ * 跳转转账页面
+ */
+const goAccountTransferPage = () => {
+  uni.navigateTo({
+    url: router.ACCOUNT_TRANSFER_PAGE
+  });
+};
+
+/**
+ * 加载账户数据
+ */
+const loadData = async () => {
+  let res = await accountApi.queryAccountInfo();
+  accountNum.value = res.accountNum;
+  basicAccount.value = res.basicAccount;
+  generalAccountList.value = res.generalAccountList;
+};
+
+/**
+ * 打开删除对话框
+ */
+const deleteDialogOpen = (id) => {
+  deleteDialog.value.open();
+}
+
+/**
+ * 删除确认
+ */
+const deleteDialogConfirm = async (id) => {
+  accountApi.deleteAccount({ id })
+    .then(ret => {
+      uni.showToast({
+        title: '删除成功',
+        icon: 'success'
+      });
+    })
+    .catch(err => {
+      uni.showToast({
+        title: '删除失败',
+        icon: 'error'
+      });
+    }).finally(() => {
+      deleteDialog.value.close();
+      loadData();
+    })
+    ;
+}
+
+/**
+ * 删除取消
+ */
+const deleteDialogClose = () => {
+  deleteDialog.value.close();
+}
+
+// 声明周期
+onShow(() => {
+  loadData();
+});
+
+onPullDownRefresh(() => {
+  loadData();
+  uni.stopPullDownRefresh();
+});
+</script>
+
+<style lang="scss" scoped>
+.account-header {
+  margin: 16rpx;
+  display: flex;
+  // 两侧分布
+  justify-content: space-between;
+  /* 垂直居中 */
+  align-items: center;
+
+  font-size: 30rpx;
+  font-weight: 400;
+  letter-spacing: 0rpx;
+  line-height: 43.44rpx;
+  color: #000000;
+
+  .account-btn-delimiter {
+    margin: 0 16rpx;
+  }
+}
+
+.account-container {
+  margin: 16rpx;
+
+  .account {
+    background-color: #2879ED;
+    border-radius: 16rpx;
+    height: 125rpx;
+
+    font-size: 40rpx;
+    font-weight: 400;
+    letter-spacing: 0rpx;
+    line-height: 57.92rpx;
+    color: #ffffff;
+
+    display: flex;
+    justify-content: space-between;
+    /* 子元素内容垂直居中 */
+    align-items: center;
+    padding: 0 24rpx;
+  }
+
+  .general-account-item {
+    margin-top: 16rpx;
+    width: 100%;
+    border-radius: 24rpx;
+    background: #FFFFFF;
+    border: 0.5px solid #E4E4E4;
+    box-shadow: 0px 1px 6px #D8D8D8;
+
+    .item-box {
+      padding: 16rpx 16rpx 16rpx 24rpx;
+
+      // flex布局,分布两侧,垂直居中
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+
+      font-size: 40rpx;
+      font-weight: 400;
+      letter-spacing: 0rpx;
+      line-height: 57.92rpx;
+      color: #000000;
+
+      .item-header {
+        display: flex;
+        align-items: center;
+      }
+
+      .item-tag:first-child {
+        margin-left: 24rpx;
+      }
+
+      .item-tag {
+        margin-left: 16rpx;
+        width: 94rpx;
+        height: 38rpx;
+        opacity: 1;
+        border-radius: 24rpx;
+        background: #FFFFFF;
+        border: 1px solid #406CE7;
+
+        display: inline-flex;
+        justify-content: center;
+        align-items: center;
+
+        font-size: 18rpx;
+        font-weight: 400;
+        letter-spacing: 0rpx;
+        // line-height: 26.06rpx;
+        color: #406CE7;
+      }
+    }
+  }
+
+  .btn-group {
+    margin-top: 16rpx;
+    display: flex;
+    border-top: 1px solid #C7C7C7;
+
+    .btn-item {
+      flex-grow: 1;
+
+      display: inline-flex;
+      justify-content: center;
+      align-items: center;
+
+      padding: 0rpx 16rpx;
+      font-size: 28rpx;
+      font-weight: 400;
+      letter-spacing: 0prx;
+      line-height: 40.54rpx;
+      color: #6A6A6A;
+    }
+
+    .btn-item:not(:last-child) {
+      border-right: 1px solid #C7C7C7;
+    }
+  }
+}
+</style>

+ 146 - 0
src/pages/account/accountTransfer.vue

@@ -0,0 +1,146 @@
+<template>
+  <view class="edit-container">
+    <uni-forms ref="transferForm" :modelValue="transferFormData" :label-width="250" label-position="top"
+      :rules="transferFormRules">
+
+      <uni-forms-item label="转出账户" required name="senderAccountId">
+        <uni-data-select :localdata="accountSelectedData" v-model="transferFormData.senderAccountId"></uni-data-select>
+      </uni-forms-item>
+
+      <uni-forms-item label="转入账户" required name="recipientAccountId">
+        <uni-data-select :localdata="accountSelectedData"
+          v-model="transferFormData.recipientAccountId"></uni-data-select>
+      </uni-forms-item>
+
+      <uni-forms-item label="转账积分" required name="transferPoints">
+        <uni-easyinput v-model="transferFormData.transferPoints" placeholder="请输入转账积分" type="digit" />
+      </uni-forms-item>
+
+      <!-- 按钮组 -->
+      <view class="button-container">
+        <button type="default" style="width:300rpx;" @click="cancel()">取消</button>
+        <button type="primary" style="color:#ffffff;backgroundColor:#2A82E4;width:300rpx;"
+          @click="transfer()">转账</button>
+      </view>
+    </uni-forms>
+  </view>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { onShow } from '@dcloudio/uni-app';
+import { accountApi } from '@/apis/apis';
+
+// 组件
+/**
+ * 账户表单
+ */
+const transferForm = ref(null);
+
+// 属性
+
+/**
+ * 账户表单数据
+ */
+const transferFormData = ref({});
+
+/**
+ * 账户下拉框数据
+ */
+const accountSelectedData = ref([]);
+
+/**
+ * 打卡任务表单规则
+ */
+const transferFormRules = ref({
+  senderAccountId: {
+    rules: [{
+      required: true,
+      errorMessage: '转出账户不能为空'
+    }]
+  },
+  recipientAccountId: {
+    rules: [{
+      required: true,
+      errorMessage: '转入账户不能为空'
+    }]
+  },
+  transferPoints: {
+    rules: [{
+      required: true,
+      errorMessage: '转出积分不能为空'
+    }, {
+      format: 'number',
+      errorMessage: "请输入有效数字"
+    }, {
+      minimum: 1,
+      errorMessage: "最小值{minimum}"
+    }]
+  }
+});
+
+// 方法
+/**
+ * 保存奖励
+ */
+const transfer = () => {
+  transferForm.value.validate(['id']).then(() => {
+    return accountApi.transfer(transferFormData.value)
+  }).then(datt => {
+    uni.showToast({
+      title: '转账成功',
+      icon: 'success',
+      duration: 2000
+    });
+    setTimeout(() => {
+      uni.navigateBack();
+    }, 2000);
+  });
+}
+
+/**
+ * 后退
+ */
+const cancel = () => {
+  uni.navigateBack();
+}
+
+/**
+ * 获取账户数据
+ */
+const loadAccountData = async () => {
+  let res = await accountApi.queryAccountList();
+  if (!res) {
+    accountSelectedData.value = [];
+    return;
+  }
+  accountSelectedData.value = res.map(item => {
+    let text = `${item.accountName}(${item.points}积分)`;
+    return {
+      text,
+      value: item.id
+    }
+  });
+}
+
+// 生命周期
+onShow(() => {
+  loadAccountData();
+});
+</script>
+
+<style lang="scss" scoped>
+.edit-container {
+  margin: 16rpx;
+
+  .button-container {
+    background-color: #FFFFFF;
+    display: flex;
+    /* 使用Flexbox布局 */
+    justify-content: space-between;
+    /* 按钮之间的空间分布 */
+    padding: 20rpx;
+    /* 容器两侧的空白填充 */
+  }
+}
+</style>

+ 159 - 0
src/pages/reward/rewardEdit.vue

@@ -0,0 +1,159 @@
+<template>
+  <view class="edit-container">
+    <uni-forms ref="rewardForm" :modelValue="rewardFormData" :label-width="250" label-position="top"
+      :rules="rewardFormRules">
+
+      <uni-forms-item label="奖励名称" required name="rewardName">
+        <uni-easyinput v-model="rewardFormData.rewardName" placeholder="奖励名称" />
+      </uni-forms-item>
+
+      <uni-forms-item label="兑换所需积分" required name="exchangePoints">
+        <uni-easyinput v-model="rewardFormData.exchangePoints" placeholder="请输入兑换所需积分" type="digit" />
+      </uni-forms-item>
+
+      <uni-forms-item label="自动兑换" required name="autoStatus">
+        <uni-data-select v-model="rewardFormData.autoStatus"
+          :localdata="commonEnabledStatusCheckBoxData"></uni-data-select>
+      </uni-forms-item>
+
+      <uni-forms-item label="自动兑换数量" required name="autoExchangeCount"
+        v-if="rewardFormData.autoStatus == COMMON_ENABLED_STATUS.ENABLED">
+        <uni-easyinput v-model="rewardFormData.autoExchangeCount" placeholder="请输入自动兑换数量" type="digit" />
+      </uni-forms-item>
+
+      <!-- 按钮组 -->
+      <view class="button-container">
+        <button type="default" style="width:300rpx;" @click="cancel()">取消</button>
+        <button type="primary" style="color:#ffffff;backgroundColor:#2A82E4;width:300rpx;"
+          @click="saveReward()">保存</button>
+      </view>
+
+    </uni-forms>
+  </view>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { onLoad } from '@dcloudio/uni-app';
+import { rewardApi } from '@/apis/apis';
+import { COMMON_ENABLED_STATUS } from '@/common/enums';
+
+// 组件
+/**
+ * 奖励表单
+ */
+const rewardForm = ref(null);
+
+// 属性
+
+/**
+ * 奖励表单数据
+ */
+const rewardFormData = ref({
+  "autoStatus": COMMON_ENABLED_STATUS.DISABLED
+});
+
+/**
+ * 打卡任务表单规则
+ */
+const rewardFormRules = ref({
+  rewardName: {
+    rules: [{
+      required: true,
+      errorMessage: '奖励名称不能为空'
+    },
+    {
+      minLength: 2,
+      maxLength: 30,
+      errorMessage: '长度在 {minLength} 到 {maxLength} 个字符',
+    }]
+  },
+  exchangePoints: {
+    rules: [{
+      required: true,
+      errorMessage: '兑换所学积分不能为空'
+    }, {
+      format: 'number',
+      errorMessage: "请输入有效数字"
+    }, {
+      minimum: 1,
+      errorMessage: "最小值{minimum}"
+    }]
+  },
+  autoStatus: {
+    rules: [{
+      required: true,
+      errorMessage: '自动兑换不能为空'
+    }]
+  },
+  autoExchangeCount: {
+    rules: [{
+      format: 'number',
+      errorMessage: "请输入有效数字"
+    }, {
+      minimum: 1,
+      errorMessage: "最小值{minimum}"
+    }]
+  }
+});
+
+/**
+ * 通用启用状态  checkbox数据
+ */
+const commonEnabledStatusCheckBoxData = ref([{
+  "text": "启用",
+  "value": 'ENABLED'
+}, {
+  "text": "禁用",
+  "value": 'DISABLED'
+}]);
+
+// 方法
+/**
+ * 保存奖励
+ */
+const saveReward = () => {
+  rewardForm.value.validate(['id']).then(() => {
+    return rewardApi.saveReward(rewardFormData.value)
+  }).then(datt => {
+    uni.showToast({
+      title: '保存成功',
+      icon: 'success',
+      duration: 2000
+    });
+    setTimeout(() => {
+      uni.navigateBack();
+    }, 2000);
+  });
+}
+
+/**
+ * 后退
+ */
+const cancel = () => {
+  uni.navigateBack();
+}
+
+onLoad(async (e) => {
+  if (e.id) {
+    const res = await rewardApi.queryReward({ "id": e.id });
+    rewardFormData.value = res;
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+.edit-container {
+  margin: 16rpx;
+
+  .button-container {
+    background-color: #FFFFFF;
+    display: flex;
+    /* 使用Flexbox布局 */
+    justify-content: space-between;
+    /* 按钮之间的空间分布 */
+    padding: 20rpx;
+    /* 容器两侧的空白填充 */
+  }
+}
+</style>

+ 219 - 0
src/pages/reward/rewardList.vue

@@ -0,0 +1,219 @@
+<template>
+  <view class="reward-header">
+    <view v-if="rewardList && rewardList.length > 0">奖励({{ rewardList.length }}个)
+    </view>
+    <view v-else>奖励</view>
+    <view @click="goRewardEditPage()">添加</view>
+  </view>
+
+  <view class="reward-container">
+    <view class="reward-item" v-for="reward in rewardList" :key="reward.id">
+      <view class="item-box" @click="goRewardEditPage(reward.id)">
+        <view class="item-header">
+          <span class="item-title">{{ reward.rewardName }}</span>
+          <view class="item-tag" v-if="reward.autoStatus && reward.autoStatus == COMMON_ENABLED_STATUS.ENABLED">自动兑换
+          </view>
+        </view>
+        <view class="item-points">{{ reward.exchangePoints }}积分</view>
+      </view>
+      <view class="btn-group">
+        <view class="btn-item" @click="deleteDialogOpen(reward.id)">删除</view>
+        <view class="btn-item" @click="goRewardEditPage(reward.id)">编辑</view>
+      </view>
+    </view>
+  </view>
+
+  <!-- 删除确认框 -->
+  <uni-popup ref="deleteDialog" type="dialog">
+    <uni-popup-dialog mode="base" :before-close="true" title="删除提示" content="确认删除当前奖励?" @confirm="deleteDialogConfirm"
+      @close="deleteDialogClose"></uni-popup-dialog>
+  </uni-popup>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { onShow, onPullDownRefresh } from '@dcloudio/uni-app';
+import router from '@/common/router';
+import { rewardApi } from '@/apis/apis';
+import { COMMON_ENABLED_STATUS } from '@/common/enums';
+
+// 组件
+/**
+ * 删除弹出框
+ */
+const deleteDialog = ref(null);
+
+// 属性
+/**
+ * 奖励列表
+ */
+const rewardList = ref([]);
+
+// 方法
+/**
+ * 跳转编辑页面
+ */
+const goRewardEditPage = (id) => {
+  uni.navigateTo({
+    url: id ? router.REWARD_EDIT_PAGE + '?id=' + id : router.REWARD_EDIT_PAGE
+  });
+}
+
+/**
+ * 打开删除对话框
+ */
+const deleteDialogOpen = (id) => {
+  deleteDialog.value.open();
+}
+
+/**
+ * 删除确认
+ */
+const deleteDialogConfirm = async () => {
+  rewardApi.deleteReward({ id: currentTaskId.value })
+    .then(ret => {
+      uni.showToast({
+        title: '删除成功',
+        icon: 'success'
+      });
+    })
+    .catch(err => {
+      uni.showToast({
+        title: '删除失败',
+        icon: 'error'
+      });
+    }).finally(() => {
+      deleteDialog.value.close();
+      loadData();
+    })
+    ;
+}
+
+/**
+ * 删除取消
+ */
+const deleteDialogClose = () => {
+  deleteDialog.value.close();
+}
+
+/**
+ * 获取奖励数据
+ */
+const loadData = async () => {
+  let res = await rewardApi.queryRewardList();
+  rewardList.value = res;
+};
+
+// 生命周期
+onShow(() => {
+  loadData();
+});
+
+onPullDownRefresh(() => {
+  loadData();
+  uni.stopPullDownRefresh();
+});
+</script>
+
+<style lang="scss" scoped>
+.reward-header {
+  margin: 16rpx;
+  display: flex;
+  // 两侧分布
+  justify-content: space-between;
+  /* 垂直居中 */
+  align-items: center;
+
+  font-size: 30rpx;
+  font-weight: 400;
+  letter-spacing: 0rpx;
+  line-height: 43.44rpx;
+  color: #000000;
+
+  .account-btn-delimiter {
+    margin: 0 16rpx;
+  }
+}
+
+.reward-container {
+  margin: 16rpx;
+
+  .reward-item {
+    margin-top: 16rpx;
+    width: 100%;
+    border-radius: 24rpx;
+    background: #FFFFFF;
+    border: 0.5px solid #E4E4E4;
+    box-shadow: 0px 1px 6px #D8D8D8;
+
+    .item-box {
+      padding: 16rpx 16rpx 16rpx 24rpx;
+
+      // flex布局,分布两侧,垂直居中
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+
+      font-size: 40rpx;
+      font-weight: 400;
+      letter-spacing: 0rpx;
+      line-height: 57.92rpx;
+      color: #000000;
+
+      .item-header {
+        display: flex;
+        align-items: center;
+      }
+
+      .item-tag:first-child {
+        margin-left: 24rpx;
+      }
+
+      .item-tag {
+        margin-left: 16rpx;
+        width: 94rpx;
+        height: 38rpx;
+        opacity: 1;
+        border-radius: 24rpx;
+        background: #FFFFFF;
+        border: 1px solid #406CE7;
+
+        display: inline-flex;
+        justify-content: center;
+        align-items: center;
+
+        font-size: 18rpx;
+        font-weight: 400;
+        letter-spacing: 0rpx;
+        // line-height: 26.06rpx;
+        color: #406CE7;
+      }
+    }
+  }
+
+  .btn-group {
+    margin-top: 16rpx;
+    display: flex;
+    border-top: 1px solid #C7C7C7;
+
+    .btn-item {
+      flex-grow: 1;
+
+      display: inline-flex;
+      justify-content: center;
+      align-items: center;
+
+      padding: 0rpx 16rpx;
+      font-size: 28rpx;
+      font-weight: 400;
+      letter-spacing: 0prx;
+      line-height: 40.54rpx;
+      color: #6A6A6A;
+    }
+
+    .btn-item:not(:last-child) {
+      border-right: 1px solid #C7C7C7;
+    }
+  }
+}
+</style>

+ 178 - 2
src/pages/rewardMarket.vue

@@ -1,8 +1,184 @@
 <template>
-  <div class="market">market</div>
+  <view class="account basic-account" v-if="basicAccount">
+    <span class="account-name">{{ basicAccount.accountName }}</span>
+    <span class="account-points">{{ basicAccount.points }}</span>
+  </view>
+
+  <scroll-view class="scroll-view" scroll-x v-if="generalAccountList && generalAccountList.length > 0">
+    <view class="account general-account" v-for="(account, index) in generalAccountList" :key="account.id">
+      <span>{{ account.accountName }}</span>
+      <span>{{ account.points }}</span>
+    </view>
+  </scroll-view>
+
+  <view class="reward-box">
+    <uni-grid :column="2" :highlight="false" :showBorder="false" :square="false">
+      <uni-grid-item v-for="(reward, index) in rewardList" :key="reward.id">
+        <view class="reward-item">
+          <view class="reward-item-title">{{ reward.rewardName }}</view>
+          <view class="reward-item-points">{{ reward.exchangePoints }}积分</view>
+          <view class="reward-item-btn">
+            <view class="reward-exchange-btn">立即兑换</view>
+          </view>
+        </view>
+      </uni-grid-item>
+    </uni-grid>
+  </view>
 </template>
 
 <script setup>
+import { ref } from 'vue';
+import { onPullDownRefresh, onShow } from '@dcloudio/uni-app';
+import { accountApi, rewardApi } from '@/apis/apis';
+
+// 属性
+/**
+ * 基本户
+ */
+const basicAccount = ref(null);
+
+/**
+ * 通用账户
+ */
+const generalAccountList = ref([]);
+
+/**
+ * 奖励列表
+ */
+const rewardList = ref([]);
+
+// 方法
+/**
+ * 拉取账户数据
+ */
+const loadAccountData = async () => {
+  let res = await accountApi.queryAccountInfo();
+  if (!res) {
+    basicAccount.value = null;
+    generalAccountList.value = [];
+    return;
+  }
+  basicAccount.value = res.basicAccount;
+  generalAccountList.value = res.generalAccountList;
+};
+
+/**
+ * 拉取奖励数据
+ */
+const loadRewardData = async () => {
+  let res = await rewardApi.queryRewardList();
+  rewardList.value = res;
+};
+
+// 生命周期
+onShow(() => {
+  loadAccountData();
+  loadRewardData();
+});
+
+onPullDownRefresh(() => {
+  loadAccountData();
+  loadRewardData();
+  uni.stopPullDownRefresh();
+});
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.account {
+  background-color: #2879ED;
+  border-radius: 16rpx;
+  height: 125rpx;
+
+  font-size: 40rpx;
+  font-weight: 400;
+  letter-spacing: 0rpx;
+  line-height: 57.92rpx;
+  color: #ffffff;
+
+  display: flex;
+  justify-content: space-between;
+  /* 子元素内容垂直居中 */
+  align-items: center;
+  padding: 0 24rpx;
+}
+
+.basic-account {
+  margin: 16rpx 32rpx;
+}
+
+.scroll-view {
+  margin: 0rpx 32rpx 0rpx 32rpx;
+  white-space: nowrap;
+
+  .general-account {
+    display: inline-flex;
+    width: 312rpx;
+  }
+
+  .general-account:not(:last-child) {
+    margin-right: 16rpx;
+  }
+}
+
+.reward-box {
+  margin: 16rpx;
+
+  .reward-item {
+    margin: 16rpx 24rpx;
+    height: 320rpx;
+    opacity: 1;
+    border-radius: 16rpx;
+    background-color: #E5E5E5;
+
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+
+    .reward-item-title,
+    .reward-item-points,
+    .reward-item-btn {
+      flex: 1;
+      width: 100%;
+
+      display: flex;
+      justify-content: center;
+      align-items: center;
+    }
+
+    .reward-item-title {
+      font-size: 30rpx;
+      font-weight: 400;
+      letter-spacing: 0rpx;
+      line-height: 43.44rpx;
+      color: #000000;
+    }
+
+    .reward-item-points {
+      font-size: 30rpx;
+      font-weight: 400;
+      letter-spacing: 0rpx;
+      line-height: 43.44rpx;
+      color: #000000;
+    }
+
+    .reward-exchange-btn {
+      width: 190.74rpx;
+      height: 46.9rpx;
+      opacity: 1;
+      border-radius: 24rpx;
+      background: #CCCCCC;
+
+      font-size: 24rpx;
+      font-weight: 400;
+      letter-spacing: 0rpx;
+      line-height: 34.75rpx;
+      color: #000000;
+
+      display: flex;
+      justify-content: center;
+      align-items: center;
+    }
+  }
+}
+</style>

+ 25 - 39
src/pages/task/taskEdit.vue

@@ -26,12 +26,12 @@
     <!-- 重复配置 -->
     <uni-section title="重复配置" padding="16px" type="line">
       <uni-forms-item label="重复周期类型" required name="repeatCategory">
-        <uni-data-select :localdata="repeatCategoryCheckBoxData"
+        <uni-data-select :localdata="repeatCategorySelectedData"
           v-model="taskFormData.repeatCategory"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="自定义重复日" required name="repeatCustomDay"
         v-if="taskFormData.repeatCategory == REPEAT_CATEGORY.CUSTOM">
-        <uni-data-checkbox multiple :localdata="repeatCustomDayCheckBoxData"
+        <uni-data-checkbox multiple :localdata="repeatCustomDaySelectedData"
           v-model="taskFormData.repeatCustomDay"></uni-data-checkbox>
       </uni-forms-item>
     </uni-section>
@@ -39,11 +39,11 @@
     <!-- 打卡配置 -->
     <uni-section title="打卡配置" padding="16px" type="line">
       <uni-forms-item label="打卡方式" required name="punchInMethod">
-        <uni-data-select :localdata="punchInMethodCheckBoxData" v-model="taskFormData.punchInMethod"></uni-data-select>
+        <uni-data-select :localdata="punchInMethodSelectedData" v-model="taskFormData.punchInMethod"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="判断规则" required name="compareRule"
         v-if="taskFormData.punchInMethod == PUNCH_IN_METHOD.COUNT || taskFormData.punchInMethod == PUNCH_IN_METHOD.TIMING">
-        <uni-data-select :localdata="compareRuleCheckBoxData" v-model="taskFormData.compareRule"></uni-data-select>
+        <uni-data-select :localdata="compareRuleSelectedData" v-model="taskFormData.compareRule"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="数值" required name="countTrack" v-if="taskFormData.punchInMethod == PUNCH_IN_METHOD.COUNT">
         <uni-easyinput v-model="taskFormData.countTrack" placeholder="请输入目标数值" type="digit" />
@@ -61,7 +61,7 @@
         <uni-easyinput v-model="taskFormData.points" placeholder="请输入奖励积分(基本)" type="number" />
       </uni-forms-item>
       <uni-forms-item label="额外奖励方式" required name="extraMethod">
-        <uni-data-select :localdata="extraMethodCheckBoxData" v-model="taskFormData.extraMethod"></uni-data-select>
+        <uni-data-select :localdata="extraMethodSelectedData" v-model="taskFormData.extraMethod"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="额外的时间间隔(单位:分钟)" required name="extraTimeStep"
         v-if="taskFormData.extraMethod != EXTRA_METHOD.NONE && taskFormData.punchInMethod == PUNCH_IN_METHOD.TIMING">
@@ -93,7 +93,7 @@
     <uni-section title="节假日配置" padding="16px" type="line">
       <uni-forms-item label="节假日双倍" required name="holidayStatus">
         <uni-data-select v-model="taskFormData.holidayStatus"
-          :localdata="commonEnabledStatusCheckBoxData"></uni-data-select>
+          :localdata="commonEnabledStatusSelectedData"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="数值(节假日)" required name="holidayCountTrack"
         v-if="taskFormData.holidayStatus == COMMON_ENABLED_STATUS.ENABLED && taskFormData.punchInMethod == PUNCH_IN_METHOD.COUNT">
@@ -111,11 +111,11 @@
     <uni-section title="全勤配置" padding="16px" type="line">
       <uni-forms-item label="全勤双倍" required name="fullAttendanceStatus">
         <uni-data-select v-model="taskFormData.fullAttendanceStatus"
-          :localdata="commonEnabledStatusCheckBoxData"></uni-data-select>
+          :localdata="commonEnabledStatusSelectedData"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="全勤周期" required name="fullAttendancePeriod"
         v-if="taskFormData.fullAttendanceStatus == COMMON_ENABLED_STATUS.ENABLED">
-        <uni-data-select :localdata="fullAttendancePeriodCheckBoxData"
+        <uni-data-select :localdata="fullAttendancePeriodSelectedData"
           v-model="taskFormData.fullAttendancePeriod"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="容错次数" required name="fullAttendancefaulttoleranceCnt"
@@ -127,7 +127,7 @@
     <!-- 连续规则配置 -->
     <uni-section title="连续规则配置" padding="16px" type="line">
       <uni-forms-item label="是否启用连续规则" required name="continueStatus">
-        <uni-data-select :localdata="commonEnabledStatusCheckBoxData"
+        <uni-data-select :localdata="commonEnabledStatusSelectedData"
           v-model="taskFormData.continueStatus"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="宽限期(单位:天)" required name="graceDay"
@@ -150,11 +150,11 @@
         <uni-datetime-picker type="date" return-type="date" v-model="taskFormData.endDate" />
       </uni-forms-item>
       <uni-forms-item label="是否启用自动打卡" required name="autoStatus">
-        <uni-data-select :localdata="commonEnabledStatusCheckBoxData"
+        <uni-data-select :localdata="commonEnabledStatusSelectedData"
           v-model="taskFormData.autoStatus"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="是否启用任务积分计算" required name="taskPointsStatus">
-        <uni-data-select :localdata="commonEnabledStatusCheckBoxData"
+        <uni-data-select :localdata="commonEnabledStatusSelectedData"
           v-model="taskFormData.taskPointsStatus"></uni-data-select>
       </uni-forms-item>
       <uni-forms-item label="积分区间" required :rules="[{ 'required': true, errorMessage: '起始值必填' }]"
@@ -452,9 +452,9 @@ const taskFormRules = ref({
 });
 
 /**
- * 通用启用状态  checkbox数据
+ * 通用启用状态 下拉选择数据
  */
-const commonEnabledStatusCheckBoxData = ref([{
+const commonEnabledStatusSelectedData = ref([{
   "text": "启用",
   "value": 'ENABLED'
 }, {
@@ -463,9 +463,9 @@ const commonEnabledStatusCheckBoxData = ref([{
 }]);
 
 /**
- * 打卡方式 checkbox数据
+ * 打卡方式 下拉选择数据
  */
-const punchInMethodCheckBoxData = ref([{
+const punchInMethodSelectedData = ref([{
   "text": "单次打卡",
   "value": 'SINGLE'
 }, {
@@ -477,9 +477,9 @@ const punchInMethodCheckBoxData = ref([{
 }]);
 
 /**
- * 比较规则 checkbox数据
+ * 比较规则 下拉选择数据
  */
-const compareRuleCheckBoxData = ref([{
+const compareRuleSelectedData = ref([{
   "text": "大于等于",
   "value": 'GTE'
 }, {
@@ -488,9 +488,9 @@ const compareRuleCheckBoxData = ref([{
 }]);
 
 /**
- * 全勤周期 checkbox数据
+ * 全勤周期 下拉选择数据
  */
-const fullAttendancePeriodCheckBoxData = ref([{
+const fullAttendancePeriodSelectedData = ref([{
   "text": "周",
   "value": 'WEEK'
 }, {
@@ -499,9 +499,9 @@ const fullAttendancePeriodCheckBoxData = ref([{
 }]);
 
 /**
- * 重复周期类型 checkbox数据
+ * 重复周期类型 下拉选择数据
  */
-const repeatCategoryCheckBoxData = ref([{
+const repeatCategorySelectedData = ref([{
   "text": "每日",
   "value": 'EVERYDAY'
 }, {
@@ -516,9 +516,9 @@ const repeatCategoryCheckBoxData = ref([{
 }]);
 
 /**
- * 自定义重复日 checkbox数据
+ * 自定义重复日 下拉选择数据
  */
-const repeatCustomDayCheckBoxData = ref([{
+const repeatCustomDaySelectedData = ref([{
   "text": "周一",
   "value": '1'
 }, {
@@ -542,9 +542,9 @@ const repeatCustomDayCheckBoxData = ref([{
 }]);
 
 /**
- * 额外奖励方式 checkbox数据
+ * 额外奖励方式 下拉选择数据
  */
-const extraMethodCheckBoxData = ref([{
+const extraMethodSelectedData = ref([{
   "text": "无",
   "value": 'NONE'
 }, {
@@ -556,20 +556,6 @@ const extraMethodCheckBoxData = ref([{
 }]);
 
 // 方法
-/**
- * 周末双倍奖励开关改变监听
- */
-const weekendDoubleSwitchChange = (e) => {
-  taskFormData.value.weekendDoubleFlag = e.detail.value;
-}
-
-/**
- * 全勤奖励开关改变监听
- */
-const fullAttendanceSwitchChange = (e) => {
-  taskFormData.value.fullAttendanceFlag = e.detail.value;
-}
-
 /**
  * 时间选择监听
  */

+ 2 - 2
src/pages/userCenter.vue

@@ -79,10 +79,10 @@
     <view class="mt24" v-if="loginStatus">
       <uni-list :border="true">
         <uni-list-item title="积分账户" :showArrow="true" :showExtraIcon="true"
-          :extraIcon="{ color: '#000000', size: 22, type: 'info' }" link="navigateTo" :to="router.ABOUT_US_PAGE">
+          :extraIcon="{ color: '#000000', size: 22, type: 'info' }" link="navigateTo" :to="router.ACCOUNT_LIST_PAGE">
         </uni-list-item>
         <uni-list-item title="兑换列表" :showArrow="true" :showExtraIcon="true" clickable
-          :extraIcon="{ color: '#000000', size: 22, type: 'minus' }" link="navigateTo" :to="router.DISCLAIMER_PAGE">
+          :extraIcon="{ color: '#000000', size: 22, type: 'minus' }" link="navigateTo" :to="router.REWARD_LIST_PAGE">
         </uni-list-item>
       </uni-list>
     </view>

+ 0 - 1
src/utils/request.js

@@ -66,7 +66,6 @@ export default function request(config = {}) {
 				if (res.data.code === '0') {
 					resolve(res.data.data);
 				} else if (res.data.code === '999') {
-					console.log("9999 lalall ");
 					uni.showModal({
 						title: "错误提示",
 						content: res.data.msg,