新增老商城部分功能

This commit is contained in:
weipengfei 2024-02-26 13:35:08 +08:00
parent e9c745e84b
commit b8e676fa3b
62 changed files with 7410 additions and 36 deletions

View File

@ -2,13 +2,13 @@
"version" : "1",
"prompt" : "template",
"title" : "服务协议与隐私政策",
"message" : "\t <br/>\r\r\r
\t <a href=\"https://请修改为自己的域名/register.html\">《用户协议》</a> 与 <a href=\"https://请修改为自己的域名/protocol.html\">《隐私政策》</a>了解详细信息。如你同意,请点击“我同意”开始接受我们的服务。",
"message" : "\t <br/>\r\r\r\r
\t <a href=\"https://shop.lihaink.cn/register.html\">《用户协议》</a> 与 <a href=\"https://shop.lihaink.cn/protocol.html\">《隐私政策》</a>了解详细信息。如你同意,请点击“我同意”开始接受我们的服务。",
"buttonAccept" : "同意并接受",
"buttonRefuse" : "暂不同意",
"second" : {
"title" : "确认提示",
"message" : "进入应用前,你需先同意<a href=\"https://请修改为自己的域名/register.html\">《用户协议》</a> 与 <a href=\"https://请修改为自己的域名/protocol.html\">《隐私政策》</a>,否则将退出应用。",
"message" : "进入应用前,你需先同意<a href=\"https://shop.lihaink.cn/register.html\">《用户协议》</a> 与 <a href=\"https://shop.lihaink.cn/protocol.html\">《隐私政策》</a>,否则将退出应用。",
"buttonAccept" : "同意并继续",
"buttonRefuse" : "退出应用"
},

27
api/uniMP.js Normal file
View File

@ -0,0 +1,27 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from "@/utils/request.js";
/**
* 获取供销平台版本信息
*/
export function getGXconfig(data) {
return request.get("global/config", data);
}
/**
* 获取商城小程序信息
*/
export function miniapp(data) {
return request.get("miniapp/version?version=1", data);
}

View File

@ -0,0 +1,534 @@
<template>
<view>
<uni-popup ref="popupRef" type="bottom" @change="changeShow">
<view class="pop">
<scroll-view scroll-y class="scroll">
<view class="image">
<swiper class="swiper" :current="current" autoplay style="width: 100%;height: 100%;" @change="changeCurrent">
<block v-if="product.slider_image && product.slider_image.length>0">
<swiper-item v-for="(item,index) in product.slider_image" :key="index">
<image class="img" :src="item"></image>
</swiper-item>
</block>
<swiper-item v-else>
<image class="img" :src="datas.image||defualtImg"></image>
</swiper-item>
</swiper>
<view class="current">{{current+1}}/{{product.slider_image && product.slider_image.length||1}}</view>
<image class="close" src="@/static/images/icon/close.png" @click="close()"></image>
<view class="border"></view>
</view>
<view class="white_card">
<view class="flex flex_end">
<block v-if="datas.limited_price">
<view class="price"><text class="pro">{{leftPrice2}}.</text>{{rightPrice2}}
</view>
<view class="price" style="text-decoration: line-through;color: #999;font-weight: 400;font-size: 28rpx;">原价: <text>{{leftPrice}}.</text>{{rightPrice}}</view>
</block>
<view v-else class="price"><text>{{leftPrice}}.</text>{{rightPrice}}</view>
<!-- <view>订货价</view> -->
</view>
<view class="short_name">{{datas.store_name}}</view>
<view class="flex">
<view class="shop_name">
<image class="icon" src="@/static/images/icon/short.png"></image>
<view>{{datas.merchant.mer_name}}</view>
</view>
</view>
<u-line></u-line>
<block name="规格选中" v-for="(att, indexw) in attr" :key="indexw">
<view class="m_title">{{att.attr_name}}</view>
<view class="flex" style="flex-wrap: wrap;">
<view class="attr" :class="{'attr_active': item.check}"
v-for="(item, indexn) in att.attr_value" :key="indexn"
@click="changeAttr(indexw, indexn)">
{{item.attr}}
</view>
</view>
</block>
<view class="m_title num">
<view>购买数量</view>
<view class="input">
<view class="input_item sub" @click="subCartNum">-</view>
<input class="input_item input_view" v-model="cart_num" type="number" @input="inputCartNum" />
<view class="input_item plus" @click="plusCartNum">+</view>
</view>
</view>
<view>
商品库存 <text style="margin-left: 20rpx;">{{(sku[changeSkuKey] && sku[changeSkuKey].stock)||change.stock}}</text>
</view>
</view>
</scroll-view>
<view class="button">
<!-- <view class="b_icon" @click="navgoCart()">
<image src="@/static/images/icon/car.png"></image>
<view>购物车</view>
<view class="badge" v-if="goodsNum">{{goodsNum}}</view>
</view> -->
<view class="btn" @click.stop="$u.throttle(addcart, 1500)"> {{isBuy?'立即购买':'加入购物车'}} </view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {
postCartAdd,
getProductDetail
} from '@/api/store.js';
import { Toast } from '../libs/uniApi';
import { data } from '../uni_modules/uview-ui/libs/mixin/mixin';
export default {
name: "shortPopup",
props: {
source:{
type: Number,
default: null
},
isBuy: {
type: Boolean,
default: false
}
},
data() {
return {
isShow: false, //
defualtImg: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png',
datas: {
image: '',
store_name: '',
merchant: {
mer_name: ''
},
price: '',
},
product: {},
attrValue: [],
attr: [], //
changeSkuKey: '', //key
sku: {}, //
sku_key_list: [], //
changeSkuKey: '', //
change: {
stock: ''
},
cart_num: 1, //
goodsNum: 0, //
current: 0, //
};
},
mounted() {},
computed:{
leftPrice(){
return this.sku[this.changeSkuKey]?.price?.split('.')[0]||'0';
},
rightPrice(){
return this.sku[this.changeSkuKey]?.price?.split('.')[1]||'00';
},
leftPrice2(){
return this.datas.limited_price.split('.')[0]||'0';
},
rightPrice2(){
return this.datas.limited_price.split('.')[1]||'00';
}
},
methods: {
// ,
setDatas(datas, goodsNum) {
getProductDetail(datas.product_id).then((res)=>{
this.attr = res.data.attr;
if(this.attr.length>0) this.attr.forEach((item, index)=>{
this.changeAttr(index, 0);
})
else this.changeSkuKey = '';
})
this.goodsNum = goodsNum;
this.datas = datas;
this.product = datas.product;
this.attrValue = datas.product?.attrValue;
this.change = this.attrValue[0];
this.cart_num = 1;
this.sku = datas.sku||{};
this.sku_key_list = Object.keys(this.sku);
},
//
inputCartNum(e) {
if(this.sku){
if (+e.detail.value > this.sku[this.changeSkuKey].stock) {
uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
this.$nextTick(() => {
this.cart_num = this.sku[this.changeSkuKey].stock;
})
}
}else if (this.change.stock <= this.cart_num) {
uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
this.$nextTick(() => {
this.cart_num = this.change.stock;
})
}
},
//
subCartNum() {
if (this.cart_num <= 1) {
return uni.showToast({
icon: 'none',
title: '最少要买一件哦'
})
}
this.cart_num--;
},
//
plusCartNum() {
return Toast('最多购买一件哦');
if(this.sku){
if (this.sku[this.changeSkuKey].stock <= this.cart_num) {
return uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
}
}else if (this.change.stock <= this.cart_num) {
return uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
}
this.cart_num++;
},
changeAttr: function(indexw, indexn) {
let that = this;
this.$set(this.attr[indexw], 'index', this.attr[indexw].attr_values[indexn]);
this.attr[indexw].attr_value.forEach((item, index)=>{
if(index==indexn)item.check = true;
else item.check = false;
})
let value = that.getCheckedValue().join(",");
this.changeSkuKey = value;
},
//
getCheckedValue: function() {
let productAttr = this.attr;
let value = [];
for (let i = 0; i < productAttr.length; i++) {
for (let j = 0; j < productAttr[i].attr_values.length; j++) {
if (productAttr[i].index === productAttr[i].attr_values[j]) {
value.push(productAttr[i].attr_values[j]);
}
}
}
return value;
},
//
addcart() {
if (this.sku[this.changeSkuKey]) {
if (this.cart_num > this.sku[this.changeSkuKey].stock) return uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
let data = {
cart_num: this.cart_num,
is_new: 0,
product_attr_unique: this.sku[this.changeSkuKey].unique,
product_id: this.datas.product_id,
product_type: this.datas.product_type,
source: this.source,
spread_id: "",
}
let that = this
let res = postCartAdd({
...data
}).then((res, err) => {
if(this.isBuy) return uni.navigateTo({
url: `/pages/users/order_confirm/index?cartId=${res.data.cart_id}&type_id=${this.datas.merchant.type_id}&source=${this.source}`
});
uni.showToast({
title: "加入成功",
duration: 1000,
})
this.$emit('addCart');
this.close();
if(this.isBuy){
this.navgoCart();
}
}).catch(err => {
uni.showToast({
title: err,
icon: "none",
duration: 1000,
})
})
} else {
uni.showToast({
icon: 'none',
title: '商品规格不存在'
})
}
},
//
changeCurrent(e){
this.current = e.detail.current;
},
navgoCart(url=null) {
if(!url) {
if(this.source) url = '/pages/order_addcart/order_addcart?source='+this.source;
else url = '/pages/order_addcart/order_addcart';
}
uni.navigateTo({
url
})
},
open() {
this.$refs.popupRef.open();
},
close() {
this.$refs.popupRef.close();
},
changeShow(e) {
this.isShow = e.show;
}
}
}
</script>
<style lang="scss">
.pop {
background-color: #fff;
border-radius: 31.54rpx 31.54rpx 0rpx 0rpx;
overflow: hidden;
position: relative;
.scroll{
height: calc(90vh - 150rpx);
}
.flex_end {
align-items: flex-end;
}
.image {
height: 750rpx;
width: 750rpx;
position: relative;
.current{
position: absolute;
bottom: 70rpx;
left: 30rpx;
width: 67rpx;
height: 37rpx;
background: rgba(#333, 0.2);
border-radius: 11rpx 11rpx 11rpx 11rpx;
text-align: center;
color: #fff;
font-size: 26rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
}
.img {
width: 100%;
height: 100%;
border-radius: 31.54rpx 31.54rpx 0rpx 0rpx;
overflow: hidden;
}
.close {
position: absolute;
top: 30rpx;
right: 30rpx;
width: 50.82rpx;
height: 50.82rpx;
}
.border {
position: absolute;
bottom: -1rpx;
left: 0;
background-color: #fff;
height: 40rpx;
width: 100%;
border-radius: 40rpx 40rpx 0 0;
}
}
.white_card {
border-radius: 31.54rpx 31.54rpx 0rpx 0rpx;
background-color: #fff;
margin: 0 28rpx;
padding-bottom: 30rpx;
color: #737373;
font-size: 26.29rpx;
.price {
font-size: 35rpx;
font-family: SF Pro Display-Semibold, SF Pro Display;
font-weight: 600;
color: #F84221;
padding-right: 30rpx;
.pro {
font-size: 49.07rpx;
}
}
.short_name {
font-size: 33rpx;
font-family: PingFang SC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
}
.shop_name {
display: flex;
background: #FEF5F3;
padding: 0 16rpx;
border-radius: 26rpx 26rpx 26rpx 26rpx;
margin-top: 30rpx;
margin-bottom: 20rpx;
align-items: center;
.icon {
width: 31.54rpx;
height: 31.54rpx;
margin-right: 10rpx;
}
}
.m_title {
font-size: 30rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
margin-top: 31rpx;
margin-bottom: 21rpx;
}
.attr {
opacity: 1;
border: 1rpx solid #F84221;
color: #333333;
padding: 15rpx 30rpx;
margin-right: 20rpx;
height: 63rpx;
line-height: 60rpx;
border-radius: 63rpx;
display: flex;
align-items: center;
justify-content: center;
}
.attr_active{
// background-color: #FEF5F3;
// color: #F84221;
background-color: #F84221;
color: #fff;
}
.num {
display: flex;
justify-content: space-between;
align-items: center;
.input {
display: flex;
align-items: center;
height: 48rpx;
.input_item {
width: 44rpx;
height: 44rpx;
text-align: center;
line-height: 40rpx;
border: 2rpx solid #fff;
font-size: 26rpx;
color: #333;
}
.input_view {
width: 60rpx;
}
.sub {
border: 2rpx solid #FCB9AD;
border-radius: 7rpx 0rpx 0rpx 7rpx;
background: #FFFFFF;
font-size: 26rpx;
color: #B3B3B3;
}
.plus {
border: 2rpx solid #FCB9AD;
border-radius: 0rpx 7rpx 7rpx 0rpx;
background: #FFFFFF;
font-size: 26rpx;
color: #B3B3B3;
}
}
}
}
.button {
padding: 28rpx;
margin-bottom: 28rpx;
background-color: #fff;
display: flex;
justify-content: space-around;
padding-bottom: constant(safe-area-inset-bottom); /// IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); /// IOS>11.2/
padding-bottom: constant(safe-area-inset-bottom); /// IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); /// IOS>11.2/
.b_icon {
display: flex;
flex-direction: column;
align-items: center;
font-size: 19rpx;
font-weight: 400;
color: #333333;
position: relative;
image {
width: 50.82rpx;
height: 50.82rpx;
}
.badge {
position: absolute;
top: -5rpx;
right: -10rpx;
color: #fff;
min-width: 28rpx;
height: 28rpx;
text-align: center;
line-height: 24rpx;
background: #F84221;
border-radius: 16rpx 16rpx 16rpx 16rpx;
border: 2rpx solid #FFFFFF;
}
}
.btn {
width: 575rpx;
height: 84rpx;
background: linear-gradient(270deg, #FF6D20 0%, #F84221 100%);
border-radius: 42rpx 42rpx 42rpx 42rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
}
}
}
</style>

View File

@ -27,6 +27,9 @@
"iBeacon" : {},
"Maps" : {},
"Geolocation" : {},
"UniMP" : {
"description" : "uni小程序"
},
"Push" : {},
"Barcode" : {},
"Camera" : {}
@ -153,6 +156,134 @@
"useOriginalMsgbox" : true,
"androidStyle" : "default"
}
},
"nativePlugins" : {
"JG-JCore" : {
"JPUSH_APPKEY_IOS" : "8a5efd65cda14fafa6e64ad3",
"JPUSH_CHANNEL_IOS" : "8a5efd65cda14fafa6e64ad3",
"JPUSH_APPKEY_ANDROID" : "b5f679f4357018605ea6fd2e",
"JPUSH_CHANNEL_ANDROID" : "",
"__plugin_info__" : {
"name" : "JG-JCore",
"description" : "极光推送JCore插件",
"platforms" : "Android,iOS",
"url" : "",
"android_package_name" : "uni.UNI3A527D1",
"ios_bundle_id" : "",
"isCloud" : false,
"bought" : -1,
"pid" : "",
"parameters" : {
"JPUSH_APPKEY_IOS" : {
"des" : "[iOS]极光portal配置应用信息时分配的AppKey",
"key" : "JCore:APP_KEY",
"value" : "daebe19b547c43128796a078"
},
"JPUSH_CHANNEL_IOS" : {
"des" : "[iOS]用于统计分发渠道不需要可填默认值developer-default",
"key" : "JCore:CHANNEL",
"value" : ""
},
"JPUSH_APPKEY_ANDROID" : {
"des" : "[Android]极光portal配置应用信息时分配的AppKey",
"key" : "JPUSH_APPKEY",
"value" : ""
},
"JPUSH_CHANNEL_ANDROID" : {
"des" : "[Android]用于统计分发渠道不需要可填默认值developer-default",
"key" : "JPUSH_CHANNEL",
"value" : ""
}
}
}
},
"JG-JPush" : {
"JPUSH_ISPRODUCTION_IOS" : "true",
"JPUSH_ADVERTISINGID_IOS" : "",
"JPUSH_DEFAULTINITJPUSH_IOS" : "true",
"JPUSH_OPPO_APPKEY" : "",
"JPUSH_OPPO_APPID" : "",
"JPUSH_OPPO_APPSECRET" : "",
"JPUSH_VIVO_APPKEY" : "",
"JPUSH_VIVO_APPID" : "",
"JPUSH_MEIZU_APPKEY" : "",
"JPUSH_MEIZU_APPID" : "",
"JPUSH_XIAOMI_APPKEY" : "",
"JPUSH_XIAOMI_APPID" : "",
"__plugin_info__" : {
"name" : "JG-JPush",
"description" : "极光推送Hbuilder插件",
"platforms" : "Android,iOS",
"url" : "",
"android_package_name" : "uni.UNI3A527D1",
"ios_bundle_id" : "",
"isCloud" : false,
"bought" : -1,
"pid" : "",
"parameters" : {
"JPUSH_ISPRODUCTION_IOS" : {
"des" : "[iOS]是否是生产环境是填true不是填false或者不填",
"key" : "JPush:ISPRODUCTION",
"value" : ""
},
"JPUSH_ADVERTISINGID_IOS" : {
"des" : "[iOS]广告标识符IDFA如果不需要使用IDFA可不填",
"key" : "JPush:ADVERTISINGID",
"value" : ""
},
"JPUSH_DEFAULTINITJPUSH_IOS" : {
"des" : "[iOS]是否默认初始化是填true不是填false或者不填",
"key" : "JPush:DEFAULTINITJPUSH",
"value" : ""
},
"JPUSH_OPPO_APPKEY" : {
"des" : "厂商OPPO-appkey,示例OP-12345678",
"key" : "OPPO_APPKEY",
"value" : ""
},
"JPUSH_OPPO_APPID" : {
"des" : "厂商OPPO-appId,示例OP-12345678",
"key" : "OPPO_APPID",
"value" : ""
},
"JPUSH_OPPO_APPSECRET" : {
"des" : "厂商OPPO-appSecret,示例OP-12345678",
"key" : "OPPO_APPSECRET",
"value" : ""
},
"JPUSH_VIVO_APPKEY" : {
"des" : "厂商VIVO-appkey,示例12345678",
"key" : "com.vivo.push.api_key",
"value" : ""
},
"JPUSH_VIVO_APPID" : {
"des" : "厂商VIVO-appId,示例12345678",
"key" : "com.vivo.push.app_id",
"value" : ""
},
"JPUSH_MEIZU_APPKEY" : {
"des" : "厂商MEIZU-appKey,示例MZ-12345678",
"key" : "MEIZU_APPKEY",
"value" : ""
},
"JPUSH_MEIZU_APPID" : {
"des" : "厂商MEIZU-appId,示例MZ-12345678",
"key" : "MEIZU_APPID",
"value" : ""
},
"JPUSH_XIAOMI_APPKEY" : {
"des" : "厂商XIAOMI-appKey,示例MI-12345678",
"key" : "XIAOMI_APPKEY",
"value" : ""
},
"JPUSH_XIAOMI_APPID" : {
"des" : "厂商XIAOMI-appId,示例MI-12345678",
"key" : "XIAOMI_APPID",
"value" : ""
}
}
}
}
}
},
/* */

