依据文档修改

pull/27/head
落日晚风 2023-12-13 17:42:12 +08:00
parent 98baaab9bc
commit e71091cbb0
9 changed files with 1354 additions and 1310 deletions

View File

@ -30,7 +30,8 @@
<!-- 日历表 -->
<view class="myDateTable">
<view v-for="(item, j) in state.data.days" :key="j" class="dateCell ss-flex ss-row-center ss-col-center">
<view v-for="(item, j) in state.data.days" :key="j"
class="dateCell ss-flex ss-row-center ss-col-center">
<!-- 空格 -->
<view class="ss-flex ss-row-center ss-col-center">
<text :decode="true">&nbsp;&nbsp;</text>
@ -39,7 +40,8 @@
<!-- 已签到日期 -->
<view v-if="item.is_sign" class="is-sign ss-flex ss-row-center">
<view class="is-sign-num">{{ item.day < 10 ? '0' + item.day : item.day }}</view>
<image class="is-sign-image" :src="sheep.$url.static('/static/img/shop/app/correct.png')">
<image class="is-sign-image"
:src="sheep.$url.static('/static/img/shop/app/correct.png')">
</image>
</view>
<!-- 未签到日期 -->
@ -124,13 +126,19 @@
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad, onReady } from '@dcloudio/uni-app';
import { computed, reactive } from 'vue';
import sheep from '@/sheep';
import {
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
const headerBg = sheep.$url.css('/static/img/shop/app/sign.png');
const headerBg = sheep.$url.css('/static/img/shop/app/sign.png');
const state = reactive({
const state = reactive({
data: {
days: [], //
rules: {}, //
@ -138,8 +146,7 @@ const state = reactive({
cur_year: 0, //
cur_month: 0, //
cur_day: 0, //
weeks_ch: [
{
weeks_ch: [{
title: '日',
value: '0',
},
@ -175,38 +182,50 @@ const state = reactive({
date: '', //
isSign: 0, //
loading: true,
});
async function onSign() {
const { error, data } = await sheep.$api.activity.signAdd();
});
async function onSign() {
//
const {
code: error,
data
} = await sheep.$api.activity.signAdd();
if (error === 0) {
state.showModel = true;
state.signin = data;
// getData();
}
}
}
function onShowRetroactive(e) {
function onShowRetroactive(e) {
state.showRetroactive = true;
state.date = e;
}
//
function onConfirm() {
}
//
function onConfirm() {
state.showModel = false;
getData();
}
//
async function onRetroactive() {
const { error, data } = await sheep.$api.activity.replenish({
}
//
async function onRetroactive() {
const {
error,
data
} = await sheep.$api.activity.replenish({
date: state.date,
});
if (error === 0) {
state.showRetroactive = false;
getData();
}
}
}
async function getData(mouth) {
const { error, data } = await sheep.$api.activity.signList(mouth);
async function getData(mouth) {
const {
error,
data
} = await sheep.$api.activity.signList(mouth);
//
const ren = await sheep.$api.activity.getSummary();
if (error === 0) {
state.data = data;
} else {
@ -236,16 +255,17 @@ async function getData(mouth) {
}
});
}
state.continue_days = data.continue_days;
state.isSign = ren.data.todaySignIn ? 1 : 0;
state.continue_days = ren.data.continuousDay;
}
}
}
onReady(() => {
onReady(() => {
getData();
});
});
//
const handleCalendar = (type) => {
//
const handleCalendar = (type) => {
const cur_year = parseInt(state.cur_year);
const cur_month = parseInt(state.cur_month);
var newMonth;
@ -271,16 +291,16 @@ const handleCalendar = (type) => {
getData({
month: newYear + '-' + newMonth,
});
};
};
</script>
<style lang="scss" scoped>
.header-box {
.header-box {
border-top: 2rpx solid rgba(#dfdfdf, 0.5);
}
}
//
.calendar {
//
.calendar {
background: #fff;
.sign-everyday {
@ -359,9 +379,9 @@ const handleCalendar = (type) => {
color: rgba(51, 51, 51, 1);
}
}
}
}
.is-sign {
.is-sign {
width: 48rpx;
height: 48rpx;
position: relative;
@ -380,26 +400,26 @@ const handleCalendar = (type) => {
width: 48rpx;
height: 48rpx;
}
}
}
.cell-num {
.cell-num {
font-size: 24rpx;
font-family: OPPOSANS;
font-weight: 500;
color: #333333;
line-height: normal;
}
}
.cicon-title {
.cicon-title {
position: absolute;
right: -10rpx;
top: -6rpx;
font-size: 20rpx;
color: red;
}
}
//
.sign-box {
//
.sign-box {
height: 140rpx;
width: 100%;
@ -421,9 +441,9 @@ const handleCalendar = (type) => {
font-size: 30rpx;
font-weight: 500;
}
}
}
.model-box {
.model-box {
width: 520rpx;
// height: 590rpx;
background: linear-gradient(177deg, #ff6000 0%, #fe832a 100%);
@ -493,20 +513,20 @@ const handleCalendar = (type) => {
line-height: normal;
}
}
}
}
//
.activity-title {
//
.activity-title {
font-size: 32rpx;
font-weight: 500;
color: #333333;
line-height: normal;
}
}
.activity-des {
.activity-des {
font-size: 26rpx;
font-weight: 500;
color: #666666;
line-height: 40rpx;
}
}
</style>

View File

@ -34,7 +34,8 @@
<!-- 满减送/限时折扣活动的提示 TODO 芋艿promos 未写 -->
<div class="tag-content">
<view class="tag-box ss-flex">
<view class="tag ss-m-r-10" v-for="promos in state.goodsInfo.promos" :key="promos.id" @tap="onActivity">
<view class="tag ss-m-r-10" v-for="promos in state.goodsInfo.promos"
:key="promos.id" @tap="onActivity">
{{ promos.title }}
</view>
</view>
@ -101,12 +102,22 @@
</template>
<script setup>
import { reactive, computed } from 'vue';
import { onLoad, onPageScroll } from '@dcloudio/uni-app';
import {
reactive,
computed
} from 'vue';
import {
onLoad,
onPageScroll
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import CouponApi from '@/sheep/api/promotion/coupon';
import ActivityApi from '@/sheep/api/promotion/activity';
import { formatSales, formatGoodsSwiper, fen2yuan, } from '@/sheep/hooks/useGoods';
import {
formatSales,
formatGoodsSwiper,
fen2yuan,
} from '@/sheep/hooks/useGoods';
import detailNavbar from './components/detail/detail-navbar.vue';
import detailCellSku from './components/detail/detail-cell-sku.vue';
import detailCellService from './components/detail/detail-cell-service.vue';
@ -116,7 +127,9 @@
import detailCommentCard from './components/detail/detail-comment-card.vue';
import detailContentCard from './components/detail/detail-content-card.vue';
import detailActivityTip from './components/detail/detail-activity-tip.vue';
import { isEmpty } from 'lodash';
import {
isEmpty
} from 'lodash';
onPageScroll(() => {});
@ -193,8 +206,9 @@
}, {
type: 'goods', //
title: state.goodsInfo.name, //
image: sheep.$url.cdn(state.goodsInfo.image), //
price: state.goodsInfo.price[0], //
// image: sheep.$url.cdn(state.goodsInfo.image), //
image: sheep.$url.cdn(state.goodsInfo.picUrl), //
price: state.goodsInfo.price, //
original_price: state.goodsInfo.original_price, //
}, );
});
@ -219,7 +233,7 @@
});
// 2.
CouponApi.getCouponTemplateList(state.goodsId,2, 10).then((res) => {
CouponApi.getCouponTemplateList(state.goodsId, 2, 10).then((res) => {
if (res.code !== 0) {
return;
}

View File

@ -1,22 +1,12 @@
<template>
<s-layout
navbar="normal"
:leftWidth="0"
:rightWidth="0"
tools="search"
:defaultSearch="state.keyword"
@search="onSearch"
>
<s-layout navbar="normal" :leftWidth="0" :rightWidth="0" tools="search" :defaultSearch="state.keyword"
@search="onSearch">
<!-- 筛选 -->
<su-sticky bgColor="#fff">
<view class="ss-flex">
<view class="ss-flex-1">
<su-tabs
:list="state.tabList"
:scrollable="false"
@change="onTabsChange"
:current="state.currentTab"
></su-tabs>
<su-tabs :list="state.tabList" :scrollable="false" @change="onTabsChange"
:current="state.currentTab"></su-tabs>
</view>
<view class="list-icon" @tap="state.iconStatus = !state.iconStatus">
<text v-if="state.iconStatus" class="sicon-goods-list"></text>
@ -26,58 +16,29 @@
</su-sticky>
<!-- 弹窗 -->
<su-popup
:show="state.showFilter"
type="top"
round="10"
:space="sys_navBar + 38"
backgroundColor="#F6F6F6"
:zIndex="10"
@close="state.showFilter = false"
>
<su-popup :show="state.showFilter" type="top" round="10" :space="sys_navBar + 38" backgroundColor="#F6F6F6"
:zIndex="10" @close="state.showFilter = false">
<view class="filter-list-box">
<view
class="filter-item"
v-for="(item, index) in state.tabList[state.currentTab].list"
:key="item.value"
:class="[{ 'filter-item-active': index == state.curFilter }]"
@tap="onFilterItem(index)"
>
<view class="filter-item" v-for="(item, index) in state.tabList[state.currentTab].list"
:key="item.value" :class="[{ 'filter-item-active': index == state.curFilter }]"
@tap="onFilterItem(index)">
{{ item.label }}
</view>
</view>
</su-popup>
<view v-if="state.iconStatus && state.pagination.total > 0" class="goods-list ss-m-t-20">
<view
class="ss-p-l-20 ss-p-r-20 ss-m-b-20"
v-for="item in state.pagination.data"
:key="item.id"
>
<s-goods-column
class=""
size="lg"
:data="item"
:topRadius="10"
:bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
></s-goods-column>
<view class="ss-p-l-20 ss-p-r-20 ss-m-b-20" v-for="item in state.pagination.data" :key="item.id">
<s-goods-column class="" size="lg" :data="item" :topRadius="10" :bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"></s-goods-column>
</view>
</view>
<view
v-if="!state.iconStatus && state.pagination.total > 0"
class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top"
>
<view v-if="!state.iconStatus && state.pagination.total > 0"
class="ss-flex ss-flex-wrap ss-p-x-20 ss-m-t-20 ss-col-top">
<view class="goods-list-box">
<view class="left-list" v-for="item in state.leftGoodsList" :key="item.id">
<s-goods-column
class="goods-md-box"
size="md"
:data="item"
:topRadius="10"
:bottomRadius="10"
<s-goods-column class="goods-md-box" size="md" :data="item" :topRadius="10" :bottomRadius="10"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
@getHeight="mountMasonry($event, 'left')"
>
@getHeight="mountMasonry($event, 'left')">
<template v-slot:cart>
<button class="ss-reset-button cart-btn"> </button>
</template>
@ -86,15 +47,9 @@
</view>
<view class="goods-list-box">
<view class="right-list" v-for="item in state.rightGoodsList" :key="item.id">
<s-goods-column
class="goods-md-box"
size="md"
:topRadius="10"
:bottomRadius="10"
:data="item"
<s-goods-column class="goods-md-box" size="md" :topRadius="10" :bottomRadius="10" :data="item"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
@getHeight="mountMasonry($event, 'right')"
>
@getHeight="mountMasonry($event, 'right')">
<template v-slot:cart>
<button class="ss-reset-button cart-btn"> </button>
</template>
@ -102,22 +57,22 @@
</view>
</view>
</view>
<uni-load-more
v-if="state.pagination.total > 0"
:status="state.loadStatus"
:content-text="{
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
contentdown: '上拉加载更多',
}"
@tap="loadmore"
/>
}" @tap="loadmore" />
<s-empty v-if="state.pagination.total === 0" icon="/static/soldout-empty.png" text="暂无商品">
</s-empty>
</s-layout>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import {
reactive
} from 'vue';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import _ from 'lodash';
@ -145,12 +100,10 @@
showFilter: false,
iconStatus: false,
categoryId: 0,
tabList: [
{
tabList: [{
name: '综合推荐',
// value: '',
list: [
{
list: [{
label: '综合推荐',
// sort: '',
// order: true,
@ -169,6 +122,8 @@
},
{
name: '销量',
sort: 'salesCount',
order: false,
// value: 'salesCount',
},
{
@ -233,8 +188,8 @@
state.currentTab = e.index;
}
emptyList();
getList(e.value, state.currentOrder, state.categoryId, state.keyword);
console.log(e, '6666')
getList(e.sort, e.order, state.categoryId, state.keyword);
}
//
@ -262,9 +217,9 @@
sortField: Sort,
sortAsc: Order,
category_id: !keyword ? categoryId : '',
pageSize:list_rows,
pageSize: list_rows,
keyword: keyword,
pageNo:page,
pageNo: page,
});
if (res.code === 0) {
let couponList = _.concat(state.pagination.data, res.data.list);
@ -307,54 +262,68 @@
.goods-list-box {
width: 50%;
box-sizing: border-box;
.left-list {
margin-right: 10rpx;
margin-bottom: 20rpx;
}
.right-list {
margin-left: 10rpx;
margin-bottom: 20rpx;
}
}
.goods-box {
&:nth-last-of-type(1) {
margin-bottom: 0 !important;
}
&:nth-child(2n) {
margin-right: 0;
}
}
.list-icon {
width: 80rpx;
.sicon-goods-card {
font-size: 40rpx;
}
.sicon-goods-list {
font-size: 40rpx;
}
}
.goods-card {
margin-left: 20rpx;
}
.list-filter-tabs {
background-color: #fff;
}
.filter-list-box {
padding: 28rpx 52rpx;
.filter-item {
font-size: 28rpx;
font-weight: 500;
color: #333333;
line-height: normal;
margin-bottom: 24rpx;
&:nth-last-child(1) {
margin-bottom: 0;
}
}
.filter-item-active {
color: var(--ui-BG-Main);
}
}
.tab-item {
height: 50px;
position: relative;

View File

@ -17,15 +17,17 @@
<view class="input-label ss-m-b-50">充值金额</view>
<view class="input-box ss-flex border-bottom ss-p-b-20" v-if="state.data.custom_status">
<view class="unit"></view>
<uni-easyinput v-model="state.recharge_money" type="digit" placeholder="请输入充值金额" :inputBorder="false">
<uni-easyinput v-model="state.recharge_money" type="digit" placeholder="请输入充值金额"
:inputBorder="false">
</uni-easyinput>
</view>
<view class="face-value-box ss-flex ss-flex-wrap ss-m-y-40">
<button class="ss-reset-button face-value-btn" v-for="item in state.faceValueList" :key="item.money"
:class="[{ 'btn-active': state.recharge_money == parseFloat(item.money) }]" @tap="onCard(item.money)">
<text class="face-value-title">{{ item.money }}</text>
<view v-if="item.gift" class="face-value-tag">
{{ item.gift }}{{ state.data.gift_type == 'money' ? '元' : '积分' }}</view>
:class="[{ 'btn-active': state.recharge_money == parseFloat(item.money) }]"
@tap="onCard(item.payPrice/100)">
<text class="face-value-title">{{ item.payPrice/100 }}</text>
<view v-if="item.bonusPrice" class="face-value-tag">
{{ item.bonusPrice/100 }}{{ state.data.gift_type == 'money' ? '元' : '积分' }}</view>
</button>
</view>
<button class="ss-reset-button save-btn ui-BG-Main-Gradient ss-m-t-60 ui-Shadow-Main" @tap="onConfirm">
@ -38,61 +40,77 @@
</template>
<script setup>
import { computed, reactive } from 'vue';
import sheep from '@/sheep';
import { onLoad } from '@dcloudio/uni-app';
import {
computed,
reactive
} from 'vue';
import sheep from '@/sheep';
import {
onLoad
} from '@dcloudio/uni-app';
const userInfo = computed(() => sheep.$store('user').userInfo);
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const userInfo = computed(() => sheep.$store('user').userInfo);
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
const state = reactive({
const state = reactive({
recharge_money: '',
data: {},
faceValueList: [],
});
//
});
//
function onCard(e) {
function onCard(e) {
state.recharge_money = e;
}
async function getRechargeTabs() {
}
async function getRechargeTabs() {
const res = await sheep.$api.trade.rechargeRules();
const res2 = await sheep.$api.trade.rechargeRules2();
if (res.error === 0) {
state.data = res.data;
state.data.status = res.data.status;
state.faceValueList = res.data.quick_amounts;
console.log(res);
console.log(res2);
// state.faceValueList = res.data.quick_amounts;
state.faceValueList = res2.data;
}
}
}
function onChange(e) {
function onChange(e) {
state.data.gift_type = e.detail.value;
}
}
async function onConfirm() {
const { error, data } = await sheep.$api.trade.recharge({
recharge_money: state.recharge_money,
async function onConfirm() {
const {
code,
data
} = await sheep.$api.trade.recharge({
packageId: 0,
payPrice: state.recharge_money * 100
});
if (error === 0) {
if (code === 0) {
// #ifdef MP
sheep.$platform.useProvider('wechat').subscribeMessage('money_change');
// #endif
sheep.$router.go('/pages/pay/index', { orderSN: data.order_sn, type: 'recharge' });
sheep.$router.go('/pages/pay/index', {
orderSN: data.order_sn,
type: 'recharge'
});
}
}
onLoad(() => {
}
onLoad(() => {
getRechargeTabs();
});
});
</script>
<style lang="scss" scoped>
:deep() {
:deep() {
.uni-input-input {
font-family: OPPOSANS !important;
}
}
}
.wallet-num-box {
.wallet-num-box {
padding: 0 40rpx 80rpx;
background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
border-radius: 0 0 5% 5%;
@ -122,22 +140,22 @@ onLoad(() => {
font-weight: 500;
color: $white;
}
}
}
.recharge-box {
.recharge-box {
position: relative;
padding: 0 30rpx;
margin-top: -60rpx;
}
}
.save-btn {
.save-btn {
width: 620rpx;
height: 86rpx;
border-radius: 44rpx;
font-size: 30rpx;
}
}
.recharge-card-box {
.recharge-card-box {
width: 690rpx;
background: var(--ui-BG);
border-radius: 20rpx;
@ -246,5 +264,5 @@ onLoad(() => {
font-family: OPPOSANS;
}
}
}
}
</style>

View File

@ -101,6 +101,7 @@
},
);
const onRegionConfirm = (e) => {
console.log(e);
state.model = {
...state.model,
...e,
@ -186,7 +187,13 @@
if (options.data) {
let data = JSON.parse(options.data);
console.log(data)
const areaData = uni.getStorageSync('areaData');
let provinceArr = areaData.filter(item => item.name == data.province_name);
data.province_id = provinceArr[0].id;
let provinceArr2 = provinceArr[0].children.filter(item => item.name == data.city_name);
data.city_id = provinceArr2[0].id;
let provinceArr3 = provinceArr2[0].children.filter(item => item.name == data.district_name);
data.district_id = provinceArr3[0].id;
state.model = {
...state.model,
...data,

View File

@ -26,9 +26,14 @@ export default {
}),
signAdd: () =>
request({
url: 'activity/signin',
url: '/app-api/member/sign-in/record/create',
method: 'POST',
}),
// signAdd: () =>
// request({
// url: 'activity/signin',
// method: 'POST',
// }),
replenish: (data) =>
request({
url: 'activity/signin/replenish',
@ -40,4 +45,10 @@ export default {
url: 'activity/activity/' + id,
method: 'GET',
}),
getSummary: () =>
request({
url: '/app-api/member/sign-in/record/get-summary',
method: 'GET',
}),
};

View File

@ -28,9 +28,18 @@ export default {
showLoading: false,
},
}),
rechargeRules2: () =>
request({
url: '/app-api/pay/wallet-recharge-package/list',
method: 'GET',
custom: {
showError: false,
showLoading: false,
},
}),
recharge: (data) =>
request({
url: 'trade/order/recharge',
url: '/app-api/pay/wallet-recharge/create',
method: 'POST',
data,
}),

View File

@ -3,17 +3,14 @@
<view>
<su-popup :show="state.showShareGuide" :showClose="false" @close="onCloseGuide"></su-popup>
<view v-if="state.showShareGuide" class="guide-wrap">
<image
class="guide-image"
:src="sheep.$url.static('/static/img/shop/share/share_guide.png')"
></image>
<image class="guide-image" :src="sheep.$url.static('/static/img/shop/share/share_guide.png')"></image>
</view>
<su-popup :show="show" round="10" :showClose="false" @close="closeShareModal">
<!-- 分享tools -->
<view class="share-box">
<view class="share-list-box ss-flex">
<button
<!-- <button
v-if="shareConfig.methods.includes('forward')"
class="share-item share-btn ss-flex-col ss-col-center"
open-type="share"
@ -25,20 +22,14 @@
mode=""
></image>
<text class="share-title">微信好友</text>
</button>
<button
v-if="shareConfig.methods.includes('poster')"
class="share-item share-btn ss-flex-col ss-col-center"
@tap="onShareByPoster"
>
<image
class="share-img"
:src="sheep.$url.static('/static/img/shop/share/share_poster.png')"
mode=""
></image>
</button> -->
<button v-if="shareConfig.methods.includes('poster')"
class="share-item share-btn ss-flex-col ss-col-center" @tap="onShareByPoster">
<image class="share-img" :src="sheep.$url.static('/static/img/shop/share/share_poster.png')"
mode=""></image>
<text class="share-title">生成海报</text>
</button>
<!--
<button
v-if="shareConfig.methods.includes('link')"
class="share-item share-btn ss-flex-col ss-col-center"
@ -50,7 +41,7 @@
mode=""
></image>
<text class="share-title">复制链接</text>
</button>
</button> -->
</view>
<view class="share-foot ss-flex ss-row-center ss-col-center" @tap="closeShareModal">
取消
@ -58,22 +49,27 @@
</view>
</su-popup>
<!-- 分享海报 -->
<canvas-poster
ref="SharePosterRef"
:show="state.showPosterModal"
:shareInfo="shareInfo"
@close="state.showPosterModal = false"
/>
<canvas-poster ref="SharePosterRef" :show="state.showPosterModal" :shareInfo="shareInfo"
@close="state.showPosterModal = false" />
</view>
</template>
<script setup>
/**
* 分享弹窗
*/
import { ref, unref, reactive, computed } from 'vue';
import {
ref,
unref,
reactive,
computed
} from 'vue';
import sheep from '@/sheep';
import canvasPoster from './canvas-poster/index.vue';
import { showShareModal, closeShareModal, showAuthModal } from '@/sheep/hooks/useModal';
import {
showShareModal,
closeShareModal,
showAuthModal
} from '@/sheep/hooks/useModal';
const show = computed(() => sheep.$store('modal').share);
const shareConfig = computed(() => sheep.$store('app').platform.share);
@ -82,7 +78,7 @@
const props = defineProps({
shareInfo: {
type: Object,
default() {},
default () {},
},
});