diff --git a/pages/app/score-shop.vue b/pages/app/score-shop.vue
index 5a55389..dd5866d 100644
--- a/pages/app/score-shop.vue
+++ b/pages/app/score-shop.vue
@@ -6,72 +6,79 @@
当前积分
- 6963
+ {{score}}
积分明细
-
+
-
+
-
+
-
+
-
-
+
+
+
- 优惠券满100减50
+ {{item.name}}
- 100积分兑换
+ {{item.score}}积分兑换
-
-
-
-
-
- 优惠券满100减50
-
- 100积分兑换
-
-
-
-
-
-
-
- 优惠券满100减50
-
- 100积分兑换
-
-
-
-
+
-
-
+
+
+
+
+
+ {{ item.name }}
+
+ {{item.score}}积分兑换
+
+
+
+
+
+
+
+
+
+
+ v-if="couponList.length == 0" style="margin-top: 300rpx;">
暂无数据信息
- -->
+
+
+
+
+
-
+
@@ -87,32 +94,88 @@
reactive
} from 'vue';
import _ from 'lodash';
-
- const tabMaps = [
- {
- name: '优惠券',
- value: '0',
- },
- {
- name: '次数券',
- value: '1',
- },
+
+ const listQuery = ref({
+ page: 1,
+ limit: 10,
+ list_rows: 10,
+ status: 1,
+ })
+ const tabMaps = [{
+ name: '优惠券',
+ value: '1',
+ },
+ {
+ name: '次数券',
+ value: '2',
+ },
];
const currentTab = ref(0)
+ const score = ref(0)
//切换tabs
function onChange(e) {
- console.log('onChange',e);
- currentTab.value = e.index
- console.log('切换tabs',currentTab.value);
- // getLogList();
+ console.log('onChange', e);
+ currentTab.value = e.index
+ console.log('切换tabs', currentTab.value);
+ listQuery.value.status = e.value
+ getCouponList();
}
-
+
//页面跳转
const toPage = (e) => {
uni.navigateTo({
url: e
})
-
+
+ }
+
+ //满减券
+ const couponList = ref([])
+ const couponCount = ref(0)
+ async function getCouponList() {
+ const res = await sheep.$api.app.scoreShop.fullList({
+ page: listQuery.value.page,
+ limit: listQuery.value.limit,
+ status: listQuery.value.status,
+ order: 'normal'
+ });
+ if (res.code === 1) {
+ couponList.value = res.data.list;
+ couponCount.value = res.data.count;
+ score.value = res.data.score
+ } else {
+ uni.showToast({
+ title: res.msg,
+ icon: 'none'
+ })
+ }
+ }
+
+ const showCouponPro = ref(false)
+ const couponName = ref('')
+ const couponSelectId = ref('')
+ function openCouponPro(item) {
+ showCouponPro.value = true;
+ couponName.value = item.name;
+ couponSelectId.value = item.id
+ }
+ async function handleCouponSure() {
+ const res = await sheep.$api.app.scoreShop.exCoupon({
+ id: couponSelectId.value
+ });
+ if (res.code === 1) {
+ uni.showToast({
+ title: res.msg,
+ icon: 'success'
+ })
+ showCouponPro.value = false;
+ } else {
+ uni.showToast({
+ title: res.msg,
+ icon: 'error'
+ })
+ showCouponPro.value = false;
+ }
}
// 上拉加载更多
@@ -120,7 +183,7 @@
// loadmore();
});
onLoad(() => {
- // getData();
+ getCouponList();
});
@@ -128,42 +191,43 @@
.fs30 {
font-size: 30rpx;
}
-
+
.fs60 {
font-size: 60rpx;
}
-
+
.fs28 {
font-size: 28rpx;
}
-
+
.bold {
font-weight: bold;
}
-
+
.c3 {
color: #333333;
}
-
+
.c9 {
color: #999999;
}
-
+
.container {
background-color: #ffffff;
-
+ height: 100vh;
+
.conTop {
width: 100%;
height: 300rpx;
background-image: url('https://jiangxiaoxian.0rui.cn/scoreTopBack.png');
background-size: 100%;
-
+
.textLine {
position: relative;
top: 68rpx;
left: 60rpx;
display: block;
-
+
.scoreDetail {
margin-top: 20rpx;
display: flex;
@@ -172,34 +236,37 @@
}
}
}
-
+
.exChangeBox {
background-color: #ffffff;
width: 690rpx;
-
+ margin-top: 30rpx;
+
.couponsList {
width: 100%;
padding: 0 30rpx;
display: grid;
- grid-template-columns: repeat(2, 1fr);;
+ grid-template-columns: repeat(2, 1fr);
+ ;
grid-gap: 20px;
// display: flex;
// justify-content: center;
// align-items: center;
-
-
+
+
.list-item {
width: 330rpx;
border-radius: 18rpx;
box-shadow: 4rpx 4rpx 4rpx 4rpx rgba(153, 153, 153, 0.1);
-
+
.item-text {
padding: 30rpx;
-
+
.exchangeBtn {
background-color: #fcc74e;
height: 70rpx;
width: 270rpx;
+ margin-top: 30rpx;
border-radius: 223rpx;
align-items: center;
justify-content: center;
@@ -210,10 +277,56 @@
}
}
}
-
+
}
}
+ .popupContacted {
+ width: 660rpx;
+ height: 477rpx;
+ background-color: #fff;
+ display: grid;
+ border-radius: 18rpx;
+
+ .contactedBox {
+ width: 660rpx;
+ height: 325rpx;
+ padding: 30rpx 0;
+ // margin-top: 40rpx;
+ display: grid;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .contactBtn {
+ width: 660rpx;
+ height: 92rpx;
+ border-top: 1rpx solid #eeeeee;
+ display: flex;
+ border-radius: 0 0 18rpx 18rpx;
+ // margin-top: 40rpx;
+
+ .tactBtnBox {
+ width: 330rpx;
+ height: 92rpx;
+ border-right: 1rpx solid #eeeeee;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .tactBtnBox2 {
+ width: 330rpx;
+ height: 92rpx;
+ // border-right: 1rpx solid #eeeeee;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ }
+
+ }
+
}
\ No newline at end of file
diff --git a/pages/app/sign.vue b/pages/app/sign.vue
index ae87dd9..66be885 100644
--- a/pages/app/sign.vue
+++ b/pages/app/sign.vue
@@ -84,7 +84,7 @@
-
+
去发布
@@ -125,7 +125,7 @@
-
+
去消费
@@ -143,7 +143,7 @@
-
+
去分享
@@ -218,6 +218,7 @@
computed,
reactive
} from 'vue';
+ import { showShareModal } from '@/sheep/hooks/useModal';
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/app/sign.png');
@@ -381,6 +382,30 @@
url: e
})
}
+
+ //跳转tabbars
+ const toTabb = (e) => {
+ uni.switchTab({
+ url: e
+ })
+ }
+
+ //分享功能
+ function showShare() {
+ // 确保使用有效的图片URL
+ const shareInfo = {
+ title: '每日签到领积分',
+ desc: '快来签到领取积分奖励吧',
+ image: 'https://jiangxiaoxian.0rui.cn/valid-image.png', // 替换为有效的图片URL
+ params: {
+ page: 'sign'
+ }
+ };
+
+ // 调用分享方法
+ showShareModal(shareInfo);
+ }
+
\ No newline at end of file
diff --git a/sheep/api/app.js b/sheep/api/app.js
index dab454e..833250d 100644
--- a/sheep/api/app.js
+++ b/sheep/api/app.js
@@ -1,137 +1,151 @@
import request from '@/sheep/request';
-import { baseUrl } from '@/sheep/config';
+import {
+ baseUrl
+} from '@/sheep/config';
export default {
- // 系统初始化
- init: (templateId) =>
- request({
- url: 'index/init',
- params: {
- templateId,
- },
- custom: {
- showError: false,
- showLoading: false,
- },
- }),
- // 同步客户端页面到后端
- pageSync: (pages) =>
- request({
- url: 'index/pageSync',
- method: 'POST',
- data: {
- pages,
- },
- custom: {
- showError: false,
- showLoading: false,
- },
- }),
- // 发送短信
- sendSms: (data) =>
- request({
- url: 'index/send',
- method: 'POST',
- data,
- custom: {
- showSuccess: true,
- loadingMsg: '发送中',
- },
- }),
- //意见反馈
- feedback: (data) =>
- request({
- url: 'index/feedback',
- method: 'POST',
- data,
- }),
- // 自定义页面
- page: (id) =>
- request({
- url: 'index/page',
- method: 'GET',
- params: {
- id: id,
- },
- }),
- //积分商城
- scoreShop: {
- list: (params) =>
- request({
- url: 'app.score_shop',
- method: 'GET',
- params,
- }),
- ids: (params = {}) =>
- request({
- url: 'app.score_shop/ids',
- method: 'GET',
- params,
- }),
- detail: (id) =>
- request({
- url: 'app.score_shop/detail',
- method: 'GET',
- params: {
- id: id,
- },
- }),
- },
- //小程序直播
- mplive: {
- getMpLink: () =>
- request({
- url: 'app.mplive/getMpLink',
- method: 'GET',
- }),
- getRoomList: (ids) =>
- request({
- url: 'app.mplive/getRoomList',
- method: 'GET',
- params: {
- ids: ids.join(','),
- }
- }),
- },
+ // 系统初始化
+ init: (templateId) =>
+ request({
+ url: 'index/init',
+ params: {
+ templateId,
+ },
+ custom: {
+ showError: false,
+ showLoading: false,
+ },
+ }),
+ // 同步客户端页面到后端
+ pageSync: (pages) =>
+ request({
+ url: 'index/pageSync',
+ method: 'POST',
+ data: {
+ pages,
+ },
+ custom: {
+ showError: false,
+ showLoading: false,
+ },
+ }),
+ // 发送短信
+ sendSms: (data) =>
+ request({
+ url: 'index/send',
+ method: 'POST',
+ data,
+ custom: {
+ showSuccess: true,
+ loadingMsg: '发送中',
+ },
+ }),
+ //意见反馈
+ feedback: (data) =>
+ request({
+ url: 'index/feedback',
+ method: 'POST',
+ data,
+ }),
+ // 自定义页面
+ page: (id) =>
+ request({
+ url: 'index/page',
+ method: 'GET',
+ params: {
+ id: id,
+ },
+ }),
+ //积分商城
+ scoreShop: {
+ fullList: (params) =>
+ request({
+ url: 'meal.score/product_list',
+ method: 'GET',
+ params,
+ }),
+ exCoupon: (data) =>
+ request({
+ url: 'meal.score/exchange',
+ method: 'POST',
+ data,
+ }),
+ list: (params) =>
+ request({
+ url: 'app.score_shop',
+ method: 'GET',
+ params,
+ }),
+ ids: (params = {}) =>
+ request({
+ url: 'app.score_shop/ids',
+ method: 'GET',
+ params,
+ }),
+ detail: (id) =>
+ request({
+ url: 'app.score_shop/detail',
+ method: 'GET',
+ params: {
+ id: id,
+ },
+ }),
+ },
+ //小程序直播
+ mplive: {
+ getMpLink: () =>
+ request({
+ url: 'app.mplive/getMpLink',
+ method: 'GET',
+ }),
+ getRoomList: (ids) =>
+ request({
+ url: 'app.mplive/getRoomList',
+ method: 'GET',
+ params: {
+ ids: ids.join(','),
+ }
+ }),
+ },
- //上传
- upload: (file, group = 'ugc', callback) => {
- const token = uni.getStorageSync('token');
- uni.showLoading({
- title: '上传中',
- });
- return new Promise((resolve, reject) => {
- uni.uploadFile({
- url: baseUrl + '/api/common/upload',
- filePath: file,
- name: 'file',
- formData: {
- group,
- },
- header: {
- Accept: 'text/json',
- // Authorization: token,
- token: token
- },
- success: (uploadFileRes) => {
- let result = JSON.parse(uploadFileRes.data);
- if (result.code === 0) {
- uni.showToast({
- icon: 'none',
- title: result.msg,
- });
- } else {
- return resolve(result.data);
- }
- },
- fail: (error) => {
- console.log('上传失败:', error);
- return resolve(false);
- },
- complete: () => {
- uni.hideLoading();
- },
- });
- });
- },
-};
+ //上传
+ upload: (file, group = 'ugc', callback) => {
+ const token = uni.getStorageSync('token');
+ uni.showLoading({
+ title: '上传中',
+ });
+ return new Promise((resolve, reject) => {
+ uni.uploadFile({
+ url: baseUrl + '/api/common/upload',
+ filePath: file,
+ name: 'file',
+ formData: {
+ group,
+ },
+ header: {
+ Accept: 'text/json',
+ // Authorization: token,
+ token: token
+ },
+ success: (uploadFileRes) => {
+ let result = JSON.parse(uploadFileRes.data);
+ if (result.code === 0) {
+ uni.showToast({
+ icon: 'none',
+ title: result.msg,
+ });
+ } else {
+ return resolve(result.data);
+ }
+ },
+ fail: (error) => {
+ console.log('上传失败:', error);
+ return resolve(false);
+ },
+ complete: () => {
+ uni.hideLoading();
+ },
+ });
+ });
+ },
+};
\ No newline at end of file
diff --git a/sheep/components/s-uploader/utils.js b/sheep/components/s-uploader/utils.js
index c1e8073..49f67f0 100644
--- a/sheep/components/s-uploader/utils.js
+++ b/sheep/components/s-uploader/utils.js
@@ -3,12 +3,12 @@
* @param {String} name
*/
export const get_file_ext = (name) => {
- const last_len = name.lastIndexOf('.');
- const len = name.length;
- return {
- name: name.substring(0, last_len),
- ext: name.substring(last_len + 1, len),
- };
+ const last_len = name.lastIndexOf('.');
+ const len = name.length;
+ return {
+ name: name.substring(0, last_len),
+ ext: name.substring(last_len + 1, len),
+ };
};
/**
@@ -16,49 +16,49 @@ export const get_file_ext = (name) => {
* @param {Array} fileExtname
*/
export const get_extname = (fileExtname) => {
- if (!Array.isArray(fileExtname)) {
- let extname = fileExtname.replace(/(\[|\])/g, '');
- return extname.split(',');
- } else {
- return fileExtname;
- }
- return [];
+ if (!Array.isArray(fileExtname)) {
+ let extname = fileExtname.replace(/(\[|\])/g, '');
+ return extname.split(',');
+ } else {
+ return fileExtname;
+ }
+ return [];
};
/**
* 获取文件和检测是否可选
*/
export const get_files_and_is_max = (res, _extname) => {
- let filePaths = [];
- let files = [];
- if (!_extname || _extname.length === 0) {
- return {
- filePaths,
- files,
- };
- }
- res.tempFiles.forEach((v) => {
- let fileFullName = get_file_ext(v.name);
- const extname = fileFullName.ext.toLowerCase();
- if (_extname.indexOf(extname) !== -1) {
- files.push(v);
- filePaths.push(v.path);
- }
- });
- if (files.length !== res.tempFiles.length) {
- uni.showToast({
- title: `当前选择了${res.tempFiles.length}个文件 ,${
+ let filePaths = [];
+ let files = [];
+ if (!_extname || _extname.length === 0) {
+ return {
+ filePaths,
+ files,
+ };
+ }
+ res.tempFiles.forEach((v) => {
+ let fileFullName = get_file_ext(v.name);
+ const extname = fileFullName.ext.toLowerCase();
+ if (_extname.indexOf(extname) !== -1) {
+ files.push(v);
+ filePaths.push(v.path);
+ }
+ });
+ if (files.length !== res.tempFiles.length) {
+ uni.showToast({
+ title: `当前选择了${res.tempFiles.length}个文件 ,${
res.tempFiles.length - files.length
} 个文件格式不正确`,
- icon: 'none',
- duration: 5000,
- });
- }
+ icon: 'none',
+ duration: 5000,
+ });
+ }
- return {
- filePaths,
- files,
- };
+ return {
+ filePaths,
+ files,
+ };
};
/**
@@ -66,45 +66,59 @@ export const get_files_and_is_max = (res, _extname) => {
* @param {Object} filepath
*/
export const get_file_info = (filepath) => {
- return new Promise((resolve, reject) => {
- uni.getImageInfo({
- src: filepath,
- success(res) {
- resolve(res);
- },
- fail(err) {
- reject(err);
- },
- });
- });
+ return new Promise((resolve, reject) => {
+ if (!filepath) {
+ reject(new Error('Invalid file path'));
+ return;
+ }
+
+ uni.getImageInfo({
+ src: filepath,
+ success(res) {
+ resolve(res);
+ },
+ fail(err) {
+ console.error('Failed to get image info:', err);
+ reject(err);
+ },
+ });
+ });
};
/**
* 获取封装数据
*/
export const get_file_data = async (files, type = 'image') => {
- // 最终需要上传数据库的数据
- let fileFullName = get_file_ext(files.name);
- const extname = fileFullName.ext.toLowerCase();
- let filedata = {
- name: files.name,
- uuid: files.uuid,
- extname: extname || '',
- cloudPath: files.cloudPath,
- fileType: files.fileType,
- url: files.path || files.path,
- size: files.size, //单位是字节
- image: {},
- path: files.path,
- video: {},
- };
- if (type === 'image') {
- const imageinfo = await get_file_info(files.path);
- delete filedata.video;
- filedata.image.width = imageinfo.width;
- filedata.image.height = imageinfo.height;
- filedata.image.location = imageinfo.path;
- } else {
- delete filedata.image;
- }
- return filedata;
-};
+ // 最终需要上传数据库的数据
+ let fileFullName = get_file_ext(files.name);
+ const extname = fileFullName.ext.toLowerCase();
+ let filedata = {
+ name: files.name,
+ uuid: files.uuid,
+ extname: extname || '',
+ cloudPath: files.cloudPath,
+ fileType: files.fileType,
+ url: files.path || files.path,
+ size: files.size, //单位是字节
+ image: {},
+ path: files.path,
+ video: {},
+ };
+
+ try {
+ if (type === 'image') {
+ const imageinfo = await get_file_info(files.path);
+ delete filedata.video;
+ filedata.image.width = imageinfo.width;
+ filedata.image.height = imageinfo.height;
+ filedata.image.location = imageinfo.path;
+ } else {
+ delete filedata.image;
+ }
+ } catch (error) {
+ console.error('Error processing file data:', error);
+ // 返回基本文件数据,即使图片信息获取失败
+ delete filedata.image;
+ delete filedata.video;
+ }
+ return filedata;
+};
\ No newline at end of file