Binary file not shown.

View File

@ -0,0 +1,27 @@
//
// JGInforCollectionAuth.h
// JCore
//
// Created by 豆瓣 on 2021/10/27.
// Copyright © 2021 jiguang. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 合规接口,是否授权极光采集一定的设备信息
@interface JGInforCollectionAuthItems : NSObject
/// 是否授权默认YES
@property(nonatomic,assign)BOOL isAuth;
@end
@interface JGInforCollectionAuth : NSObject
/// 设备信息采集授权接口(合规接口)
/// 请务必在调用初始化、功能性接口前调用此接口进行合规授权
/// @param authBlock auth:YES 则极光认为您同意极光采集一定的设备信息
+(void)JCollectionAuth:(void(^_Nullable)(JGInforCollectionAuthItems *authInfo))authBlock;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,17 @@
//
// JCoreModule.h
// UniPluginJCore
//
// Created by huangshuni on 2021/1/21.
//
#import <Foundation/Foundation.h>
#import "DCUniModule.h"
NS_ASSUME_NONNULL_BEGIN
@interface JCoreModule : DCUniModule
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Headers/JCoreModule.h</key>
<data>
4aMcBALZuuQeh2JQjJqqvSkc2mA=
</data>
<key>Info.plist</key>
<data>
06+wBVr403G+lX5fr/4efqHMj2A=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/JCoreModule.h</key>
<dict>
<key>hash</key>
<data>
4aMcBALZuuQeh2JQjJqqvSkc2mA=
</data>
<key>hash2</key>
<data>
h/0w2CaU3JBhKI3Pp4EiSWqLf/ZY1Ju+5+tBAdowZ5k=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1,61 @@
{
"name": "JG-JCore",
"id": "JG-JCore",
"version": "1.1.3",
"description": "极光推送JCore插件",
"_dp_type":"nativeplugin",
"_dp_nativeplugin":{
"ios": {
"plugins": [
{
"type": "module",
"name": "JG-JCore",
"class": "JCoreModule"
}
],
"integrateType": "framework",
"deploymentTarget": "11.0",
"validArchitectures": [
"arm64"
],
"parameters": {
"JPUSH_APPKEY_IOS": {
"des": "[iOS]极光portal配置应用信息时分配的AppKey",
"key": "JCore:APP_KEY"
},
"JPUSH_CHANNEL_IOS": {
"des": "[iOS]用于统计分发渠道不需要可填默认值developer-default",
"key": "JCore:CHANNEL"
}
}
},
"android": {
"plugins": [
{
"type": "module",
"name": "JG-JCore",
"class": "cn.jiguang.uniplugin_jcore.JCoreModule"
}
],
"integrateType": "aar",
"minSdkVersion": "19",
"permissions": [
],
"abis": [
"armeabi-v7a",
"arm64-v8a",
"x86"
],
"parameters": {
"JPUSH_APPKEY_ANDROID": {
"des": "[Android]极光portal配置应用信息时分配的AppKey",
"key": "JPUSH_APPKEY"
},
"JPUSH_CHANNEL_ANDROID":{
"des": "[Android]用于统计分发渠道不需要可填默认值developer-default",
"key": "JPUSH_CHANNEL"
}
}
}
}
}

View File

@ -0,0 +1,798 @@
/*
* | | | | \ \ / / | | | | / _______|
* | |____| | \ \/ / | |____| | / /
* | |____| | \ / | |____| | | | _____
* | | | | / \ | | | | | | |____ |
* | | | | / /\ \ | | | | \ \______| |
* | | | | /_/ \_\ | | | | \_________|
*
* Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
*/
#define JPUSH_VERSION_NUMBER 3.4.0
#import <Foundation/Foundation.h>
@class CLRegion;
@class UILocalNotification;
@class CLLocation;
@class UNNotificationCategory;
@class UNNotificationSettings;
@class UNNotificationRequest;
@class UNNotification;
@protocol JPUSHRegisterDelegate;
@protocol JPUSHGeofenceDelegate;
@protocol JPushInMessageDelegate;
typedef void (^JPUSHTagsOperationCompletion)(NSInteger iResCode, NSSet *iTags, NSInteger seq);
typedef void (^JPUSHTagValidOperationCompletion)(NSInteger iResCode, NSSet *iTags, NSInteger seq, BOOL isBind);
typedef void (^JPUSHAliasOperationCompletion)(NSInteger iResCode, NSString *iAlias, NSInteger seq);
typedef void (^JPUSHInMssageCompletion)(NSInteger iResCode);
extern NSString *const kJPFNetworkIsConnectingNotification; // 正在连接中
extern NSString *const kJPFNetworkDidSetupNotification; // 建立连接
extern NSString *const kJPFNetworkDidCloseNotification; // 关闭连接
extern NSString *const kJPFNetworkDidRegisterNotification; // 注册成功
extern NSString *const kJPFNetworkFailedRegisterNotification; //注册失败
extern NSString *const kJPFNetworkDidLoginNotification; // 登录成功
extern NSString *const kJPFNetworkDidReceiveMessageNotification; // 收到消息(非APNS)
extern NSString *const kJPFServiceErrorNotification; // 错误提示
typedef NS_OPTIONS(NSUInteger, JPAuthorizationOptions) {
JPAuthorizationOptionNone = 0, // the application may not present any UI upon a notification being received
JPAuthorizationOptionBadge = (1 << 0), // the application may badge its icon upon a notification being received
JPAuthorizationOptionSound = (1 << 1), // the application may play a sound upon a notification being received
JPAuthorizationOptionAlert = (1 << 2), // the application may display an alert upon a notification being received
JPAuthorizationOptionCarPlay = (1 << 3), // The ability to display notifications in a CarPlay environment.
JPAuthorizationOptionCriticalAlert NS_AVAILABLE_IOS(12.0) = (1 << 4) , //The ability to play sounds for critical alerts.
JPAuthorizationOptionProvidesAppNotificationSettings NS_AVAILABLE_IOS(12.0) = (1 << 5) , //An option indicating the system should display a button for in-app notification settings.
JPAuthorizationOptionProvisional NS_AVAILABLE_IOS(12.0) = (1 << 6) , //The ability to post noninterrupting notifications provisionally to the Notification Center.
JPAuthorizationOptionAnnouncement NS_AVAILABLE_IOS(13.0) = (1 << 7) , //The ability for Siri to automatically read out messages over AirPods.
};
typedef NS_ENUM(NSUInteger, JPAuthorizationStatus) {
JPAuthorizationNotDetermined = 0, // The user has not yet made a choice regarding whether the application may post user notifications.
JPAuthorizationStatusDenied, // The application is not authorized to post user notifications.
JPAuthorizationStatusAuthorized, // The application is authorized to post user notifications.
JPAuthorizationStatusProvisional NS_AVAILABLE_IOS(12.0), // The application is authorized to post non-interruptive user notifications.
};
typedef NS_ENUM(NSInteger,JPushInMessageContentType){
JPushAdContentType = 1, //广告类型的inMessage
JPushNotiContentType = 2, //通知类型的inMessage
};
/*!
*
*/
@interface JPUSHRegisterEntity : NSObject
/*!
*
* badge,sound,alert
*/
@property (nonatomic, assign) NSInteger types;
/*!
*
* iOS10 UNNotificationCategory
* iOS8-iOS9 UIUserNotificationCategory
*/
@property (nonatomic, strong) NSSet *categories;
@end
/*!
*
*/
@interface JPushNotificationIdentifier : NSObject<NSCopying, NSCoding>
@property (nonatomic, copy) NSArray<NSString *> *identifiers; // 推送的标识数组
@property (nonatomic, copy) UILocalNotification *notificationObj NS_DEPRECATED_IOS(4_0, 10_0); // iOS10以下可以传UILocalNotification对象数据iOS10以上无效
@property (nonatomic, assign) BOOL delivered NS_AVAILABLE_IOS(10_0); // 在通知中心显示的或待推送的标志默认为NOYES表示在通知中心显示的NO表示待推送的
@property (nonatomic, copy) void (^findCompletionHandler)(NSArray *results); // 用于查询回调,调用[findNotification:]方法前必须设置results为返回相应对象数组iOS10以下返回UILocalNotification对象数组iOS10以上根据delivered传入值返回UNNotification或UNNotificationRequest对象数组delivered传入YES则返回UNNotification对象数组否则返回UNNotificationRequest对象数组
@end
/*!
*
* iOS10以上有效
*/
@interface JPushNotificationSound : NSObject <NSCopying, NSCoding>
@property (nonatomic, copy) NSString *soundName; //普通通知铃声
@property (nonatomic, copy) NSString *criticalSoundName NS_AVAILABLE_IOS(12.0); //警告通知铃声
@property (nonatomic, assign) float criticalSoundVolume NS_AVAILABLE_IOS(12.0); //警告通知铃声音量有效值在0~1之间默认为1
@end
/*!
*
*/
@interface JPushNotificationContent : NSObject<NSCopying, NSCoding>
@property (nonatomic, copy) NSString *title; // 推送标题
@property (nonatomic, copy) NSString *subtitle; // 推送副标题
@property (nonatomic, copy) NSString *body; // 推送内容
@property (nonatomic, copy) NSNumber *badge; // 角标的数字。如果不需要改变角标传@(-1)
@property (nonatomic, copy) NSString *action NS_DEPRECATED_IOS(8_0, 10_0); // 弹框的按钮显示的内容IOS 8默认为"打开", 其他默认为"启动",iOS10以上无效
@property (nonatomic, copy) NSString *categoryIdentifier; // 行为分类标识
@property (nonatomic, copy) NSDictionary *userInfo; // 本地推送时可以设置userInfo来增加附加信息远程推送时设置的payload推送内容作为此userInfo
@property (nonatomic, copy) NSString *sound; // 声音名称,不设置则为默认声音
@property (nonatomic, copy) JPushNotificationSound *soundSetting NS_AVAILABLE_IOS(10.0); //推送声音实体
@property (nonatomic, copy) NSArray *attachments NS_AVAILABLE_IOS(10_0); // 附件iOS10以上有效需要传入UNNotificationAttachment对象数组类型
@property (nonatomic, copy) NSString *threadIdentifier NS_AVAILABLE_IOS(10_0); // 线程或与推送请求相关对话的标识iOS10以上有效可用来对推送进行分组
@property (nonatomic, copy) NSString *launchImageName NS_AVAILABLE_IOS(10_0); // 启动图片名iOS10以上有效从推送启动时将会用到
@property (nonatomic, copy) NSString *summaryArgument NS_AVAILABLE_IOS(12.0); //插入到通知摘要中的部分参数。iOS12以上有效。
@property (nonatomic, assign) NSUInteger summaryArgumentCount NS_AVAILABLE_IOS(12.0); //插入到通知摘要中的项目数。iOS12以上有效。
@property (nonatomic, copy) NSString *targetContentIdentifier NS_AVAILABLE_IOS(13.0); // An identifier for the content of the notification used by the system to customize the scene to be activated when tapping on a notification.
@end
/*!
*
* dateComponentstimeIntervalregion在iOS10以上可选择其中一个参数传入有效值IIIIII使其中一种触发方式生效fireDate为iOS10以下根据时间触发时须传入的参数
*/
@interface JPushNotificationTrigger : NSObject<NSCopying, NSCoding>
@property (nonatomic, assign) BOOL repeat; // 设置是否重复默认为NO
@property (nonatomic, copy) NSDate *fireDate NS_DEPRECATED_IOS(2_0, 10_0); // 用来设置触发推送的时间iOS10以上无效
@property (nonatomic, copy) CLRegion *region NS_AVAILABLE_IOS(8_0); // 用来设置触发推送的位置iOS8以上有效iOS10以上优先级为I应用需要有允许使用定位的授权
@property (nonatomic, copy) NSDateComponents *dateComponents NS_AVAILABLE_IOS(10_0); // 用来设置触发推送的日期时间iOS10以上有效优先级为II
@property (nonatomic, assign) NSTimeInterval timeInterval NS_AVAILABLE_IOS(10_0); // 用来设置触发推送的时间iOS10以上有效优先级为III
@end
/*!
*
*/
@interface JPushNotificationRequest : NSObject<NSCopying, NSCoding>
@property (nonatomic, copy) NSString *requestIdentifier; // 推送请求标识
@property (nonatomic, copy) JPushNotificationContent *content; // 设置推送的具体内容
@property (nonatomic, copy) JPushNotificationTrigger *trigger; // 设置推送的触发方式
@property (nonatomic, copy) void (^completionHandler)(id result); // 注册或更新推送成功回调iOS10以上成功则result为UNNotificationRequest对象失败则result为nil;iOS10以下成功result为UILocalNotification对象失败则result为nil
@end
/*!
* JPush
*/
@interface JPUSHService : NSObject
///----------------------------------------------------
/// @name Setup 启动相关
///----------------------------------------------------
/*!
* @abstract SDK
*
* @param launchingOption .
* @param appKey JPush ,. JPush .
* @param channel . .
* @param isProduction . , NO; , YES.
* App profile provision的配置.
*
* @discussion SDK启动必须的参数, SDK.
* App , JPush SDK .
*/
+ (void)setupWithOption:(NSDictionary *)launchingOption
appKey:(NSString *)appKey
channel:(NSString *)channel
apsForProduction:(BOOL)isProduction;
/*!
* @abstract SDK
*
* @param launchingOption .
* @param appKey JPush ,. JPush .
* @param channel . .
* @param isProduction . , NO; , YES.
* App profile provision的配置.
* @param advertisingId 广IDFA 使IDFAnil.
*
* @discussion SDK启动必须的参数, SDK.
* App , JPush SDK .
*/
+ (void)setupWithOption:(NSDictionary *)launchingOption
appKey:(NSString *)appKey
channel:(NSString *)channel
apsForProduction:(BOOL)isProduction
advertisingIdentifier:(NSString *)advertisingId;
///----------------------------------------------------
/// @name APNs about 通知相关
///----------------------------------------------------
/*!
* @abstract
*
* @param types
* @param categories
*
*/
+ (void)registerForRemoteNotificationTypes:(NSUInteger)types
categories:(NSSet *)categories;
/*!
* @abstract iOS10
*
* @param config
* @param delegate
*
*/
+ (void)registerForRemoteNotificationConfig:(JPUSHRegisterEntity *)config delegate:(id<JPUSHRegisterDelegate>)delegate;
+ (void)registerDeviceToken:(NSData *)deviceToken;
/*!
* @abstract APNs
*/
+ (void)handleRemoteNotification:(NSDictionary *)remoteInfo;
/*!
* @abstract Token
*
* @param voipToken 使Voip Token
*/
+ (void)registerVoipToken:(NSData *)voipToken;
/*!
* @abstract Voip
*
* @param remoteInfo Voip
*/
+ (void)handleVoipNotification:(NSDictionary *)remoteInfo;
/*!
* @abstract
* @param completion status值返回JPAuthorizationStatus
*/
+ (void)requestNotificationAuthorization:(void (^)(JPAuthorizationStatus status))completion;
/*!
* @abstract iOS8及以上有效
*/
+ (void)openSettingsForNotification:(void (^)(BOOL success))completionHandler NS_AVAILABLE_IOS(8_0);
/*!
* Tags操作接口
* ////
* https://docs.jiguang.cn/jpush/client/iOS/ios_api/
*/
/**
tags
@param tags tags集合
@param completion
@param seq
*/
+ (void)addTags:(NSSet<NSString *> *)tags
completion:(JPUSHTagsOperationCompletion)completion
seq:(NSInteger)seq;
/**
tags
tags
@param tags tags集合
@param completion
@param seq
*/
+ (void)setTags:(NSSet<NSString *> *)tags
completion:(JPUSHTagsOperationCompletion)completion
seq:(NSInteger)seq;
/**
tags
@param tags tags集合
@param completion
@param seq
*/
+ (void)deleteTags:(NSSet<NSString *> *)tags
completion:(JPUSHTagsOperationCompletion)completion
seq:(NSInteger)seq;
/**
tags
@param completion
@param seq
*/
+ (void)cleanTags:(JPUSHTagsOperationCompletion)completion
seq:(NSInteger)seq;
/**
tags
@param completion
@param seq
*/
+ (void)getAllTags:(JPUSHTagsOperationCompletion)completion
seq:(NSInteger)seq;
/**
tag是否绑定
@param completion
@param seq
*/
+ (void)validTag:(NSString *)tag
completion:(JPUSHTagValidOperationCompletion)completion
seq:(NSInteger)seq;
/**
Alias
@param alias alias
@param completion
@param seq
*/
+ (void)setAlias:(NSString *)alias
completion:(JPUSHAliasOperationCompletion)completion
seq:(NSInteger)seq;
/**
alias
@param completion
@param seq
*/
+ (void)deleteAlias:(JPUSHAliasOperationCompletion)completion
seq:(NSInteger)seq;
/**
alias
@param completion
@param seq
*/
+ (void)getAlias:(JPUSHAliasOperationCompletion)completion
seq:(NSInteger)seq;
/*!
* @abstract tags
*
* @discussion tags , tags.
* tags . SDK .
*/
+ (NSSet *)filterValidTags:(NSSet *)tags;
///----------------------------------------------------
/// @name Stats 统计功能
///----------------------------------------------------
/*!
* @abstract
*
* @param pageName
* @discussion JCore 1.1.8 使 JAnalytics
*/
+ (void)startLogPageView:(NSString *)pageName __attribute__((deprecated("JCore 1.1.8 版本已过期")));
/*!
* @abstract
*
* @param pageName
* @discussion JCore 1.1.8 使 JAnalytics
*/
+ (void)stopLogPageView:(NSString *)pageName __attribute__((deprecated("JCore 1.1.8 版本已过期")));
/*!
* @abstract
*
* @param pageName
* @param seconds
* @discussion JCore 1.1.8 使 JAnalytics
*/
+ (void)beginLogPageView:(NSString *)pageName duration:(int)seconds __attribute__((deprecated("JCore 1.1.8 版本已过期")));
/*!
* @abstract Crash日志收集
*
* @discussion .
*/
+ (void)crashLogON;
/*!
* @abstract
*
* @param latitude .
* @param longitude .
*
*/
+ (void)setLatitude:(double)latitude longitude:(double)longitude;
/*!
* @abstract
*
* @param location CLLocation *
*
* @discussion CoreLocation.framework #import <CoreLocation/CoreLocation.h>
*/
+ (void)setLocation:(CLLocation *)location;
/**
10 iOS系统默认地理围栏最大个数为20
@param count count
*/
+ (void)setGeofenecMaxCount:(NSInteger)count;
/**
@param delegate
@param launchOptions app启动完成是收到的字段参数
*/
+ (void)registerLbsGeofenceDelegate:(id<JPUSHGeofenceDelegate>)delegate withLaunchOptions:(NSDictionary *)launchOptions;
/**
@param geofenceId id
*/
+ (void)removeGeofenceWithIdentifier:(NSString *)geofenceId;
///----------------------------------------------------
/// @name Local Notification 本地通知
///----------------------------------------------------
/*!
* @abstract (iOS10iOS10以下版本)
*
* JPush 2.1.9
* @param request JPushNotificationRequest类型request.requestIdentifier即更新已有的推送iOS10以上有效request.completionHandler返回
* @discussion 使
*
*/
+ (void)addNotification:(JPushNotificationRequest *)request;
/*!
* @abstract (iOS10iOS10以下版本)
*
* JPush 2.1.9
* @param identifier JPushNotificationIdentifier类型iOS10以上identifier设置为nilidentifier.delivered和identifier.identifiers来移除相应在通知中心显示推送或待推送请求identifier.identifiers如果设置为nil或空数组则移除相应标志下所有在通知中心显示推送或待推送请求iOS10以下identifier设置为nilidentifier.delivered属性无效identifier.notificationObj传入特定推送对象来移除此推送
* @discussion 使
*
*/
+ (void)removeNotification:(JPushNotificationIdentifier *)identifier;
/*!
* @abstract (iOS10iOS10以下版本)
*
* JPush 2.1.9
* @param identifier JPushNotificationIdentifier类型iOS10以上可以通过设置identifier.delivered和identifier.identifiers来查找相应在通知中心显示推送或待推送请求identifier.identifiers如果设置为nil或空数组则返回相应标志下所有在通知中心显示推送或待推送请求iOS10以下identifier.delivered属性无效identifier.identifiers如果设置nil或空数组则返回所有未触发的推送identifier.findCompletionHandler回调才能得到查找结果(NSArray *results)
* @discussion 使
*
*/
+ (void)findNotification:(JPushNotificationIdentifier *)identifier;
/*!
* @abstract 64
*
* @param fireDate
* @param alertBody
* @param badge -1
* @param alertAction IOS 8"打开", "启动"
* @param notificationKey
* @param userInfo
* @param soundName nil为默认声音
*
* @discussion 64 [addNotification:]
*/
+ (UILocalNotification *)setLocalNotification:(NSDate *)fireDate
alertBody:(NSString *)alertBody
badge:(int)badge
alertAction:(NSString *)alertAction
identifierKey:(NSString *)notificationKey
userInfo:(NSDictionary *)userInfo
soundName:(NSString *)soundName __attribute__((deprecated("JPush 2.1.9 版本已过期")));
/*!
* @abstract ( iOS8 )
*
* IOS8新参数
* @param region
* @param regionTriggersOnce
* @param category
* @discussion [addNotification:]
*/
+ (UILocalNotification *)setLocalNotification:(NSDate *)fireDate
alertBody:(NSString *)alertBody
badge:(int)badge
alertAction:(NSString *)alertAction
identifierKey:(NSString *)notificationKey
userInfo:(NSDictionary *)userInfo
soundName:(NSString *)soundName
region:(CLRegion *)region
regionTriggersOnce:(BOOL)regionTriggersOnce
category:(NSString *)category NS_AVAILABLE_IOS(8_0) __attribute__((deprecated("JPush 2.1.9 版本已过期")));
/*!
* @abstract
*
* @param notification
* @param notificationKey
*
* @discussion App在前台运行时不会进行弹窗--iOS10以下还可继续使用iOS10以上在[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:]completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);
*/
+ (void)showLocalNotificationAtFront:(UILocalNotification *)notification
identifierKey:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期")));
/*!
* @abstract
*
* @param notificationKey
* @discussion [removeNotification:]
*/
+ (void)deleteLocalNotificationWithIdentifierKey:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期")));
/*!
* @abstract
* @discussion [removeNotification:]
*/
+ (void)deleteLocalNotification:(UILocalNotification *)localNotification __attribute__((deprecated("JPush 2.1.9 版本已过期")));
/*!
* @abstract
*
* @param notificationKey
* @return , [array count]0
* @discussion [findNotification:]
*/
+ (NSArray *)findLocalNotificationWithIdentifier:(NSString *)notificationKey __attribute__((deprecated("JPush 2.1.9 版本已过期")));
/*!
* @abstract
* @discussion [removeNotification:]
*/
+ (void)clearAllLocalNotifications __attribute__((deprecated("JPush 2.1.9 版本已过期")));
///----------------------------------------------------
/// @name Server badge 服务器端 badge 功能
///----------------------------------------------------
/*!
* @abstract ()
*
* @param value . ()
*
* @discussion .
* UIApplication:setApplicationIconBadgeNumber .
*
* JPush .
* , APNs , , .
*
* JPush :
*
* - API () badge ;
* - API APNs (),
* 使 "+1" , badge () +1 badge ;
*/
+ (BOOL)setBadge:(NSInteger)value;
/*!
* @abstract (0)
*
* @discussion [setBadge:0] .
* [JPUSHService setBadge:] .
*/
+ (void)resetBadge;
///----------------------------------------------------
/// @name Other Feature 其他功能
///----------------------------------------------------
/*!
* @abstract ()
*
* @param mobileNumber .
* @param completion error为空error带有错误码及错误信息
*
* @discussion completion异步返回completion设置为nil不处理结果信息
*
*/
+ (void)setMobileNumber:(NSString *)mobileNumber completion:(void (^)(NSError *error))completion;
///----------------------------------------------------
/// @name Logs and others 日志与其他
///----------------------------------------------------
/*!
* @abstract JPush标识此设备的 registrationID
*
* @discussion SDK注册成功后, registrationID .
*
* JPush registrationID .
* , registrationID , , .
* registrationIDCompletionHandler:registrationID的方法block中获取registrationID,resCode为返回码,resCode返回1011,registrationID返回nil.
* JPush .
*/
+ (NSString *)registrationID;
+ (void)registrationIDCompletionHandler:(void(^)(int resCode,NSString *registrationID))completionHandler;
/*!
* @abstract Debug
*
* @discussion JMessage iOS Android .
* : Verbose, Debug, Info, Warning, Error.
* , Android .
*
* SDK : Info. , .
*
* SDK启动后调用本接口: Debug, .
*/
+ (void)setDebugMode;
/*!
* @abstract
*
* @discussion , [JPUSHService setDebugMode]
*
* , Warning, Error . , , .
*
* , , .
*/
+ (void)setLogOFF;
/*!
* @abstract SDK地理位置权限开关
*
* @discussion SDK地理围栏的相关功能将受到影响
*
*/
+ (void)setLocationEanable:(BOOL)isEanble;
/*!
* @abstract
*
* @discussion JPushInMessageDelegate的代理对象
*
*/
+ (void)setInMessageDelegate:(id<JPushInMessageDelegate>)inMessageDelegate;
/*!
* @abstract
*
* @discussion
*
*/
+ (void)pullInMessageCompletion:(JPUSHInMssageCompletion)completion;
///----------------------------------------------------
///********************下列方法已过期********************
///**************请使用新版tag/alias操作接口**************
///----------------------------------------------------
/// @name Tag alias setting 设置别名与标签
///----------------------------------------------------
/*!
*
* ()nilhttps://docs.jiguang.cn/jpush/client/iOS/ios_api/
* setTags:alias:fetchCompletionHandle:block里面处理设置结果即可.
* WARN: 使block时需要注意循环引用问题
*/
+ (void) setTags:(NSSet *)tags
alias:(NSString *)alias
callbackSelector:(SEL)cbSelector
target:(id)theTarget __attribute__((deprecated("JPush 2.1.1 版本已过期")));
+ (void) setTags:(NSSet *)tags
alias:(NSString *)alias
callbackSelector:(SEL)cbSelector
object:(id)theTarget __attribute__((deprecated("JPush 3.0.6 版本已过期")));
+ (void) setTags:(NSSet *)tags
callbackSelector:(SEL)cbSelector
object:(id)theTarget __attribute__((deprecated("JPush 3.0.6 版本已过期")));
+ (void)setTags:(NSSet *)tags
alias:(NSString *)alias
fetchCompletionHandle:(void (^)(int iResCode, NSSet *iTags, NSString *iAlias))completionHandler __attribute__((deprecated("JPush 3.0.6 版本已过期")));
+ (void) setTags:(NSSet *)tags
aliasInbackground:(NSString *)alias __attribute__((deprecated("JPush 3.0.6 版本已过期")));
+ (void)setAlias:(NSString *)alias
callbackSelector:(SEL)cbSelector
object:(id)theTarget __attribute__((deprecated("JPush 3.0.6 版本已过期")));
@end
@class UNUserNotificationCenter;
@class UNNotificationResponse;
@protocol JPUSHRegisterDelegate <NSObject>
/*
* @brief handle UserNotifications.framework [willPresentNotification:withCompletionHandler:]
* @param center [UNUserNotificationCenter currentNotificationCenter]
* @param notification
* @param completionHandler callback中的options 使UNNotificationPresentationOptions
*/
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger options))completionHandler;
/*
* @brief handle UserNotifications.framework [didReceiveNotificationResponse:withCompletionHandler:]
* @param center [UNUserNotificationCenter currentNotificationCenter]
* @param response
* @param completionHandler
*/
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler;
/*
* @brief handle UserNotifications.framework [openSettingsForNotification:]
* @param center [UNUserNotificationCenter currentNotificationCenter]
* @param notification
*/
- (void)jpushNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification NS_AVAILABLE_IOS(12.0);
/**
*
* @param status JPAuthorizationStatus
* @param info
*/
- (void)jpushNotificationAuthorization:(JPAuthorizationStatus)status withInfo:(NSDictionary *)info;
@end
@protocol JPUSHGeofenceDelegate <NSObject>
/**
@param geofenceId id
@param userInfo
@param error
*/
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didEnterRegion:(NSDictionary *)userInfo error:(NSError *)error;
/**
@param geofenceId id
@param userInfo
@param error
*/
- (void)jpushGeofenceIdentifer:(NSString *)geofenceId didExitRegion:(NSDictionary *)userInfo error:(NSError *)error;
@end
@protocol JPushInMessageDelegate <NSObject>
@optional
/**
*,
*/
- (BOOL)jPushInMessageIsAllowedInMessagePop;
/**
*
*/
- (void)jPushInMessageAlreadyPop __attribute__((deprecated("JPush 3.4.0 版本已过期")));;
/**
*
*/
- (void)jPushInMessageAlreadyDisappear;
/**
inMessage展示的回调
@param messageType inMessage
@param content 广
*/
- (void)jPushInMessageAlreadyPopInMessageType:(JPushInMessageContentType)messageType Content:(NSDictionary *)content;
/**
inMessage点击的回调
@param messageType inMessage
@param content 广
*/
- (void)jpushInMessagedidClickInMessageType:(JPushInMessageContentType)messageType Content:(NSDictionary *)content;
@end

View File

@ -0,0 +1,17 @@
//
// JPushModule.h
// UniPluginJPush
//
// Created by huangshuni on 2021/1/12.
//
#import <Foundation/Foundation.h>
#import "DCUniModule.h"
NS_ASSUME_NONNULL_BEGIN
@interface JPushModule : DCUniModule
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Headers/JPushModule.h</key>
<data>
hAItQbWWuw4mOOySo6FeWH3MYsA=
</data>
<key>Info.plist</key>
<data>
mdxdKDpLHqtEZTfNMy6MBCyizi8=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/JPushModule.h</key>
<dict>
<key>hash</key>
<data>
hAItQbWWuw4mOOySo6FeWH3MYsA=
</data>
<key>hash2</key>
<data>
LHaZ7SfsmEBYhVCf3bEBp8fHG5II1obOplOf4kj6EZQ=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1,138 @@
{
"name": "JG-JPush",
"id": "JG-JPush",
"version": "1.0.3",
"description": "极光推送Hbuilder插件",
"_dp_type":"nativeplugin",
"_dp_nativeplugin":{
"ios": {
"plugins": [{
"type": "module",
"name": "JG-JPush",
"class": "JPushModule"
}],
"hooksClass": "JPushProxy",
"integrateType": "framework",
"deploymentTarget": "9.0",
"frameworks": [
"CFNetwork.framework",
"CoreFoundation.framework",
"CoreTelephony.framework",
"SystemConfiguration.framework",
"CoreGraphics.framework",
"Foundation.framework",
"UIKit.framework",
"Security.framework",
"libz.tbd",
"AdSupport.framework",
"UserNotifications.framework",
"libresolv.tbd",
"WebKit.framework",
"AppTrackingTransparency.framework",
"StoreKit.framework"
],
"resources": [
],
"capabilities": {
"entitlements": {
"aps-environment":"development"
}
},
"privacies": [
"NSLocationAlwaysAndWhenInUseUsageDescription",
"NSLocationAlwaysUsageDescription",
"NSLocationWhenInUseUsageDescription"
],
"parameters": {
"JPUSH_ISPRODUCTION_IOS": {
"des": "[iOS]是否是生产环境是填true不是填false或者不填",
"key": "JPush:ISPRODUCTION"
},
"JPUSH_ADVERTISINGID_IOS": {
"des": "[iOS]广告标识符IDFA如果不需要使用IDFA可不填",
"key": "JPush:ADVERTISINGID"
},
"JPUSH_DEFAULTINITJPUSH_IOS": {
"des": "[iOS]是否默认初始化是填true不是填false或者不填",
"key": "JPush:DEFAULTINITJPUSH"
}
}
},
"android": {
"plugins": [
{
"type": "module",
"name": "JG-JPush",
"class": "cn.jiguang.uniplugin_jpush.JPushModule"
}
],
"integrateType": "aar",
"minSdkVersion": "19",
"permissions": [
"${applicationId}.permission.JPUSH_MESSAGE",
"android.permission.RECEIVE_USER_PRESENT",
"android.permission.INTERNET",
"android.permission.READ_PHONE_STATE",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.READ_EXTERNAL_STORAGE",
"android.permission.WRITE_SETTINGS",
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS",
"android.permission.ACCESS_NETWORK_STATE",
"android.permission.ACCESS_WIFI_STATE",
"com.huawei.android.launcher.permission.CHANGE_BADGE",
"android.permission.VIBRATE",
"android.permission.SYSTEM_ALERT_WINDOW",
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.CHANGE_WIFI_STATE",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.ACCESS_BACKGROUND_LOCATION",
"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS",
"android.permission.CHANGE_NETWORK_STATE",
"android.permission.GET_TASKS",
"android.permission.QUERY_ALL_PACKAGES",
"${applicationId}.permission.MIPUSH_RECEIVE",
"com.coloros.mcs.permission.RECIEVE_MCS_MESSAGE",
"com.heytap.mcs.permission.RECIEVE_MCS_MESSAGE"
],
"parameters": {
"JPUSH_OPPO_APPKEY": {
"des": "厂商OPPO-appkey,示例OP-12345678",
"key": "OPPO_APPKEY"
},
"JPUSH_OPPO_APPID":{
"des": "厂商OPPO-appId,示例OP-12345678",
"key": "OPPO_APPID"
},
"JPUSH_OPPO_APPSECRET":{
"des": "厂商OPPO-appSecret,示例OP-12345678",
"key": "OPPO_APPSECRET"
},
"JPUSH_VIVO_APPKEY":{
"des": "厂商VIVO-appkey,示例12345678",
"key": "com.vivo.push.api_key"
},
"JPUSH_VIVO_APPID":{
"des": "厂商VIVO-appId,示例12345678",
"key": "com.vivo.push.app_id"
},
"JPUSH_MEIZU_APPKEY":{
"des": "厂商MEIZU-appKey,示例MZ-12345678",
"key": "MEIZU_APPKEY"
},
"JPUSH_MEIZU_APPID":{
"des": "厂商MEIZU-appId,示例MZ-12345678",
"key": "MEIZU_APPID"
},
"JPUSH_XIAOMI_APPKEY":{
"des": "厂商XIAOMI-appKey,示例MI-12345678",
"key": "XIAOMI_APPKEY"
},
"JPUSH_XIAOMI_APPID":{
"des": "厂商XIAOMI-appId,示例MI-12345678",
"key": "XIAOMI_APPID"
}
}
}
}
}

View File

@ -1,7 +1,4 @@
{
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/guide/index",
@ -148,7 +145,95 @@
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
}
},
{
"path" : "pages/redpacket/redpacket",
"style" :
{
"navigationBarTitleText" : "补贴",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/redpacket/redpack_type",
"style" :
{
"navigationBarTitleText" : "补贴余额",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
},
{
"path" : "pages/newActivity/subsidy/subsidy2",
"style" :
{
"navigationBarTitleText" : "实物通用补贴",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
},
{
"path" : "pages/newActivity/subsidy/subsidy3",
"style" :
{
"navigationBarTitleText" : "现金抵扣补贴",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
},
{
"path" : "pages/newActivity/towPrice/towPrice",
"style" :
{
"navigationBarTitleText" : "两元专区",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
},
{
"path" : "pages/newActivity/giftBag/giftBag",
"style" :
{
"navigationBarTitleText" : "新人礼包",
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
},
{
"path" : "pages/newActivity/activityDetail/activityDetail",
"style" :
{
"navigationBarTitleText": "活动",
"enablePullDownRefresh": true,
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
},
{
"path" : "pages/newActivity/subsidy/subsidy",
"style" :
{
"navigationBarTitleText": "补贴记录",
"enablePullDownRefresh": true,
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
},
{
"path" : "pages/newActivity/invitation/invitation",
"style" :
{
"navigationBarTitleText": "拉新活动",
"enablePullDownRefresh": true,
"navigationStyle": "custom",
"onReachBottomDistance": 300
}
}
],
"subPackages": [{
"root": "pages/cloud_warehouse",
@ -446,6 +531,12 @@
"navigationBarTitleText": "申请退货"
}
},
{
"path": "invite_code/index",
"style": {
"navigationBarTitleText": "邀请码"
}
},
{
"path": "login/login_copy",
"style": {
@ -636,7 +727,14 @@
"style": {
"navigationBarTitleText": "商家入驻"
}
}, {
},
{
"path": "settled/unit",
"style": {
"navigationBarTitleText": "种养殖户入驻"
}
},
{
"path": "applicationRecord/index",
"style": {
"navigationBarTitleText": "申请记录"
@ -1363,8 +1461,8 @@
// },
{
"pagePath": "pages/gather/gather",
"iconPath": "static/images/5-001.png",
"selectedIconPath": "static/images/5-002.png",
"iconPath": "static/images/2-001.png",
"selectedIconPath": "static/images/2-002.png",
"text": "工作台"
},
{

View File

@ -40,13 +40,10 @@
</u-transition>
</view>
</view>
<Loading></Loading>
</view>
</template>
<script>
import Cache from '@/utils/cache';
import { wgsToGcj } from "@/utils/wgs.js";
import {
mapState,
mapGetters
@ -55,23 +52,12 @@
getStoreList,
getUserInfo
} from '@/api/user.js'
import {
getGeocoder,
microSeachBarCode,
microEadtProduct
} from '@/api/store.js'
import {
Toast
} from '@/libs/uniApi';
import {
getDiy
} from '@/api/api.js';
import {
applet
} from '@/api/public.js';
import {
ENV
} from "@/config/app.js"
// #ifdef APP-PLUS
import uniMP from '@/utils/uniMP.js';
// #endif
@ -112,17 +98,16 @@
onLoad() {
},
onShow() {
if (this.isLogin) {
this.emptyText = '暂无可用应用'
this.jurisdiction = false
this.initAllAppLet();
} else {
this.emptyText = '请登录'
this.jurisdiction = true
}
this.getUserInfo();
// if (this.isLogin) {
// this.emptyText = ''
// this.jurisdiction = false
// this.initAllAppLet();
// } else {
// this.emptyText = ''
// this.jurisdiction = true
// }
// this.getUserInfo();
},
onPullDownRefresh() {
this.getUserInfo()
uni.stopPullDownRefresh()
@ -442,7 +427,7 @@
.special_work {
// padding: 17.54rpx;
width: 694.74rpx;
margin-top: 52.63rpx;
padding-top: 30rpx;
border-radius: 17.54rpx;
// box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.16);

View File

@ -0,0 +1,195 @@
<template>
<view>
<view class="bg">
<image class="bg_img" mode="widthFix"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/detail.webp"></image>
<image @click="back" class="bg_back"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="b_body">
<view class="b_content">
<view v-if="info.content" v-html="info.content.content"></view>
</view>
</view>
</view>
<view class="btn_box">
<image v-if="show_a1" @click="changeA(show_a1)" class="btn_image" mode="widthFix"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/detail_btn1.webp"></image>
<image v-if="show_a2" @click="changeA(show_a2)" class="btn_image" mode="widthFix"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/detail_btn2.webp"></image>
</view>
<u-modal :show="show" :closeOnClickOverlay="true" :title="`[${activity.title}]`"
content="选择活动后只有完成活动任务后才可参加另一个活动, 确定要参与这个活动吗" cancelText="我再想想" confirmText="参加活动" confirmColor="#e54841"
@cancel="show = false" @confirm="joinA()" showCancelButton></u-modal>
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"
:isGoIndex="false"></authorize>
</view>
</template>
<script>
import { consumption, chooseConsumption } from "@/api/activity.js"
import { getArticleList } from "@/api/api.js"
import { Toast } from "../../../libs/uniApi";
import authorize from "@/components/Authorize.vue";
import { getUserInfo } from '@/api/user.js';
export default {
components: {
authorize
},
data() {
return {
info: {},
userInfo: {},
Alist: [],
activity: {
title: ''
},
show: false,
isAuto: false, //
isShowAuth: false, //
is_join_activity: 0, //
}
},
onLoad() {
this.getArticleList();
this.is_join_activity = uni.getStorageSync('is_join_activity');
},
onShow() {
this.getUserInfo();
this.consumption();
},
computed: {
show_a1() { //
return this.Alist.find(item => item.title == '用户消费补贴活动')
},
show_a2() { //
return this.Alist.find(item => item.title == '用户推荐拉新活动')
}
},
methods: {
consumption() {
consumption().then(res => {
this.Alist = res.data;
})
},
back() {
uni.navigateBack()
},
changeA(item) {
if (!this.userInfo.account) return this.openAuto();
this.activity = item;
if (this.is_join_activity) return this.joinA();
this.show = true;
},
getArticleList() {
getArticleList(25).then(res => {
this.info = res.data.list[0]
})
},
//
joinA() {
chooseConsumption({
coupon_id: this.activity.coupon_id,
activity_id: 1, //1
}).then(res => {
this.show = false;
let url = '';
if (this.activity.title == '用户消费补贴活动') url = "/pages/redpacket/redpack_type?type=1";
if (this.activity.title == '用户推荐拉新活动') url = "/pages/newActivity/invitation/invitation";
if (url) uni.navigateTo({
url: url
})
}).catch(err => {
this.show = false;
this.$nextTick(() => {
Toast('您正在参与活动,暂时不支持切换');
})
})
uni.setStorageSync('is_join_activity', 1);
this.is_join_activity = 1;
},
getUserInfo() {
getUserInfo().then(res => {
this.userInfo = res.data;
}).catch(err => {
console.log(err);
})
},
//
onLoadFun(data) {
this.getUserInfo();
this.isShowAuth = false;
},
//
openAuto() {
// console.log('hajhcdsohjcosvjco')
this.isAuto = true;
this.isShowAuth = true
},
//
authColse: function(e) {
this.isShowAuth = e
},
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page {
background-color: #fff5dd;
}
.bg {
position: relative;
padding-bottom: 300rpx;
.bg_img {
width: 750rpx;
height: 652rpx;
position: absolute;
top: 0;
left: 0;
}
.bg_back {
height: 34rpx;
width: 20rpx;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 30rpx;
}
.b_body {
width: 710rpx;
margin-left: 21rpx;
margin-right: 19rpx;
height: auto;
background-color: #fff;
border-radius: 0 0 60rpx 60rpx;
padding: 28rpx;
padding-top: 680rpx;
margin-bottom: 30rpx;
.b_content {
width: 100%;
// height: 800rpx;
// background-color: #eee;
}
}
}
.btn_box {
position: fixed;
bottom: 30rpx;
left: 50%;
transform: translate(-50%);
width: 710rpx;
.btn_image {
width: 100%;
}
}
</style>

View File

@ -0,0 +1,900 @@
<template>
<view class="m_body">
<view class="bg">
<view class="bg_box">
<image class="bg_img" mode="widthFix"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/recharge.webp"></image>
<view class="bg_border"></view>
</view>
<image @click="back" class="bg_back"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="body_card">
<view class="card1">
<view class="change_list">
<view class="change_item" @click="changeItem(item, index)"
v-for="(item, index) in changeList" :key="index">
<image class="item_pic" :src="item.pic"></image>
<view class="item_content">
<view class="top_left"><text class="c_icon">¥</text> <text class="c_content">{{item.count}}</text></view>
<view class="top_right">
<text>数量: </text>
<view @click="reduce(item)">- </view>
<view style="width: 80rpx;">{{item.num}} </view>
<view @click="append(item)">+ </view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="a_tips">
<view>礼包说明</view>
<view>购买1000-4999元礼包补贴对应金额5%的现金抵扣补贴</view>
<view>购买5000-9999元礼包补贴对应金额10%的现金抵扣补贴</view>
<view>购买10000-49999元礼包补贴对应金额15%的现金抵扣补贴</view>
<view>购买50000-100000元礼包补贴对应金额20%的现金抵扣补贴</view>
</view>
</view>
<view class="footer">
<view class="f_tip">
总计购买礼包金额:
<view class="price">
<text>{{total}}</text>
</view>
</view>
<view class="primary_btn" @click="$u.throttle(submitSub, 1500)">立即购买</view>
</view>
<uni-popup ref="redTipsRef">
<view class="ref_ref">
<view class="ref_top">
购买礼包金额达到
<text v-if="red_type==0">1000-4999</text>
<text v-if="red_type==1">5000-9999</text>
<text v-if="red_type==2">10000-49999</text>
<text v-if="red_type==3">50000-100000</text>
</view>
<view class="ref_center">
赠送补贴变为
</view>
<view class="ref_bottom">
<view class="bottom_item" style="width: 100%;">
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/re_redpacket.webp"></image>
<view class="text">{{tipType[red_type].red1}}</view>
</view>
</view>
</view>
</uni-popup>
<payment :payMode="payMode" :order_id="rechar_id" :pay_close="pay_close" :is-call="true" @onChangeFun="onChangeFun"
:totalPrice="totalPrice"></payment>
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
</view>
</template>
<script>
import { getCommissionInfo } from "@/api/user.js"
import { Toast } from "../../../libs/uniApi";
import {
mapGetters
} from "vuex";
import {
getUserInfo,
spreadInfo,
rechargeWechat
} from '@/api/user.js';
import authorize from '@/components/Authorize';
import payment from '@/components/payment';
export default {
components: {
authorize,
payment
},
data() {
return {
userInfo: {},
curNow: 0,
list1: [{
name: '余额购买'
}, {
name: '购买记录'
}],
changeList: [
{
count: 100, //
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/a_re_item5.webp',
num: 0, //
},
{
count: 200,
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/a_re_item6.webp',
num: 0, //
},
{
count: 500,
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/a_re_item7.webp',
num: 0, //
},
{
count: 1000,
pic: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/a_re_item8.webp',
num: 0, //
}
],
nowChange: 0,
nowPrice: 0,
priceCount: 1,
isAuto: false, //
isShowAuth: false, //
recordList: [],
tipType: [
{
red1: '5%的现金抵扣补贴',
},
{
red1: '10%的现金抵扣补贴',
},
{
red1: '15%的现金抵扣补贴',
},
{
red1: '20%的现金抵扣补贴',
},
{
red1: '',
},
],
red_type: 4,
where: {
page: 1,
limit: 15,
type: 2
},
otherValue: '其他',
now_money: 0,
navRecharge: ['账户购买', '佣金转入'],
active: 0,
number: '',
from: '',
placeholder: "0.00",
picList: [],
activePic: 0,
money: "",
numberPic: '',
rechar_id: '0',
rechargeAttention: [],
pay_close: false,
totalPrice: '0',
payMode: [{
name: '微信支付',
icon: 'icon-weixinzhifu',
// #ifdef H5
value: 'h5',
// #endif
// #ifdef MP
value: 'routine',
// #endif
// #ifdef APP-PLUS
value: 'weixin',
// #endif
title: '微信快捷支付',
payStatus: true
}],
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo()
} else {
this.isAuto = true;
this.isShowAuth = true
}
},
onShow() {
},
computed: {
...mapGetters(['isLogin', 'viewColor', 'keyColor']),
total() {
return this.changeList.reduce((t, obj)=>{
return t + (obj.count * obj.num);
}, 0);
}
},
onReachBottom() {
this.getCommissionInfo();
},
methods: {
back(){
uni.navigateBack();
},
clickTab1(e) {
this.curNow = e.index;
if (e.index == 1) {
this.recordList = [];
this.where.page = 1;
this.getCommissionInfo();
}
},
changeItem(e, index) {
this.nowPrice = e;
this.nowChange = index;
if (this.priceCount * this.nowPrice > 100000) {
this.priceCount = Math.floor(100000 / this.nowPrice);
return Toast('不可超过10万元');
}
},
append(item) {
if(this.total + item.count >=0 && this.total + item.count <1000) this.red_type = 4;
else if(this.total + item.count >=1000 && this.total + item.count <=4999 && this.red_type != 0){
this.red_type = 0;
this.$refs.redTipsRef.open();
}else if(this.total + item.count >=5000 && this.total + item.count <=9999 && this.red_type != 1){
this.red_type = 1;
this.$refs.redTipsRef.open();
}else if(this.total + item.count >=10000 && this.total + item.count <=49999 && this.red_type != 2){
this.red_type = 2;
this.$refs.redTipsRef.open();
}else if(this.total + item.count >=50000 && this.total + item.count <=100000 && this.red_type != 3){
this.red_type = 3;
this.$refs.redTipsRef.open();
}
if (this.total + item.count > 100000 || this.total>=100000) {
return Toast('不可超过10万元');
} else item.num++;
},
reduce(item) {
if(this.total - item.count >=0 && this.total - item.count <1000) this.red_type = 4;
else if(this.total - item.count >=1000 && this.total - item.count <=4999 && this.red_type != 0){
this.red_type = 0;
this.$refs.redTipsRef.open();
}else if(this.total - item.count >=5000 && this.total - item.count <=9999 && this.red_type != 1){
this.red_type = 1;
this.$refs.redTipsRef.open();
}else if(this.total - item.count >=10000 && this.total - item.count <=49999 && this.red_type != 2){
this.red_type = 2;
this.$refs.redTipsRef.open();
}else if(this.total - item.count >=50000 && this.total - item.count <=100000 && this.red_type != 3){
this.red_type = 3;
this.$refs.redTipsRef.open();
}
if (this.total==0||item.num==0) return Toast('不能再少啦');
else item.num--;
},
getCommissionInfo() {
getCommissionInfo(this.where).then((res) => {
if (res.data.list.length > 0) {
this.recordList = [...this.recordList, ...res.data.list];
if (res.data.list.length >= 15) this.where.page++;
}
})
},
/**
* 选择金额
*/
picCharge(idx, item) {
this.activePic = idx;
if (item === undefined) {
this.rechar_id = '0';
this.numberPic = "";
this.otherValue = ''
} else {
this.otherValue = '其他'
this.total = "";
this.rechar_id = item.id.toString();
this.numberPic = item.data.price;
}
},
/**
* 购买额度选择
*/
getRecharge() {
getRechargeApi()
.then(res => {
this.picList = res.data.recharge_quota;
if (this.picList[0]) {
this.rechar_id = this.picList[0].id.toString();
this.numberPic = this.picList[0].data.price;
}
this.rechargeAttention = res.data.recharge_attention || [];
})
.catch(res => {
this.$dialog.toast({
mes: res
});
});
},
onLoadFun: function() {
this.isShowAuth = false;
this.getUserInfo();
this.getRecharge();
},
//
authColse: function(e) {
this.isShowAuth = e
},
navRecharges: function(index) {
this.active = index;
},
/**
* 获取用户信息
*/
getUserInfo: function() {
let that = this;
spreadInfo().then(res => {
that.$set(that, 'userInfo', res.data);
})
},
payClose: function() {
this.pay_close = false;
},
payCheck: function(type) {
this.createOrder(type);
},
/*
* 用户购买
*/
submitSub: function(e) {
let that = this
let value = this.total;
//
if (that.active) {
if (parseFloat(value) < 0 || parseFloat(value) == NaN || value == undefined || value == "") {
return that.$util.Tips({
title: '请输入金额'
});
}
uni.showModal({
title: '转入余额',
content: '转入余额后无法再次转出,确认是否转入余额',
success(res) {
if (res.confirm) {
rechargeBrokerage({
brokerage: parseFloat(value),
}).then(res => {
// that.$set(that, 'userInfo.now_money', that.$util.$h.Add(value, that.userInfo.now_money))
uni.showToast({
icon: 'success',
title: '转入成功'
})
// return that.$util.Tips({
// title: '',
// icon: 'success'
// }, {
// tab: 5,
// url: '/pages/users/user_money/index'
// });
}).catch(err => {
return that.$util.Tips({
title: err
})
});
} else if (res.cancel) {
return that.$util.Tips({
title: '已取消'
});
}
},
})
} else {
if (this.rechar_id == 0) {
if (parseFloat(that.total) === 0) {
return that.$util.Tips({
title: '购买金额金额不能为0'
});
}
if (!that.total) {
return that.$util.Tips({
title: '请填写购买金额!'
});
}
if (!Number(that.total)) {
return that.$util.Tips({
title: '请填写正确的金额!'
});
}
}
this.pay_close = true
}
},
createOrder(type) {
let that = this;
let query = {
price: that.rechar_id == 0 ? that.total : that.numberPic,
recharge_id: that.rechar_id,
type: type,
// #ifdef H5
return_url: location.port ? location.protocol + '//' + location.hostname + ':' + location.port +
'/pages/users/user_money/money' : location.protocol + '//' + location.hostname +
'/pages/users/user_money/money'
// #endif
};
// #ifdef MP
// openPaySubscribe().then(() => {
rechargeWechat(query).then(res => {
that.callPay(res);
}).catch(err => {
uni.showToast({
title: err,
icon: 'none'
});
});
// });
// #endif
// #ifndef MP
rechargeWechat(query).then(res => {
console.log('res', res);
that.callPay(res);
}).catch(err => {
console.log('err', err);
uni.showToast({
title: err,
icon: 'none'
});
});
// #endif
},
//
callPay(res) {
let that = this,
status = res.data.type,
orderId = res.data.recharge_id,
callback_key = res.data.pay_key,
jsConfig = res.data.config,
goPages = '/pages/users/user_money/money';
switch (status) {
case 'ORDER_EXIST':
case 'EXTEND_ORDER':
case 'PAY_ERROR':
case 'error':
uni.hideLoading();
Toast(res.message)
// return that.$util.Tips({
// title: res.message
// }, {
// tab: 5,
// url: goPages
// });
break;
case 'success':
uni.hideLoading();
uni.showToast({
icon: 'success',
title: res.message
})
// if (that.seckillId)
// return that.$util.Tips({
// title: res.message,
// icon: 'success'
// }, {
// tab: 4,
// url: goPages
// });
// return that.$util.Tips({
// title: res.message,
// icon: 'success'
// }, {
// tab: 5,
// url: goPages
// });
break;
case 'alipay':
case "alipayQr":
uni.hideLoading();
that.$emit('onChangeFun', {
action: 'payClose'
});
uni.navigateTo({
url: '/pages/order_pay_back/index?keyCode=' + callback_key + '&url=' + jsConfig + '&type=10'
})
return;
break;
// #ifndef MP
case "wechat":
case "weixin":
case "weixinApp":
jsConfig.timeStamp = jsConfig.timestamp;
// #ifndef APP-PLUS
that.$wechat.pay(jsConfig).then(res => {
uni.showToast({
icon: 'success',
title: res.message
})
// return that.$util.Tips({
// title: res.message,
// icon: 'success'
// }, {
// tab: 4,
// url: goPages
// });
}).catch(res => {
uni.showToast({
icon: 'success',
title: '取消支付'
})
// if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
// title: ''
// }, {
// tab: 5,
// url: goPages
// });
})
// #endif
// #ifdef APP-PLUS
let mp_pay_name = ''
if (uni.requestOrderPayment) {
mp_pay_name = 'requestOrderPayment'
} else {
mp_pay_name = 'requestPayment'
}
uni[mp_pay_name]({
provider: 'wxpay',
orderInfo: jsConfig,
success: (e) => {
this.getUserInfo()
uni.showToast({
icon: 'success',
title: '支付成功'
})
// let url = '/pages/users/user_money/money';
// return that.$util.Tips({
// title: '',
// icon: 'success'
// }, {
// tab: 4,
// url: url
// });
},
fail: (e) => {
console.log(e);
uni.showModal({
content: "支付失败",
showCancel: false,
success: function(res) {
}
})
},
complete: () => {
uni.hideLoading();
},
});
// #endif
break;
// #endif
// #ifdef MP
case "routine":
jsConfig.timeStamp = jsConfig.timestamp;
let mp_pay_name = ''
if (uni.requestOrderPayment) {
mp_pay_name = 'requestOrderPayment'
} else {
mp_pay_name = 'requestPayment'
}
uni[mp_pay_name]({
...jsConfig,
success: function(res) {
uni.hideLoading();
that.getUserInfo();
that.getRecharge();
// console.log('12323424')
uni.showToast({
icon: 'success',
title: '支付成功'
})
// return that.$util.Tips({
// title: '',
// icon: 'success'
// }, {
// tab: 5,
// url: goPages
// });
},
fail: function(e) {
uni.hideLoading();
Toast('取消支付')
// return that.$util.Tips({
// title: ''
// }, {
// tab: 5,
// url: goPages
// });
},
})
break;
// #endif
case "balance":
uni.hideLoading();
//
Toast(res.msg)
// return that.$util.Tips({
// title: res.msg
// }, {
// tab: 5,
// url: goPages
// });
break;
// #ifdef H5
case 'h5':
let host = window.location.protocol + "//" + window.location.host;
let url = `${host}/pages/users/user_money/money`
let eUrl = encodeURIComponent(url)
let jsurl = jsConfig.mweb_url || jsConfig.h5_url
let locations = `${jsurl}&redirect_url=${eUrl}`
setTimeout(() => {
location.href = locations;
}, 100);
break;
// #endif
// #ifdef APP-PLUS
case 'alipayApp':
uni.requestPayment({
provider: 'alipay',
orderInfo: jsConfig,
success: (e) => {
this.getUserInfo()
uni.showToast({
icon: 'success',
title: '支付成功'
})
// return that.$util.Tips({
// title: '',
// icon: 'success'
// }, {
// tab: 5,
// url: goPages
// });
},
fail: (e) => {
uni.showModal({
content: "支付失败",
showCancel: false,
success: function(res) {
uni.redirectTo({
url: goPages
})
}
})
},
complete: () => {
uni.hideLoading();
},
});
break;
// #endif
}
},
onChangeFun: function(e) {
let opt = e;
let action = opt.action || null;
let value = opt.value != undefined ? opt.value : null;
action && this[action] && this[action](value);
},
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
.bg {
position: relative;
padding-bottom: 300rpx;
.bg_box{
height: 486rpx;
position: relative;
overflow: hidden;
.bg_img {
width: 750rpx;
height: 652rpx;
position: absolute;
top: 0;
left: 0;
}
.bg_border{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 30rpx;
border-radius: 60rpx 60rpx 0 0;
background-color: #fff;
}
}
.bg_back {
height: 34rpx;
width: 20rpx;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 30rpx;
}
.body_card {
color: #333;
.card1 {
background-color: #fff;
.change_list {
width: 700rpx;
margin: 0 auto;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.change_item {
width: 335rpx;
height: 172rpx;
text-align: center;
// background-color: #f7f7f7;
border-radius: 20rpx 20rpx 20rpx 20rpx;
font-size: 40rpx;
position: relative;
margin-bottom: 30rpx;
.item_pic{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.item_content{
padding: 26rpx;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 172rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.top_left{
font-size: 58rpx;
color: #ffc53d;
display: flex;
align-content: center;
.tips{
font-size: 24rpx;
border: 5rpx solid #ffc53d;
margin-left: 20rpx;
padding: 5rpx 15rpx;
border-radius: 60rpx;
color: #7C5906;
}
.c_content{
padding-top: 10rpx;
}
.c_icon {
padding-top: 15rpx;
font-size: 36rpx;
}
}
.top_right{
display: flex;
align-items: center;
color: #FF3A32;
text{
font-size: 28rpx;
}
view{
height: 60rpx;
width: 40rpx;
text-align: center;
line-height: 60rpx;
}
}
}
}
.change_item_active {
background: rgba(#FF8056, 0.2);
border: 5rpx solid #FF8056;
color: #FF8056;
}
}
}
}
.a_tips{
color: #FF8056;
padding: 0 30rpx;
line-height: 40rpx;
}
}
.m_body {
.footer {
position: fixed;
left: 0;
bottom: 0;
height: 120rpx;
width: 100vw;
background-color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20rpx;
.f_tip {
display: flex;
align-items: flex-end;
font-style: 26rpx;
.price {
color: #FF8056;
text {
font-size: 44rpx;
margin-left: 20rpx;
margin-right: 5rpx;
}
}
}
.primary_btn {
background-color: #fa8147;
height: 80rpx;
border-radius: 80rpx;
width: 180rpx;
color: #fff;
line-height: 80rpx;
text-align: center;
}
}
}
.ref_ref{
width: 630rpx;
height: 200rpx;
background-color: #fff;
border-radius: 20rpx;
padding: 20rpx 10rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
.ref_top{
color: #ffc53d;
}
.ref_center{
font-size: 24rpx;
border: 5rpx solid #ffc53d;
margin-left: 20rpx;
padding: 5rpx 15rpx;
border-radius: 60rpx;
color: #7C5906;
}
.ref_bottom{
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: space-between;
color: #FF3A32;
.bottom_item{
width: 280rpx;
display: flex;
align-items: center;
image{
width: 32rpx;
height: 40rpx;
}
.text{
padding-left: 15rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,384 @@
<template>
<view>
<view class="bg">
<image class="bg_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/invitation.webp"></image>
<image @click="back" class="bg_back" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="bg_body">
<view class="b_qr">
<view class="qr_body">
<view class="qr_code">
<image :src="qr_img"></image>
</view>
<view class="qr_text">扫一扫补贴正在路上</view>
<view class="qr_tips">温馨提示邀请新用户才有机会获得补贴哦</view>
</view>
</view>
<view class="b_user">
<view class="users">
<image v-for="(item, index) in info.user_info" :key="item.uid" class="avatar" :src="item.avatar||'/static/images/f.png'"></image>
<block v-if="info.user_info.length<4">
<view v-for="item in 4-info.user_info.length" :key="item+'n'" class="avatar_no">
<u-icon name="plus" color="#fff" size="40rpx"></u-icon>
</view>
</block>
</view>
<view class="u_tips">邀请新用户消费达目标金额有机会领取补贴哦~</view>
<view class="u_btn">
<image v-if="status==0" class="btn_image" @click="open" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/ibtn1.webp"></image>
<image v-if="status==1" class="btn_image" @click="open" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/ibtn2.webp"></image>
<image v-if="status==2" class="btn_image" @click="opened" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/ibtn3.webp"></image>
</view>
<uni-popup ref="redPacket">
<view class="red_packet">
<block v-if="status==0">
<view class="packet_img">
<image class="img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/red_packet1.webp"></image>
<view class="p_text">
<view class="big">抱歉</view>
<view class="smoll">有好友消费未达目标金额</view>
<view class="smoll">无法领补贴哦~</view>
</view>
</view>
<image @click="close()" class="close_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/close.png"></image>
</block>
<block v-if="status==1">
<view class="packet_img" @click="openRedPacket()">
<image class="img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/red_packet2.webp"></image>
<view class="p_text">
<view class="big">恭喜</view>
<view class="smoll">成功获得实物通用补贴</view>
<view class="smoll">赶快打开吧~</view>
</view>
</view>
<image @click="close()" class="close_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/close.png"></image>
</block>
<block v-if="status==2">
<view class="packet_img">
<image class="img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/red_packet3.webp"></image>
<view class="p_text" style="bottom: 60rpx;">
<view class="smoll">恭喜你成功获得</view>
<view class="smoll red_count"><text class="count">{{red_packet.amount}}</text></view>
<view class="big2">购买指定商品可直接抵扣使用</view>
<view class="smoll">{{red_packet.end_time}}过期</view>
<image @click="close()" class="btn_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/put.webp"></image>
</view>
</view>
<image @click="close()" class="close_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/close.png"></image>
</block>
</view>
</uni-popup>
</view>
<view class="b_in_list">
<image class="body_head_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/irecoed.webp"></image>
<view class="b_head">
<view style="width: 120rpx;"></view>
<view class="head_title" style="width: 200rpx;">名称</view>
<view class="head_title" style="width: 130rpx;">ID</view>
<view class="head_title" style="width: 120rpx;">目标金额</view>
<view class="head_title" style="width: 120rpx;">状态</view>
</view>
<view class="b_content">
<view class="content_list" v-for="(item, index) in info.user_info" :key="item.uid">
<image class="avatar" :src="item.avatar||'/static/images/f.png'"></image>
<view class="content_item" style="width: 180rpx;margin: 0 10rpx;">{{item.nickname}}</view>
<view class="content_item" style="width: 130rpx;">{{item.uid}}</view>
<view class="content_item" style="width: 120rpx;">{{item.target_amount}}<text class="mall"></text></view>
<view class="content_item" style="width: 120rpx;">
<text v-if="item.is_finish" style="color: #18CE61;">已完成</text>
<text v-else style="color: #FA5A29;">未完成</text>
</view>
</view>
<!-- <view class="mall none">暂无记录</view> -->
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { storeActivityStatus, storeActivityReceive, storeActivityQrcode } from "@/api/activity.js"
import { Toast } from "../../../libs/uniApi";
import { getUserInfo } from '@/api/user.js';
export default {
data() {
return {
info: {
user_info: []
},
red_packet: {
amount: '0.00',
end_time: ''
},
status: 0, //0 1 2
qr_img: ''
}
},
onLoad() {},
onShow() {
this.storeActivityQrcode();
this.loadInfo();
},
methods: {
back(){
uni.navigateBack()
},
loadInfo(){
storeActivityStatus().then(res=>{
this.info = res.data;
if(res.data.allow_receive) this.status = 1;
})
},
opened(){
Toast('已经领取过啦!');
},
open(){
this.$refs.redPacket.open();
},
close(){
this.$refs.redPacket.close();
},
storeActivityQrcode(){
storeActivityQrcode().then(res=>{
this.qr_img = res.data.url;
})
},
//
async openRedPacket(){
this.$refs.redPacket.close();
try{
let {data} = await storeActivityReceive();
this.$nextTick(()=>{
this.red_packet = data;
this.$u.sleep(800).then(()=>{
this.status = 2;
this.$u.sleep(100).then(()=>{
this.open();
})
})
})
}catch(e){
Toast(e)
}
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page{
background-color: #ff864d;
}
.bg{
position: relative;
height: auto;
.bg_img{
width: 750rpx;
position: absolute;
top: 0;
left: 0;
}
.bg_back{
height: 34rpx;
width: 20rpx;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 30rpx;
}
.bg_body{
position: absolute;
top: 414rpx;
left: 0;
.b_qr{
width: 710rpx;
height: 750rpx;
margin: 0 20rpx;
// background: linear-gradient(to top, #FFE3AE 0%, #FFF6EB 100%);
background: #FFF6EB;
border-radius: 50rpx;
padding: 20rpx;
.qr_body{
width: 100%;
height: 100%;
border: 5rpx solid #ffd588;
border-radius: 50rpx;
text-align: center;
display: flex;
justify-content: space-evenly;
flex-direction: column;
.qr_code{
width: 510rpx;
height: 510rpx;
// background-color: #f8962e;
margin: 0 auto;
image{
width: 100%;
height: 100%;
}
}
.qr_text{
font-size: 36rpx;
color: #C44100;
font-weight: 500;
}
.qr_tips{
font-size: 26rpx;
color: #C44100;
}
}
}
.b_user{
margin-top: 30rpx;
.users{
display: flex;
justify-content: center;
.avatar{
height: 100rpx;
width: 100rpx;
border-radius: 50%;
margin: 15rpx;
}
.avatar_no{
height: 100rpx;
width: 100rpx;
font-weight: 200;
border-radius: 50%;
border: 2rpx dashed #fff;
margin: 15rpx;
background-color: rgba(#fff, 0.3);
display: flex;
justify-content: center;
align-items: center;
}
}
.u_tips{
color: #FFE5B3;
font-size: 26rpx;
text-align: center;
}
.u_btn{
margin-top: 30rpx;
margin-bottom: 20rpx;
display: flex;
justify-content: center;
.btn_image{
width: 403rpx;
height: 113rpx;
}
}
.red_packet{
display: flex;
flex-direction: column;
align-items: center;
.packet_img{
width: 750rpx;
position: relative;
.img{
width: 100%;
}
.p_text{
position: absolute;
bottom: 120rpx;
width: 100%;
text-align: center;
color: #fff;
.big{
font-size: 38rpx;
font-weight: 500;
margin-bottom: 30rpx;
}
.smoll{
font-size: 28rpx;
margin-bottom: 20rpx;
}
.big2{
font-size: 32rpx;
font-weight: 500;
margin-bottom: 30rpx;
}
.btn_img{
width: 310rpx;
}
.red_count{
margin-top: 80rpx;
margin-bottom: 40rpx;
.count{
font-size: 80rpx;
}
}
}
}
.close_img{
width: 60rpx;
height: 60rpx;
}
}
}
.b_in_list{
width: 710rpx;
margin: 0 20rpx;
height: auto;
background-color: #fff;
border-radius: 50rpx;
padding: 20rpx;
margin-bottom: 30rpx;
display: flex;
flex-direction: column;
align-content: center;
.body_head_img{
width: 253rpx;
margin: 0 auto;
}
.b_head{
background-color: #fff2ed;
border-radius: 20rpx;
color: #854116;
display: flex;
margin-top: 28rpx;
text-align: center;
.head_title{
width: 150rpx;
padding: 20rpx 0;
font-size: 28rpx;
}
}
.b_content{
.mall{
font-size: 26rpx;
}
.content_list{
background-color: #FFF6E9;
border-radius: 20rpx;
color: #C44100;
padding-top: 20rpx;
margin-top: 20rpx;
font-size: 28rpx;
display: flex;
align-items: center;
padding-bottom: 20rpx;
text-align: center;
.content_item{
overflow: hidden;
}
.avatar{
width: 100rpx;
height: 100rpx;
border-radius: 50%;
margin-left: 16rpx;
}
}
.none{
text-align: center;
padding: 20rpx;
}
}
}
}
}
</style>

View File

@ -0,0 +1,182 @@
<template>
<view>
<view style="height: var(--status-bar-height);background-color: #e54841;"></view>
<view class="bg">
<image class="bg_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/subsidy.webp"></image>
<image @click="back" class="bg_back" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="bg_title">补贴记录</view>
<view class="b_title">
<view>总计获得</view> <view class="count">{{total_amount}}</view> <view>元补贴补贴</view>
</view>
<view class="b_body">
<image class="body_head_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/srecord.webp"></image>
<view class="b_head">
<view class="head_title">消费金额</view>
<view class="head_title">补贴金额</view>
<view class="head_title2">补贴获得时间</view>
</view>
<view class="b_content">
<view class="content_list" v-for="(item, index) in list" :key="index">
<view class="content_item">{{item.order_amount}}<text class="mall"></text></view>
<view class="content_item">{{item.coupon_price}}<text class="mall"></text></view>
<view class="content_item2"><text class="mall">{{item.create_time}}</text></view>
</view>
<view class="mall none" style="padding-top: 0;" v-if="list.length==0" @click="navTo">{{'暂无记录, 去消费领补贴 >>'}}</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { storeActivityRecord } from "@/api/activity.js"
import { Toast } from "../../../libs/uniApi";
import { getUserInfo } from '@/api/user.js';
export default {
data() {
return {
total_amount: '0.00',
list: []
}
},
onLoad() {},
onShow() {
this.storeActivityRecord();
},
methods: {
back(){
uni.navigateBack()
},
storeActivityRecord(){
storeActivityRecord().then(res=>{
this.list = res.data.record;
this.total_amount = res.data.total_amount || "0.00"
})
},
navTo(){
uni.switchTab({
url:'/pages/index/index'
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page{
background-color: #ffe3bd;
}
.bg{
position: relative;
height: auto;
.bg_img{
width: 750rpx;
position: absolute;
top: 0;
left: 0;
}
.bg_back{
height: 34rpx;
width: 20rpx;
position: absolute;
top: 30rpx;
left: 30rpx;
}
.bg_title{
font-size: 32rpx;
color: #fff;
font-weight: 500;
position: absolute;
top: 30rpx;
left: 50%;
transform: translate(-50%);
}
.b_title{
position: absolute;
width: 100%;
height: 70rpx;
top: 225rpx;
left: 0;
text-align: center;
font-size: 36rpx;
color: #F1503F;
display: flex;
justify-content: center;
align-items: flex-end;
.count{
// height: 100%;
font-size: 66rpx;
font-weight: bold;
margin: 10rpx 20rpx;
}
}
.b_body{
position: absolute;
width: 710rpx;
margin-left: 21rpx;
margin-right: 19rpx;
height: auto;
background-color: #fff;
top: 534rpx;
left: 0;
border-radius: 50rpx;
padding: 28rpx;
margin-bottom: 30rpx;
display: flex;
flex-direction: column;
align-content: center;
.body_head_img{
width: 253rpx;
margin: 0 auto;
}
.b_head{
background-color: #FFF2E0;
border-radius: 20rpx;
color: #C44100;
display: flex;
margin-top: 28rpx;
font-size: 28rpx;
padding: 20rpx 0;
.head_title{
padding-left: 20rpx;
width: 190rpx;
}
.head_title2{
padding-left: 20rpx;
width: 280rpx;
}
}
.b_content{
background-color: #fff2ed;
border-radius: 20rpx;
color: #FF5A3A;
padding-top: 20rpx;
margin-top: 28rpx;
font-size: 32rpx;
.mall{
font-size: 26rpx;
}
.content_list{
display: flex;
padding-bottom: 20rpx;
.content_item{
padding-left: 20rpx;
width: 190rpx;
}
.content_item2{
padding-left: 20rpx;
width: 280rpx;
}
}
.none{
text-align: center;
padding: 20rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,183 @@
<template>
<view>
<view class="bg">
<image class="bg_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/subsidy.webp"></image>
<image @click="back" class="bg_back" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="bg_title">无门槛实物通用补贴</view>
<view class="b_title">
<view>总计剩余</view> <view class="count">{{total_amount}}</view> <view>元通用补贴</view>
</view>
<view class="b_body">
<image class="body_head_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/srecord.webp"></image>
<view class="b_head">
<view class="head_title">消费金额</view>
<view class="head_title">补贴金额</view>
<view class="head_title2">补贴获得时间</view>
</view>
<view class="b_content">
<view class="content_list" v-for="(item, index) in list" :key="index">
<view class="content_item">{{item.order_amount}}<text class="mall"></text></view>
<view class="content_item">{{item.coupon_price}}<text class="mall"></text></view>
<view class="content_item2"><text class="mall">{{item.create_time}}</text></view>
</view>
<view class="mall none" style="padding-top: 0;" v-if="list.length==0" @click="navTo">{{'暂无记录, 去消费领补贴 >>'}}</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { storeActivityRecord } from "@/api/activity.js"
import { Toast } from "../../../libs/uniApi";
import { getUserInfo } from '@/api/user.js';
export default {
data() {
return {
total_amount: '0.00',
list: []
}
},
onLoad() {},
onShow() {
this.storeActivityRecord();
},
methods: {
back(){
uni.navigateBack()
},
storeActivityRecord(){
storeActivityRecord({
type: 1
}).then(res=>{
this.list = res.data.record;
this.total_amount = res.data.total_amount || "0.00"
})
},
navTo(){
uni.switchTab({
url:'/pages/index/index'
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page{
background-color: #ffe3bd;
}
.bg{
position: relative;
height: auto;
.bg_img{
width: 750rpx;
position: absolute;
top: 0;
left: 0;
}
.bg_back{
height: 34rpx;
width: 20rpx;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 30rpx;
}
.bg_title{
font-size: 32rpx;
color: #fff;
font-weight: 500;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 50%;
transform: translate(-50%);
}
.b_title{
position: absolute;
width: 100%;
height: 70rpx;
top: 225rpx;
left: 0;
text-align: center;
font-size: 36rpx;
color: #F1503F;
display: flex;
justify-content: center;
align-items: flex-end;
.count{
// height: 100%;
font-size: 66rpx;
font-weight: bold;
margin: 10rpx 20rpx;
}
}
.b_body{
position: absolute;
width: 710rpx;
margin-left: 21rpx;
margin-right: 19rpx;
height: auto;
background-color: #fff;
top: 534rpx;
left: 0;
border-radius: 50rpx;
padding: 28rpx;
margin-bottom: 30rpx;
display: flex;
flex-direction: column;
align-content: center;
.body_head_img{
width: 253rpx;
margin: 0 auto;
}
.b_head{
background-color: #FFF2E0;
border-radius: 20rpx;
color: #C44100;
display: flex;
margin-top: 28rpx;
font-size: 28rpx;
padding: 20rpx 0;
.head_title{
padding-left: 20rpx;
width: 190rpx;
}
.head_title2{
padding-left: 20rpx;
width: 280rpx;
}
}
.b_content{
background-color: #fff2ed;
border-radius: 20rpx;
color: #FF5A3A;
padding-top: 20rpx;
margin-top: 28rpx;
font-size: 32rpx;
.mall{
font-size: 26rpx;
}
.content_list{
display: flex;
padding-bottom: 20rpx;
.content_item{
padding-left: 20rpx;
width: 190rpx;
}
.content_item2{
padding-left: 20rpx;
width: 280rpx;
}
}
.none{
text-align: center;
padding: 20rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,183 @@
<template>
<view>
<view class="bg">
<image class="bg_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/subsidy.webp"></image>
<image @click="back" class="bg_back" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="bg_title">现金抵扣补贴</view>
<view class="b_title">
<view>总计剩余</view> <view class="count">{{total_amount}}</view> <view>元抵扣补贴</view>
</view>
<view class="b_body">
<image class="body_head_img" mode="widthFix" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/srecord.webp"></image>
<view class="b_head">
<view class="head_title">消费金额</view>
<view class="head_title">补贴金额</view>
<view class="head_title2">补贴获得时间</view>
</view>
<view class="b_content">
<view class="content_list" v-for="(item, index) in list" :key="index">
<view class="content_item">{{item.order_amount}}<text class="mall"></text></view>
<view class="content_item">{{item.coupon_price}}<text class="mall"></text></view>
<view class="content_item2"><text class="mall">{{item.create_time}}</text></view>
</view>
<view class="mall none" style="padding-top: 0;" v-if="list.length==0" @click="navTo">{{'暂无记录, 去消费领补贴 >>'}}</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { storeActivityRecord } from "@/api/activity.js"
import { Toast } from "../../../libs/uniApi";
import { getUserInfo } from '@/api/user.js';
export default {
data() {
return {
total_amount: '0.00',
list: []
}
},
onLoad() {},
onShow() {
this.storeActivityRecord();
},
methods: {
back(){
uni.navigateBack()
},
storeActivityRecord(){
storeActivityRecord({
type: 2
}).then(res=>{
this.list = res.data.record;
this.total_amount = res.data.total_amount || "0.00"
})
},
navTo(){
uni.switchTab({
url:'/pages/index/index'
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page{
background-color: #ffe3bd;
}
.bg{
position: relative;
height: auto;
.bg_img{
width: 750rpx;
position: absolute;
top: 0;
left: 0;
}
.bg_back{
height: 34rpx;
width: 20rpx;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 30rpx;
}
.bg_title{
font-size: 32rpx;
color: #fff;
font-weight: 500;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 50%;
transform: translate(-50%);
}
.b_title{
position: absolute;
width: 100%;
height: 70rpx;
top: 225rpx;
left: 0;
text-align: center;
font-size: 36rpx;
color: #F1503F;
display: flex;
justify-content: center;
align-items: flex-end;
.count{
// height: 100%;
font-size: 66rpx;
font-weight: bold;
margin: 10rpx 20rpx;
}
}
.b_body{
position: absolute;
width: 710rpx;
margin-left: 21rpx;
margin-right: 19rpx;
height: auto;
background-color: #fff;
top: 534rpx;
left: 0;
border-radius: 50rpx;
padding: 28rpx;
margin-bottom: 30rpx;
display: flex;
flex-direction: column;
align-content: center;
.body_head_img{
width: 253rpx;
margin: 0 auto;
}
.b_head{
background-color: #FFF2E0;
border-radius: 20rpx;
color: #C44100;
display: flex;
margin-top: 28rpx;
font-size: 28rpx;
padding: 20rpx 0;
.head_title{
padding-left: 20rpx;
width: 190rpx;
}
.head_title2{
padding-left: 20rpx;
width: 280rpx;
}
}
.b_content{
background-color: #fff2ed;
border-radius: 20rpx;
color: #FF5A3A;
padding-top: 20rpx;
margin-top: 28rpx;
font-size: 32rpx;
.mall{
font-size: 26rpx;
}
.content_list{
display: flex;
padding-bottom: 20rpx;
.content_item{
padding-left: 20rpx;
width: 190rpx;
}
.content_item2{
padding-left: 20rpx;
width: 280rpx;
}
}
.none{
text-align: center;
padding: 20rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,333 @@
<template>
<view>
<view class="bg">
<image class="bg_img" mode="widthFix"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/tow_price_bg.webp"></image>
<image @click="back" class="bg_back"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="b_body">
<view class="b_content">
<view style="padding-bottom: 16rpx;">
<picker :range="addressList" range-key="street_name" @change="changeAddress">
<block v-if="address.street_id">
当前活动区域为 <text style="color: #f84221;margin-left: 5rpx;">[ {{address.townName}} ] , 点击切换</text>
</block>
<block v-else>
<text style="color: #f84221;margin-left: 5rpx;">当前区域 [ {{address.townName}} ] 没有活动 , 点击切换</text>
</block>
</picker>
</view>
<block v-if="goodsList.length>0">
<view v-if="item.product" v-for="(item, index) in goodsList" class="short_item" @click="clickProduct(item)">
<image class="image" :src="item.product.image"></image>
<view class="short_item_right">
<view class="r_name">
<text v-if="item.mer_labels_name" class="mer-labels">{{item.mer_labels_name}}</text>{{item.product.store_name}}
</view>
<view style="display: flex;justify-content: flex-start;margin-top: 5rpx;">
<view class="r_street" v-if="item.merchant">{{item.merchant.street_name}}</view>
<view class="r_type" v-if="item.product.store_info||getSkuName(item)||item.unit_name">
<view v-if="getSkuName(item)">{{getSkuName(item)}}</view>
<view v-else-if="item.unit_name">{{item.unit_name}}</view>
</view>
</view>
<view class="r_btn" v-if="item.product && item.product.price">
<view style="color: #7f7f7f;"><text style="font-size: 33rpx;">{{ item.product.price.split('.')[0] }}.</text>{{item.product.price.split('.')[1]}} 限时特惠</view>
<view class="qiang" :class="{'no_qiang': !can_buy}">{{item.limited_price}} </view>
<!-- <image src="@/static/images/icon/plus.png" style="width: 40rpx;height: 40rpx;border-radius: 40rpx;"></image> -->
</view>
</view>
</view>
</block>
<block v-else>
<image style="width: 100%;" mode="widthFix" src="/static/img/no_short.f2ffcd1c.png"></image>
<view style="text-align: center;color: #999;">此区域没有找到活动商品切换其他地方试试呢</view>
</block>
</view>
</view>
</view>
<shortPopupActive ref="shortPopupRef" @addCart="loadCart" :source="105" isBuy></shortPopupActive>
<u-modal :show="show" :closeOnClickOverlay="true" :title="`[${activity.title}]`"
content="选择活动后只有完成活动任务后才可参加另一个活动, 确定要参与这个活动吗" cancelText="我再想想" confirmText="参加活动" confirmColor="#e54841"
@cancel="show = false" @confirm="joinA()" showCancelButton></u-modal>
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"
:isGoIndex="false"></authorize>
</view>
</template>
<script>
import { getArticleList } from "@/api/api.js"
import { Toast } from "../../../libs/uniApi";
import authorize from "@/components/Authorize.vue";
import { getUserInfo } from '@/api/user.js';
import shortPopupActive from "@/components/shortPopupActive.vue"
import { storeActivityProduct, storeActivityDistrict } from "@/api/activity.js"
import {
getCartCounts,
getCartList,
} from '@/api/order.js';
export default {
components: {
authorize,
shortPopupActive
},
data() {
return {
info: {},
userInfo: {},
Alist: [],
activity: {
title: ''
},
address: {
townName: '',
street_id: ''
},
show: false,
isAuto: false, //
isShowAuth: false, //
addressList: [],
goodsList: [],
goodsNum: 0,
can_buy: 0, // , 0, 1
}
},
onLoad(options) {
this.address = {
street_id: options.street_id,
townName: options.townName
}
},
onShow() {
this.getUserInfo();
this.loadList();
this.cartFn();
this.loadAddressList();
},
methods: {
changeAddress(e){
this.address = {
street_id: this.addressList[e.detail.value].street_code,
townName: this.addressList[e.detail.value].street_name
}
this.loadList();
},
back() {
uni.navigateBack()
},
getUserInfo() {
getUserInfo().then(res => {
this.userInfo = res.data;
}).catch(err => {
console.log(err);
})
},
loadList(){
let location = '';
if(this.$store.state.storage.location.lat) location = this.$store.state.storage.location.lat + ',' + this.$store.state.storage.location.long;
storeActivityProduct({
street_code: this.address.street_id,
activity_id: 2, //2
location: location,
source: 105
}).then(res => {
this.can_buy = res.data.can_buy;
this.goodsList = res.data.list;
}).catch(e=>{
Toast(e.msg||e.message||e)
})
},
loadAddressList(){
storeActivityDistrict().then(res=>{
this.addressList = res.data;
if(!this.addressList.find(item=>item.street_code==this.address.street_id)){
this.address.street_id = ''
}
})
},
//
getSkuName(item){
return Object.keys(item.sku).join('/')||null;
},
//
clickProduct(data){
if(!this.address.townName) return Toast('请先选择活动区域')
if(!this.can_buy){
return Toast('活动限购一件, 您已经买过了哦~')
}
this.$refs.shortPopupRef.setDatas(data, this.goodsNum);
this.$refs.shortPopupRef.open();
},
//
loadCart(){
this.cartFn();
},
//
cartFn() {
getCartCounts({
source: 105,
// product_type: 98
}).then(res => {
this.goodsNum = res.data[0].count
})
},
//
onLoadFun(data) {
this.getUserInfo();
this.isShowAuth = false;
},
//
openAuto() {
// console.log('hajhcdsohjcosvjco')
this.isAuto = true;
this.isShowAuth = true
},
//
authColse: function(e) {
this.isShowAuth = e
},
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page {
background-color: #fff5dd;
}
.bg {
position: relative;
padding-bottom: 30rpx;
.bg_img {
width: 750rpx;
height: 652rpx;
position: absolute;
top: 0;
left: 0;
}
.bg_back {
height: 34rpx;
width: 20rpx;
position: absolute;
top: calc(var(--status-bar-height) + 30rpx);
left: 30rpx;
}
.b_body {
width: 710rpx;
margin-left: 21rpx;
margin-right: 19rpx;
height: auto;
background-color: #fff;
border-radius: 0 0 60rpx 60rpx;
padding: 28rpx;
padding-top: 680rpx;
margin-bottom: 30rpx;
.b_content {
width: 100%;
// height: 800rpx;
// background-color: #eee;
.short_item {
// padding: 20rpx;
padding-bottom: 30rpx;
display: flex;
justify-content: space-between;
.image {
height: 200rpx;
width: 200rpx;
border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx;
margin-right: 20rpx;
flex-shrink: 0;
}
.short_item_right {
width: 430rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.r_name {
width: 100%;
height: 80rpx;
font-size: 28rpx;
line-height: 40rpx;
text-overflow: ellipsis;
display: -webkit-box; /* 使用弹性盒子布局 */
-webkit-box-orient: vertical; /* 设置为垂直方向布局 */
overflow: hidden; /* 隐藏超出部分 */
-webkit-line-clamp: 2; /* 限制显示两行文本 */
.mer-labels{
background-color: #f84221;
color: #fff;
font-size: 18rpx;
padding: 4rpx 8rpx;
border-radius: 5rpx;
margin-right: 8rpx;
}
}
.r_type {
font-size: 22.78rpx;
color: #737373;
flex: 1;
overflow: hidden;
display: flex;
view {
height: 39rpx;
line-height: 39rpx;
background: #FEF5F3;
padding: 0 16rpx;
border-radius: 39rpx;
text-overflow: ellipsis;
}
}
.r_btn {
display: flex;
justify-content: space-between;
font-size: 22.78rpx;
color: #F84221;
align-items: center;
background-color: rgba(#F84221, 0.1);
padding-left: 15rpx;
border-radius: 0 60rpx 60rpx 0;
.qiang{
width: 160rpx;
height: 60rpx;
display: flex;
justify-content: center;
align-items: center;
background-color: #F84221;
color: #fff;
border-radius: 60rpx;
font-weight: bold;
font-size: 28rpx;
}
.no_qiang{
background-color: #7f7f7f;
}
}
.r_street{
font-size: 24rpx;
height: 39rpx;
line-height: 39rpx;
color: #7f7f7f;
padding-right: 10rpx;
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,220 @@
<template>
<view class="red_body">
<view class="bg">
<image mode="widthFix" src="/static/active/redpack_type_img.webp"></image>
<view class="border"></view>
</view>
<view class="bg_back">
<image @click="back" class="bc_image" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/back.png"></image>
<view class="title">补贴余额</view>
</view>
<view class="r_list" v-for="(item, index) in list" :key="index">
<view class="r_item" @click="navgo(item)">
<image class="r_bg" src="/static/active/red_packet.webp"></image>
<view class="r_body">
<view class="r_count">
<view class="rc_count">
<text class="rc_icon"></text>{{item.total_amount}}
</view>
</view>
<view class="r_content">
<view class="r_name">{{item.type_cn}}</view>
</view>
<view class="r_btn">
查看
</view>
</view>
</view>
</view>
<view style="width: 100%;height: 260rpx;"></view>
<!-- <view class="activity">
<image mode="widthFix" @click="navTo()" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_activity/activity1.webp"></image>
</view> -->
</view>
</template>
<script>
import { storeActivityTotal } from "@/api/activity.js"
export default {
data() {
return {
list: []
}
},
onLoad() {},
onShow() {
this.storeActivityTotal();
},
methods: {
storeActivityTotal(){
storeActivityTotal().then(res=>{
this.list = res.data;
})
},
back(){
uni.navigateBack();
},
navgo(item){
if(item.type==1) uni.navigateTo({
url: '/pages/newActivity/subsidy/subsidy2'
})
else if(item.type==2) uni.navigateTo({
url: '/pages/newActivity/subsidy/subsidy3'
})
},
navTo(){
let address = this.$store.state.storage.address;
let location = this.$store.state.storage.location;
if(address.street_id){
uni.navigateTo({
url: `/pages/nongKe/cloud_entrepot/indexh?street_id=${address.street_id}&townName=${address.townName}&source=103&location=${location.lat},${location.long}`
})
}else uni.navigateTo({
url: `/pages/nongKe/cloud_entrepot/indexh`
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
.red_body{
position: relative;
background: linear-gradient(to top, rgb(255,231,185), rgb(255,249,231) 480rpx);
min-height: calc(100vh);
.bg{
width: 750rpx;
height: 480rpx;
overflow: hidden;
position: relative;
image{
width: 100%;
height: 100%;
}
.border{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 30rpx;
border-radius: 30rpx 30rpx 0 0;
background-color: rgb(255,249,231);
}
}
.bg_back{
position: absolute;
top: var(--status-bar-height);
left: 0;
width: 100%;
padding: 30rpx;
color: #fff;
display: flex;
text-align: center;
.bc_image{
height: 34rpx;
width: 20rpx;
}
.title{
position: absolute;
top: 30rpx;
left: 50%;
transform: translate(-50%);
}
}
}
.r_list {
padding: 0 20rpx 20rpx 20rpx;
.r_item {
height: 156rpx;
width: 710rpx;
position: relative;
.r_bg {
width: 100%;
height: 100%;
}
.r_body {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: flex;
align-items: center;
.r_count {
flex: 2;
display: flex;
justify-content: center;
align-items: center;
color: #A46F32;
font-size: 44rpx;
font-weight: bold;
.rc_count {
display: flex;
align-items: flex-end;
}
.rc_icon {
font-size: 28rpx;
font-weight: 500;
margin-bottom: 8rpx;
}
}
.r_content {
flex: 4;
color: #FFF3CC;
font-size: 24rpx;
padding: 18rpx 10rpx 18rpx 40rpx;
display: flex;
flex-direction: column;
justify-content: center;
.r_name {
font-size: 32rpx;
font-weight: 500;
margin-bottom: 10rpx;
}
view {
width: 100%;
overflow: hidden;
/* 隐藏超出宽度的文本 */
white-space: nowrap;
/* 不换行 */
text-overflow: ellipsis;
/* 文本末尾显示省略号 */
}
}
.r_btn {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
color: #FFF3CC;
height: 59rpx;
border-radius: 28rpx 28rpx 28rpx 28rpx;
opacity: 1;
border: 1rpx solid #FFF3CC;
margin-right: 20rpx;
}
}
}
}
.activity{
position: fixed;
bottom: 100rpx;
padding: 20rpx;
image{
width: 710rpx;
}
}
</style>

View File

@ -0,0 +1,313 @@
<template>
<view class="">
<!-- <block v-for="(item, index) in info">
<block v-if="item.type==1">
<view class="type_name">无门槛实物通用补贴<text class="n_count">(2)</text></view>
<view class="r_list" v-for="(e, i) in item.list">
<view class="r_item" @click="change(index, i)">
<image class="r_bg" src="/static/active/red_packet.webp"></image>
<view class="r_body">
<view class="r_count">
<view class="rc_count">
<text class="rc_icon"></text>240
</view>
</view>
<view class="r_content">
<view class="r_name">现金抵扣补贴</view>
<view>仅限平台指定商家商品可使用</view>
<view>有效期至 2026.01.15 24:00:00</view>
</view>
<view class="r_icon">
<u-icon v-if="changeRed.type == index && changeRed.id == i" name="checkmark-circle-fill" color="#FFF3CC" size="56rpx"></u-icon>
<u-icon v-else name="checkmark-circle" color="#FFF3CC" size="56rpx"></u-icon>
</view>
</view>
</view>
</view>
</block>
<block v-if="item.type==2">
<view class="type_name">不可使用补贴<text class="n_count">(2)</text></view>
<view class="none_list" v-for="(e, i) in item.list">
<view class="r_body">
<view class="r_count">
<view class="rc_count">
<text class="rc_icon"></text>200
</view>
</view>
<view class="r_content">
<view class="r_name">现金抵扣补贴</view>
<view>仅限平台指定商家商品可使用</view>
<view>有效期至 2026.01.15 24:00:00</view>
</view>
</view>
<u-line dashed color="#999999"></u-line>
<view class="n_tips">本单不可用原因未在平台指定店铺使用</view>
</view>
</block>
</block> -->
<view style="height: 30rpx;"></view>
<view class="r_list" v-for="(item, i) in list" :key="i">
<view class="r_item" @click="change(item)">
<image class="r_bg" src="/static/active/red_packet.webp"></image>
<view class="r_body">
<view class="r_count">
<view class="rc_count">
<text class="rc_icon"></text>{{item.balance}}
</view>
</view>
<view class="r_content">
<view class="r_name">{{item.coupon_title}}</view>
<view>{{item.describe}}</view>
<view>有效期至 {{item.end_time}}</view>
</view>
<view class="r_icon">
<u-icon v-if="changeRed&&changeRed.coupon_user_id==item.coupon_user_id" name="checkmark-circle-fill" color="#FFF3CC" size="56rpx"></u-icon>
<!-- <u-icon v-else name="checkmark-circle" color="#FFF3CC" size="56rpx"></u-icon> -->
<view v-else style="height: 50rpx;width: 50rpx;border-radius: 50%;border: 5rpx solid #FFF3CC;"></view>
</view>
</view>
</view>
</view>
<view class="footer">
<view>
<text>已选 {{ changeRed?1:0 }} </text>
<view v-if="changeRed&&changeRed.coupon_title.includes('抵扣补贴')" style="font-size: 24rpx;margin-left: 10rpx;color: #ed4c3a;">(使用补贴后此订单将不参与任何补贴活动)</view>
<view v-if="changeRed&&changeRed.coupon_title.includes('通用补贴')" style="font-size: 24rpx;margin-left: 10rpx;color: #ed4c3a;">(使用补贴后此订单将不参与用户消费补贴活动)</view>
<!-- , 可减 <text class="red_i">¥</text> <text class="red_c">0</text> -->
</view>
<view class="btn" @click="comfirm">确定</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
info: [
{
type: 1, // 使
name: '无门槛实物通用补贴',
list: [1, 2]
},
{
type: 1, // 使
name: '现金抵扣补贴',
list: [1,2,3]
},
{
type: 2, // 使, 2使
name: '不可使用补贴',
list: [1]
}
],
list: [],
changeRed: null,
}
},
onLoad(option) {
const eventChannel = this.getOpenerEventChannel();
// acceptDataFromOpenerPageeventChannel
eventChannel.on('changeRedPacketInfo', (data) => {
console.log(data);
this.list = data;
})
},
onShow() {},
methods: {
change(e, i) {
console.log(e, i);
if(this.changeRed&&this.changeRed.coupon_user_id==e.coupon_user_id)this.changeRed = null;
else this.changeRed = e;
},
comfirm(){
uni.$emit('changeRedPacket', this.changeRed?.coupon_user_id||'');
uni.navigateBack()
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
page{
background-color: #fff;
}
.type_name{
padding: 20rpx;
font-size: 28rpx;
.n_count{
color: #7A7A7A;
font-size: 24rpx;
margin-left: 10rpx;
}
}
.r_list {
padding: 0 20rpx 20rpx 20rpx;
.r_item {
height: 156rpx;
width: 710rpx;
position: relative;
.r_bg {
width: 100%;
height: 100%;
}
.r_body {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: flex;
.r_count {
flex: 2;
display: flex;
justify-content: center;
align-items: center;
color: #A46F32;
font-size: 44rpx;
font-weight: bold;
.rc_count {
display: flex;
align-items: flex-end;
}
.rc_icon {
font-size: 28rpx;
font-weight: 500;
margin-bottom: 8rpx;
}
}
.r_content {
flex: 4;
color: #FFF3CC;
font-size: 24rpx;
padding: 18rpx 10rpx 18rpx 40rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.r_name {
font-size: 32rpx;
font-weight: 500;
margin-bottom: 10rpx;
}
view{
width: 100%;
overflow: hidden; /* 隐藏超出宽度的文本 */
white-space: nowrap; /* 不换行 */
text-overflow: ellipsis; /* 文本末尾显示省略号 */
}
}
.r_icon {
flex: 1;
display: flex;
align-items: center;
}
}
}
}
.none_list{
margin: 0 20rpx 20rpx 20rpx;
background-color: #E2E2E2;
border-radius: 20rpx;
.r_body {
height: 156rpx;
width: 710rpx;
display: flex;
.r_count {
flex: 2;
display: flex;
justify-content: center;
align-items: center;
color: #333;
font-size: 44rpx;
font-weight: bold;
.rc_count {
display: flex;
align-items: flex-end;
}
.rc_icon {
font-size: 28rpx;
font-weight: 500;
margin-bottom: 8rpx;
}
}
.r_content {
flex: 5;
color: #333;
font-size: 24rpx;
padding: 18rpx 10rpx 18rpx 40rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.r_name {
font-size: 32rpx;
font-weight: 500;
margin-bottom: 10rpx;
}
view{
width: 100%;
overflow: hidden; /* 隐藏超出宽度的文本 */
white-space: nowrap; /* 不换行 */
text-overflow: ellipsis; /* 文本末尾显示省略号 */
}
}
}
.n_tips{
padding: 10rpx 30rpx 20rpx 30rpx;
color: #333;
font-size: 24rpx;
}
}
.footer{
height: 130rpx;
padding: 30rpx;
width: 100%;
position: fixed;
bottom: 0;
left: 0;
background-color: #F6F6F6;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
.red_i{
color: #FF421D;
margin-left: 20rpx;
}
.red_c{
color: #FF421D;
font-size: 44rpx;
}
.btn{
width: 128rpx;
height: 68rpx;
background-color: #EC693F;
border-radius: 34rpx;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
}
}
</style>

1661
pages/store/settled/unit.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,292 @@
<template>
<view class="invite">
<view class="placeholder"></view>
<view class="qrcode">
<view class="title">
shop_{{uid}}
</view>
<view class="qrcode-img">
<image :src="qrcodeUrl"></image>
</view>
<view class="save" @longpress="handleSavePic">
<image
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_active_mer/new_active_mer_qrcode_save.webp">
</image>
<text>长按保存二维码</text>
</view>
</view>
<view class="con">
<image class="record"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_active_mer/new_active_mer_qrcode_record.webp">
</image>
<view class="table" v-if="list.length > 0">
<view class="table-title">
<view class="table-title-cell">用户名称</view>
<view class="table-title-cell">用户ID</view>
<view class="table-title-cell">采购金额</view>
<view class="table-title-cell">销售金额</view>
</view>
<block v-for="(item,index) in list" :key="index">
<view class="table-con">
<view class="table-con-cell">{{item.real_name}}</view>
<view class="table-con-cell">{{item.uid}}</view>
<view class="table-con-cell red">{{item.buy_amount}}</view>
<view class="table-con-cell green">{{item.sale_amount}}</view>
</view>
</block>
</view>
<view v-if="list.length == 0">
<emptyPage title="暂无邀请好友记录哦~"></emptyPage>
</view>
</view>
</view>
</template>
<script>
import emptyPage from '@/components/emptyPage.vue';
import {
qrcode,
merchantRecord
} from "@/api/activity.js";
export default {
components: {
emptyPage
},
data() {
return {
qrcodeUrl: "",
list: [],
page: 1,
limit: 10,
loadend: false,
loading: false,
loadTitle: '加载更多',
isAuto: false, //
isShowAuth: false, //
uid:''
}
},
onLoad() {
this.getQrcode();
this.getList();
this.getUserInfo()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
this.getList();
},
methods: {
//
getQrcode() {
qrcode().then(res => {
this.qrcodeUrl = res.data.url;
})
},
//
getList() {
let that = this;
if (that.loading) return;
if (that.loadend) return;
that.loading = true;
that.loadTitle = '';
merchantRecord({
page: that.page,
limit: that.limit
}).then(res => {
let list = res.data.list,
loadend = list.length < that.limit;
that.list = that.$util.SplitArray(list, that.list);
that.$set(that, 'list', that.list);
that.page = that.page + 1;
that.loading = false;
that.loadend = loadend;
that.loadTitle = loadend ? '哼~😕我也是有底线的~' : "加载更多";
}, function(res) {
this.loading = false;
that.loadTitle = '加载更多';
})
},
getUserInfo() {
let userInfo = this.$Cache.get("USER_INFO");
if(userInfo){
userInfo = JSON.parse(userInfo);
this.uid = userInfo.uid;
}
},
handleSavePic() {
// URL
let imageUrl = this.qrcodeUrl; // 使
// #ifdef H5
var a = document.createElement("a");
a.download = imageUrl;
a.href = imageUrl;
document.body.appendChild(a);
a.click();
a.remove();
// #endif
// #ifndef H5
let that =this;
uni.downloadFile({
url: imageUrl,
success(res) {
if (res.statusCode === 200) {
let tempFilePath = res.tempFilePath; //
uni.saveImageToPhotosAlbum({
filePath: tempFilePath,
success() {
return that.$util.Tips({
title: '图片已保存至相册!'
});
},
fail(err) {
console.error('保存失败', err);
}
});
} else {
console.error('下载失败', res.statusCode);
}
},
fail(err) {
console.error('下载失败', err);
}
});
// #endif
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #F5F5F5;
}
.invite {
.placeholder {
height: 544rpx;
}
.qrcode {
position: fixed;
top: 30rpx;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
width: 690rpx;
height: 666rpx;
background-image: url(https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/new_active_mer/new_active_mer_qrcode_bg.webp);
background-size: 100%;
background-repeat: no-repeat;
padding-top: 54rpx;
box-sizing: border-box;
.title {
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #7A7A7A;
margin-bottom: 16rpx;
}
.qrcode-img {
margin-bottom: 96rpx;
image {
width: 396rpx;
height: 396rpx;
}
}
.save {
display: flex;
justify-content: center;
align-items: center;
image {
width: 36rpx;
height: 36rpx;
margin-right: 10rpx;
}
text {
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
}
}
.con {
height: calc(100vh - 544rpx);
background-color: #FFF3EF;
padding: 192rpx 30rpx 0;
image {
width: 100%;
height: 45rpx;
margin-bottom: 40rpx;
}
.table {
.table-title {
display: flex;
margin-bottom: 24rpx;
.table-title-cell {
width: 25%;
font-size: 26rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #2E2E2E;
text-align: center;
}
}
.table-con {
display: flex;
width: 100%;
height: 68rpx;
line-height: 68rpx;
text-align: center;
background: #FFFFFF;
border-radius: 12rpx;
margin-bottom: 12rpx;
.table-con-cell {
width: 25%;
height: 68rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #2E2E2E;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
.red {
color: #F13B3B;
}
.green {
color: #20A162;
}
}
}
}
}
</style>

View File

@ -235,7 +235,7 @@
},
// #ifdef APP-PLUS
appVersionConfig() {
var that = this;
let that = this;
console.log('app:'+plus.runtime.appid)
plus.runtime.getProperty(plus.runtime.appid, (info) => {
this.version = info.version;

366
utils/uniMP.js Normal file
View File

@ -0,0 +1,366 @@
import {
getGXconfig,
miniapp
} from "@/api/uniMP.js";
import {
ENV
} from '@/config/app';
const mp = uni.requireNativePlugin('uniMP');
import store from "@/store/modules/app.js"
let appid = ''; // 应用id
let wgtFile = ''; // 应用文件地址
let timer = null; // 加载计时器
// 比较版本号大小
function compareVersions(version1, version2) {
const arr1 = version1.split('.').map(Number);
const arr2 = version2.split('.').map(Number);
for (let i = 0; i < Math.max(arr1.length, arr2.length); i++) {
const num1 = i < arr1.length ? arr1[i] : 0;
const num2 = i < arr2.length ? arr2[i] : 0;
if (num1 > num2) {
return 1;
} else if (num1 < num2) {
return -1;
}
}
return 0;
}
// 加载供销小程序
const loadMP = async (id) => {
appid = id;
let info = await getGXconfig();
console.log('最新版本', info.data);
// return ;
uni.$emit('showLoading', true, '初始化中');
mp.getUniMPVersion(id, (ret) => {
console.log('当前版本', ret);
let flag;
if (ENV == 'prod') {
flag = false
} else {
flag = true
}
if (0 != ret.code || compareVersions(info.data.version, ret.versionInfo.name) == 1 || flag ==
true) {
let count = 0;
timer = setInterval(() => {
if (count < 100 && count > 0) uni.$emit('showLoading', true, `初始化中... ${count}%`)
else uni.$emit('showLoading', true, `初始化中... 99%`)
}, 200)
let downloadTask = uni.downloadFile({
url: info.data.version_info?.dow_url,
success(res) {
wgtFile = res.tempFilePath;
console.log('初始化完成', wgtFile);
setTimeout(()=>{
installMP();
clearInterval(timer);
timer = null;
}, 700)
},
fail(res) {
clearInterval(timer);
timer = null;
uni.hideLoading();
}
});
downloadTask.onProgressUpdate((res) => {
// console.log('初始化进度' + res.progress);
if (res.progress > count) count += 10;
if (count >= 90) {
clearInterval(timer);
timer = null;
}
});
} else {
open()
}
});
};
//加载商城小程序
const loadMPx = async (id) => {
appid = id;
let info = await miniapp();
console.log('最新版本', info.data);
console.log(mp, uni);
// return ;
uni.$emit('showLoading', true, `初始化中...`)
mp.getUniMPVersion(id, (ret) => {
console.log('当前版本', ret);
let flag;
if (ENV == 'prod') {
flag = false
} else {
flag = true
}
if (0 != ret.code || compareVersions(info.data.appInfo.version, ret.versionInfo.name) == 1 ||
flag ==
true) {
let count = 0;
timer = setInterval(() => {
if (count < 100 && count > 0) uni.$emit('showLoading', true, `初始化中... ${count}%`)
else uni.$emit('showLoading', true, `初始化中... 99%`)
}, 200)
let downloadTask = uni.downloadFile({
url: info.data.appInfo.dow_url,
success(res) {
wgtFile = res.tempFilePath;
console.log('初始化完成', wgtFile);
setTimeout(()=>{
installMP();
clearInterval(timer);
timer = null;
}, 700)
},
fail(res) {
clearInterval(timer);
timer = null;
uni.hideLoading();
}
});
downloadTask.onProgressUpdate((res) => {
// console.log('初始化进度' + res.progress);
if (res.progress > count) count += 10;
if (count >= 90) {
clearInterval(timer);
timer = null;
}
});
} else {
open()
}
});
};
// 按信息接口加载小程序
const loadMPurl = async (e) => {
appid = e.id;
let FURL = e.url;
uni.$emit('showLoading', true, `初始化中...`)
uni.request({
url: FURL,
method: 'GET',
success: (fileInfo) => {
mp.getUniMPVersion(appid, (ret) => {
console.log('当前版本', ret);
let flag;
if (ENV == 'prod') {
flag = false
} else {
flag = true
}
if (0 != ret.code || compareVersions(fileInfo.data?.data?.version, ret.versionInfo.name) == 1 || flag ==
true) {
let count = 0;
timer = setInterval(() => {
if (count < 100 && count > 0) uni.$emit('showLoading', true, `初始化中... ${count}%`)
else uni.$emit('showLoading', true, `初始化中... 99%`)
}, 200)
let downloadTask = uni.downloadFile({
url: fileInfo.data?.data?.down_url,
success(res) {
wgtFile = res.tempFilePath;
console.log('初始化完成', wgtFile);
setTimeout(()=>{
installMP();
clearInterval(timer);
timer = null;
}, 700)
},
fail(res) {
clearInterval(timer);
timer = null;
uni.hideLoading();
}
});
downloadTask.onProgressUpdate((res) => {
// console.log('初始化进度' + res.progress);
if (res.progress > count) count += 10;
if (count >= 90) {
clearInterval(timer);
timer = null;
}
});
} else {
open()
}
});
},
fail:(err)=> {
console.log('错误:', err);
}
})
};
// 商城配置的小程序
const loadAppletMP = async (data) => {
appid = data.app_id;
// return ;
uni.$emit('showLoading', true, '初始化中');
mp.getUniMPVersion(appid, (ret) => {
let flag;
if (ENV == 'prod') {
flag = false
} else {
flag = true
}
if (0 != ret.code || compareVersions(data.version, ret.versionInfo.name) == 1 || flag ==
true) {
let count = 0;
timer = setInterval(() => {
if (count < 100 && count > 0) uni.$emit('showLoading', true, `初始化中... ${count}%`)
else uni.$emit('showLoading', true, `初始化中... 99%`)
}, 200)
let downloadTask = uni.downloadFile({
url: data.url,
success(res) {
wgtFile = res.tempFilePath;
console.log('初始化完成', wgtFile);
setTimeout(()=>{
installMP();
clearInterval(timer);
timer = null;
}, 700)
},
fail(res) {
clearInterval(timer);
timer = null;
uni.hideLoading();
}
});
downloadTask.onProgressUpdate((res) => {
// console.log('初始化进度' + res.progress);
if (res.progress > count) count += 10;
if (count >= 90) {
clearInterval(timer);
timer = null;
}
});
} else {
open()
}
});
};
// 按远程文件地址加载小程序
const loadMPdns = async (e) => {
appid = e.id;
let FURL = e.url;
uni.$emit('showLoading', true, `初始化中...`)
let count = 0;
timer = setInterval(() => {
if (count < 100 && count > 0) uni.$emit('showLoading', true, `初始化中... ${count}%`)
else uni.$emit('showLoading', true, `初始化中... 99%`)
}, 200)
let downloadTask = uni.downloadFile({
url: FURL,
success(res) {
wgtFile = res.tempFilePath;
console.log('初始化完成', wgtFile);
setTimeout(()=>{
installMP();
clearInterval(timer);
timer = null;
}, 700)
},
fail(res) {
clearInterval(timer);
timer = null;
uni.hideLoading();
}
});
downloadTask.onProgressUpdate((res) => {
// console.log('初始化进度' + res.progress);
if (res.progress > count) count += 10;
if (count >= 90) {
clearInterval(timer);
timer = null;
}
});
};
// 小程序版本信息
const getVersion = (id) => {
appid = id;
return new Promise((resolve, reject) => {
mp.getUniMPVersion(appid, (ret) => {
console.log('供销', ret);
});
})
}
// 初始化小程序
const installMP = () => {
mp.getUniMPVersion(appid, (ret) => {
doInstallMP();
console.log('getUniMPVersion: ' + JSON.stringify(ret));
});
};
const doInstallMP = () => {
mp.installUniMP({
appid: appid,
wgtFile: wgtFile
}, (r) => {
if (0 == r.code) {
open();
} else {
uni.hideLoading();
clearInterval(timer);
timer = null;
uni.showModal({
title: '初始化失败',
content: JSON.stringify(r),
showCancel: false
});
}
console.log('初始化: ' + JSON.stringify(r));
});
};
const open = (id = null) => {
uni.$emit('showLoading', false);
let token = uni.getStorageSync('LOGIN_STATUS_TOKEN');
if (!token) return uni.showToast({
icon: 'none',
title: '请先登录'
})
let avatar = store?.state?.userInfo?.avatar;
mp.openUniMP({
appid: id || appid,
extraData: {
uniMP: true,
token: token,
avatar: avatar,
}
}, (ret) => {
uni.hideLoading();
if (0 != ret.code) {
uni.showModal({
title: '启动失败',
content: JSON.stringify(ret),
showCancel: false
});
}
console.log('openUniMP: ' + JSON.stringify(ret));
});
}
export default {
loadMP,
loadMPurl,
loadMPx,
loadMPdns,
installMP,
loadAppletMP,
doInstallMP,
getVersion,
open
}

74
utils/uniMPevent.js Normal file
View File

@ -0,0 +1,74 @@
const mp = uni.requireNativePlugin('uniMP');
import {
uniMPgetLocation,
test
} from "@/utils/uniMPfunction.js"
export const initEvent = () => {
mp.onUniMPEventReceive(async (ret) => {
console.log('小程序事件: ', ret);
if (ret.event == 'closeApp') {
mp.closeUniMP(ret.fromAppid, (ret) => {
console.log('closeUniMP: ' + JSON.stringify(ret));
});
}
if (ret.event == 'getLocation') {
try {
console.log('获取定位');
let res = await uniMPgetLocation();
console.log(res);
// plus.geolocation.getCurrentPosition(function(position) {
// console.log('经度:' + position.coords.longitude);
// console.log('纬度:' + position.coords.latitude);
// // that.markers[1].latitude = position.coords.longitude;
// // that.markers[1].longitude = position.coords.longitude;
// mp.sendUniMPEvent(
// ret.fromAppid,
// 'getLocation', {...position.coords},
// (ret) => {
// console.log('Host sendEvent: ' + JSON.stringify(ret));
// });
// }, function(error) {
// console.error('获取位置失败:', error.message);
// }, {provider:'gps'});
mp.sendUniMPEvent(
ret.fromAppid,
'getLocation', {...res},
(ret) => {
console.log('Host sendEvent: ' + JSON.stringify(ret));
});
} catch (e) {
console.log(e);
}
}
if (ret.event == 'test') {
console.log('测试');
mp.sendUniMPEvent(
ret.fromAppid,
'test', { 'key': 'value', 'name': 'data' },
(ret) => {
console.log('Host sendEvent: ' + JSON.stringify(ret));
});
}
if (ret.event == 'log') {
// console.log('2222222')
console.log('收到小程序事件: ' + JSON.stringify(ret));
}
//直播小程序跳转商城购买商品
if (ret.event == 'live_shop') {
console.log(JSON.stringify(ret))
let arr1=ret.data
mp.closeUniMP(ret.fromAppid, (ret) => {
// console.log('closeUniMP: ' + JSON.stringify(ret));
setTimeout(()=>{
uni.navigateTo({
url:'/pages/goods_details/index?id='+arr1.app_goods_id
},1000)
})
});
// console.log('收到小程序事件: ' + JSON.stringify(ret));
}
});
}

21
utils/uniMPfunction.js Normal file
View File

@ -0,0 +1,21 @@
export const test = () => {
return '测试'
}
export const uniMPgetLocation = () => {
return new Promise((resolve, reject) => {
uni.getLocation({
type: 'wgs84',
geocode: true,
isHighAccuracy: true,
// altitude: true,
// accuracy: 'best',
success: (res) => {
resolve(res)
},
fail(e) {
resolve(e)
}
});
})
}