我们发布啦
commit
d1682fba15
|
@ -0,0 +1,85 @@
|
|||
|
||||
<script>
|
||||
import { checkLogin } from "./libs/login";
|
||||
import { HTTP_REQUEST_URL } from './config/app';
|
||||
|
||||
export default {
|
||||
globalData: {
|
||||
spid: 0,
|
||||
code:0,
|
||||
isLogin:false,
|
||||
userInfo:{},
|
||||
MyMenus:[]
|
||||
},
|
||||
onLaunch: function(option) {
|
||||
let that = this;
|
||||
// #ifdef MP
|
||||
if (HTTP_REQUEST_URL==''){
|
||||
console.error("请配置根目录下的config.js文件中的 'HTTP_REQUEST_URL'\n\n请修改开发者工具中【详情】->【AppID】改为自己的Appid\n\n请前往后台【小程序】->【小程序配置】填写自己的 appId and AppSecret");
|
||||
return false;
|
||||
}
|
||||
if (option.query.hasOwnProperty('scene')){
|
||||
switch (option.scene) {
|
||||
//扫描小程序码
|
||||
case 1047:
|
||||
let val = that.$util.getUrlParams(decodeURIComponent(option.query.scene));
|
||||
that.globalData.code = val.pid;
|
||||
break;
|
||||
//长按图片识别小程序码
|
||||
case 1048:
|
||||
that.globalData.code = option.query.scene;
|
||||
break;
|
||||
//手机相册选取小程序码
|
||||
case 1049:
|
||||
that.globalData.code = option.query.scene;
|
||||
break;
|
||||
//直接进入小程序
|
||||
case 1001:
|
||||
that.globalData.spid = option.query.scene;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
// 获取导航高度;
|
||||
uni.getSystemInfo({
|
||||
success: function (res) {
|
||||
that.globalData.navHeight = res.statusBarHeight * (750 / res.windowWidth) + 91;
|
||||
}
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
onHide: function() {
|
||||
//console.log('App Hide')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import url("@/plugin/animate/animate.min.css");
|
||||
@import 'static/css/base.css';
|
||||
@import 'static/iconfont/iconfont.css';
|
||||
@import 'static/css/guildford.css';
|
||||
@import 'static/css/style.scss';
|
||||
view{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.bg-color-red {
|
||||
background-color: #e93323!important;
|
||||
}
|
||||
.syspadding{
|
||||
padding-top: var(--status-bar-height);
|
||||
}
|
||||
.flex{
|
||||
display: flex;
|
||||
}
|
||||
.uni-scroll-view::-webkit-scrollbar {
|
||||
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
|
||||
display: none
|
||||
}
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,182 @@
|
|||
import request from "@/utils/request.js";
|
||||
/**
|
||||
*
|
||||
* 所有活动接口 包括:拼团,砍价,秒杀
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 拼团列表
|
||||
*
|
||||
*/
|
||||
export function getCombinationList(data) {
|
||||
return request.get('combination/list', data,{noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团详情
|
||||
*
|
||||
*/
|
||||
export function getCombinationDetail(id) {
|
||||
return request.get('combination/detail/'+id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团 开团
|
||||
*/
|
||||
export function getCombinationPink(id) {
|
||||
return request.get("combination/pink/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团 取消开团
|
||||
*/
|
||||
export function postCombinationRemove(data) {
|
||||
return request.post("combination/remove",data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价列表
|
||||
*/
|
||||
export function getBargainList(data) {
|
||||
return request.get("bargain/list", data,{noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 砍价列表(已参与)
|
||||
* @param object data
|
||||
*/
|
||||
export function getBargainUserList(data){
|
||||
return request.get('bargain/user/list',data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 取消砍价
|
||||
* @param int bargainId
|
||||
*/
|
||||
export function bargainUserCancel(bargainId){
|
||||
return request.post('bargain/user/cancel', { bargainId: bargainId})
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价产品详情
|
||||
*/
|
||||
export function getBargainDetail(id) {
|
||||
return request.get("bargain/detail/" + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价 开启砍价用户信息
|
||||
*/
|
||||
export function postBargainStartUser(data) {
|
||||
return request.post("bargain/start/user", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价开启
|
||||
*/
|
||||
export function postBargainStart(bargainId) {
|
||||
return request.post("bargain/start", { bargainId: bargainId});
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价 帮助好友砍价
|
||||
*/
|
||||
export function postBargainHelp(data) {
|
||||
return request.post("bargain/help", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价 砍掉金额
|
||||
*/
|
||||
export function postBargainHelpPrice(data) {
|
||||
return request.post("bargain/help/price", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价 砍价帮
|
||||
*/
|
||||
export function postBargainHelpList(data) {
|
||||
return request.post("bargain/help/list", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格
|
||||
*/
|
||||
export function postBargainHelpCount(data) {
|
||||
return request.post("bargain/help/count", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价 观看/分享/参与次数
|
||||
*/
|
||||
export function postBargainShare(bargainId) {
|
||||
return request.post("bargain/share", { bargainId: bargainId});
|
||||
}
|
||||
|
||||
/**
|
||||
* 秒杀产品时间区间
|
||||
*
|
||||
*/
|
||||
export function getSeckillIndexTime(){
|
||||
return request.get('seckill/index',{},{noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 秒杀产品列表
|
||||
* @param int time
|
||||
* @param object data
|
||||
*/
|
||||
export function getSeckillList(time,data){
|
||||
return request.get('seckill/list/'+time,data,{noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 秒杀产品详情
|
||||
* @param int id
|
||||
*/
|
||||
export function getSeckillDetail(id){
|
||||
return request.get('seckill/detail/'+id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价海报
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function getBargainPoster(data){
|
||||
return request.post('bargain/poster',data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团海报
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function getCombinationPoster(data){
|
||||
return request.post('combination/poster',data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价取消
|
||||
*/
|
||||
export function getBargainUserCancel(data) {
|
||||
return request.post("/bargain/user/cancel", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取秒杀小程序二维码
|
||||
*/
|
||||
export function seckillCode(id,data) {
|
||||
return request.get("seckill/code/"+id,data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拼团小程序二维码
|
||||
*/
|
||||
export function scombinationCode(id) {
|
||||
return request.get("combination/code/"+id);
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
import request from "@/utils/request.js";
|
||||
|
||||
/**
|
||||
* 统计数据
|
||||
*/
|
||||
export function getStatisticsInfo() {
|
||||
return request.get("/admin/order/statistics", {}, { login: true });
|
||||
}
|
||||
/**
|
||||
* 订单月统计
|
||||
*/
|
||||
export function getStatisticsMonth(where) {
|
||||
return request.get("/admin/order/data", where, { login: true });
|
||||
}
|
||||
/**
|
||||
* 订单月统计
|
||||
*/
|
||||
export function getAdminOrderList(where) {
|
||||
return request.get("/admin/order/list", where, { login: true });
|
||||
}
|
||||
/**
|
||||
* 订单改价
|
||||
*/
|
||||
export function setAdminOrderPrice(data) {
|
||||
return request.post("/admin/order/price", data, { login: true });
|
||||
}
|
||||
/**
|
||||
* 订单备注
|
||||
*/
|
||||
export function setAdminOrderRemark(data) {
|
||||
return request.post("/admin/order/remark", data, { login: true });
|
||||
}
|
||||
/**
|
||||
* 订单详情
|
||||
*/
|
||||
export function getAdminOrderDetail(orderId) {
|
||||
return request.get("/admin/order/detail/" + orderId, {}, { login: true });
|
||||
}
|
||||
/**
|
||||
* 订单发货信息获取
|
||||
*/
|
||||
export function getAdminOrderDelivery(orderId) {
|
||||
return request.get(
|
||||
"/admin/order/delivery/gain/" + orderId,
|
||||
{},
|
||||
{ login: true }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单发货保存
|
||||
*/
|
||||
export function setAdminOrderDelivery(data) {
|
||||
return request.post("/admin/order/delivery/keep", data, { login: true });
|
||||
}
|
||||
/**
|
||||
* 订单统计图
|
||||
*/
|
||||
export function getStatisticsTime(data) {
|
||||
return request.get("/admin/order/time", data, { login: true });
|
||||
}
|
||||
/**
|
||||
* 线下付款订单确认付款
|
||||
*/
|
||||
export function setOfflinePay(data) {
|
||||
return request.post("/admin/order/offline", data, { login: true });
|
||||
}
|
||||
/**
|
||||
* 订单确认退款
|
||||
*/
|
||||
export function setOrderRefund(data) {
|
||||
return request.post("/admin/order/refund", data, { login: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取快递公司
|
||||
* @returns {*}
|
||||
*/
|
||||
export function getLogistics() {
|
||||
return request.get("/logistics", {}, { login: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单核销
|
||||
* @returns {*}
|
||||
*/
|
||||
export function orderVerific(verify_code, is_confirm) {
|
||||
return request.post("order/order_verific", { verify_code, is_confirm });
|
||||
}
|
|
@ -0,0 +1,224 @@
|
|||
import request from "@/utils/request.js";
|
||||
/**
|
||||
* 公共接口 ,优惠券接口 , 行业此讯 , 手机号码注册
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取主页数据 无需授权
|
||||
*
|
||||
*/
|
||||
export function getIndexData()
|
||||
{
|
||||
return request.get("index",{},{ noAuth : true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录授权login
|
||||
*
|
||||
*/
|
||||
export function getLogo()
|
||||
{
|
||||
return request.get('wechat/getLogo', {}, { noAuth : true});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存form_id
|
||||
* @param string formId
|
||||
*/
|
||||
export function setFormId(formId) {
|
||||
return request.post("wechat/set_form_id", { formId: formId});
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取优惠卷
|
||||
* @param int couponId
|
||||
*
|
||||
*/
|
||||
export function setCouponReceive(couponId){
|
||||
return request.post('coupon/receive', { couponId: couponId});
|
||||
}
|
||||
/**
|
||||
* 优惠券列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getCoupons(data){
|
||||
return request.get('coupons',data,{noAuth:true})
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的优惠券
|
||||
* @param int types 0全部 1未使用 2已使用
|
||||
*/
|
||||
export function getUserCoupons(data){
|
||||
return request.get('coupon/list',data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章分类列表
|
||||
*
|
||||
*/
|
||||
export function getArticleCategoryList(){
|
||||
return request.get('article/category/list',{},{noAuth:true})
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章列表
|
||||
* @param int cid
|
||||
*
|
||||
*/
|
||||
export function getArticleList(cid,data){
|
||||
return request.get('article/list/' + cid, data,{noAuth:true})
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章 热门列表
|
||||
*
|
||||
*/
|
||||
export function getArticleHotList(){
|
||||
return request.get('article/hot/list',{},{noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章 轮播列表
|
||||
*
|
||||
*/
|
||||
export function getArticleBannerList(){
|
||||
return request.get('article/banner/list',{},{noAuth:true})
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章详情
|
||||
* @param int id
|
||||
*
|
||||
*/
|
||||
export function getArticleDetails(id){
|
||||
return request.get('article/info',id,{},{noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号+验证码登录接口
|
||||
* @param object data
|
||||
*/
|
||||
export function loginMobile(data){
|
||||
return request.post('login/mobile',data,{noAuth:true})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取短信KEY
|
||||
* @param object phone
|
||||
*/
|
||||
export function verifyCode(){
|
||||
return request.get('verify_code', {},{noAuth:true})
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码发送
|
||||
* @param object phone
|
||||
*/
|
||||
export function registerVerify(phone){
|
||||
return request.post('sendCode', { phone: phone },{noAuth:true},1)
|
||||
}
|
||||
// export function registerVerify(phone, reset, key, code){
|
||||
// return request.post('register/verify', { phone: phone, type: reset === undefined ? 'reset' : reset, key: key, code: code },{noAuth:true})
|
||||
// }
|
||||
|
||||
/**
|
||||
* 手机号注册
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function phoneRegister(data){
|
||||
return request.post('register',data,{noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号修改密码
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function phoneRegisterReset(data){
|
||||
return request.post('register/reset',data,{noAuth:true})
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号+密码登录
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function phoneLogin(data){
|
||||
return request.post('login',data,{noAuth:true})
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换H5登录
|
||||
* @param object data
|
||||
*/
|
||||
// #ifdef MP
|
||||
export function switchH5Login(){
|
||||
return request.post('switch_h5', { 'from':'routine'});
|
||||
}
|
||||
// #endif
|
||||
|
||||
/*
|
||||
* h5切换公众号登陆
|
||||
* */
|
||||
// #ifdef H5
|
||||
export function switchH5Login() {
|
||||
return request.post("switch_h5", { 'from': "wechat" });
|
||||
}
|
||||
// #endif
|
||||
|
||||
/**
|
||||
* 绑定手机号
|
||||
*
|
||||
*/
|
||||
export function bindingPhone(data){
|
||||
return request.post('binding',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登錄
|
||||
*
|
||||
*/
|
||||
export function logout(){
|
||||
return request.get('logout');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订阅消息id
|
||||
*/
|
||||
export function getTemlIds()
|
||||
{
|
||||
return request.get('wechat/teml_ids', {}, { noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页拼团数据
|
||||
*/
|
||||
export function pink()
|
||||
{
|
||||
return request.get('pink', {}, { noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取城市信息
|
||||
*/
|
||||
export function getCity() {
|
||||
return request.get('city/list', { }, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序直播列表
|
||||
*/
|
||||
export function getLiveList(page,limit) {
|
||||
return request.get('wechat/live', { page, limit}, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小程序二维码
|
||||
*/
|
||||
export function getQrcode(data) {
|
||||
return request.post('qrcode/get',data);
|
||||
}
|
|
@ -0,0 +1,187 @@
|
|||
import request from "@/utils/request.js";
|
||||
|
||||
/**
|
||||
* 获取购物车列表
|
||||
* @param numType boolean true 购物车数量,false=购物车产品数量
|
||||
*/
|
||||
export function getCartCounts(numType) {
|
||||
return request.get("cart/count", { numType: numType === undefined ? true : numType });
|
||||
}
|
||||
/**
|
||||
* 获取购物车列表
|
||||
*
|
||||
*/
|
||||
export function getCartList(data) {
|
||||
return request.get("cart/list",data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改购物车数量
|
||||
* @param int cartId 购物车id
|
||||
* @param int number 修改数量
|
||||
*/
|
||||
export function changeCartNum(cartId, number) {
|
||||
return request.post("cart/num", { id: cartId, number: number },{},1);
|
||||
}
|
||||
/**
|
||||
* 清除购物车
|
||||
* @param object ids join(',') 切割成字符串
|
||||
*/
|
||||
export function cartDel(ids){
|
||||
if (typeof ids === 'object')
|
||||
ids = ids.join(',');
|
||||
return request.post('cart/delete', { ids: ids},{},1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 购物车重选提交
|
||||
*
|
||||
*/
|
||||
export function getResetCart(data){
|
||||
return request.post('cart/resetcart', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getOrderList(data){
|
||||
return request.get('order/list',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单产品信息
|
||||
* @param string unique
|
||||
*/
|
||||
export function orderProduct(data){
|
||||
return request.post('order/product', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单评价
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function orderComment(data){
|
||||
return request.post('order/comment',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
* @param object data
|
||||
*/
|
||||
export function orderPay(data){
|
||||
return request.post('order/pay',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单统计数据
|
||||
*/
|
||||
export function orderData(){
|
||||
return request.get('order/data')
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单取消
|
||||
* @param string id
|
||||
*
|
||||
*/
|
||||
export function orderCancel(id){
|
||||
return request.post('order/cancel',{id:id},{},1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已完成订单
|
||||
* @param string uni
|
||||
*
|
||||
*/
|
||||
export function orderDel(uni){
|
||||
return request.post('order/del',{id:uni},{},1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
* @param string uni
|
||||
*/
|
||||
export function getOrderDetail(uni){
|
||||
return request.get('order/detail/'+uni);
|
||||
}
|
||||
|
||||
/**
|
||||
* 再次下单
|
||||
* @param string uni
|
||||
*
|
||||
*/
|
||||
export function orderAgain(uni){
|
||||
return request.post('order/again',{nui:uni});
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单收货
|
||||
* @param string uni
|
||||
*
|
||||
*/
|
||||
export function orderTake(uni){
|
||||
return request.post('order/take',{id:uni},{},1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单查询物流信息
|
||||
* @returns {*}
|
||||
*/
|
||||
export function express(uni) {
|
||||
return request.get("order/express/" + uni);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取退款理由
|
||||
*
|
||||
*/
|
||||
export function ordeRefundReason(){
|
||||
return request.get('order/refund/reason');
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款审核
|
||||
* @param object data
|
||||
*/
|
||||
export function orderRefundVerify(data){
|
||||
return request.post('order/refund/verify',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单确认获取订单详细信息
|
||||
* @param string cartId
|
||||
*/
|
||||
export function orderConfirm(cartId,isNew){
|
||||
return request.post('order/confirm', { cartIds: cartId,isNew:isNew}, {}, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前金额能使用的优惠卷
|
||||
* @param string price
|
||||
*
|
||||
*/
|
||||
export function getCouponsOrderPrice( data){
|
||||
return request.get('coupons/order', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单创建
|
||||
* @param string key
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function orderCreate(key,data){
|
||||
return request.post('order/create/'+key,data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算订单金额
|
||||
* @param key
|
||||
* @param data
|
||||
* @returns {*}
|
||||
*/
|
||||
export function postOrderComputed(key, data) {
|
||||
return request.post("order/computed/" + key, data);
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
import request from "@/utils/request.js";
|
||||
import wechat from "@/libs/wechat.js";
|
||||
|
||||
/**
|
||||
* 获取微信公众号js配置
|
||||
* @returns {*}
|
||||
*/
|
||||
// export function getWechatConfig() {
|
||||
// return request.get(
|
||||
// "wechat/config?t="+ Date.parse(new Date()),
|
||||
// { url: encodeURIComponent(wechat.signLink()) },
|
||||
// { noAuth: true }
|
||||
// );
|
||||
// }
|
||||
|
||||
export function getWechatConfig() {
|
||||
return request.get(
|
||||
"wechat/config",
|
||||
{ url: encodeURIComponent(location.href.split('#')[0]) },
|
||||
{ noAuth: true }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信sdk配置
|
||||
* @returns {*}
|
||||
*/
|
||||
export function wechatAuth(code, spread, login_type) {
|
||||
return request.get(
|
||||
"wechat/authorize/login",
|
||||
{ code, spread, login_type },
|
||||
{ noAuth: true }
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录授权login
|
||||
*
|
||||
*/
|
||||
export function getLogo()
|
||||
{
|
||||
// wechat/get_logo
|
||||
return request.get('wechat/getLogo', {}, { noAuth : true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序用户登录
|
||||
* @param data object 小程序用户登陆信息
|
||||
*/
|
||||
export function login(code,data) {
|
||||
return request.post("wechat/authorize/program/login?code="+code, data, { noAuth : true });
|
||||
}
|
||||
/**
|
||||
* 分享
|
||||
* @returns {*}
|
||||
*/
|
||||
export function getShare() {
|
||||
return request.get("share", {}, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注海报
|
||||
* @returns {*}
|
||||
*/
|
||||
export function follow() {
|
||||
return request.get("wechat/follow", {}, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片base64
|
||||
* @retins {*}
|
||||
* */
|
||||
export function imageBase64(image) {
|
||||
return request.post("qrcode/base64",image,{},1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动复制口令功能
|
||||
* @returns {*}
|
||||
*/
|
||||
export function copyWords() {
|
||||
return request.get("copy_words", {}, { noAuth: true });
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
import request from "@/utils/request.js";
|
||||
|
||||
/**
|
||||
* 获取产品详情
|
||||
* @param int id
|
||||
*
|
||||
*/
|
||||
export function getProductDetail(id) {
|
||||
return request.get('product/detail/' + id, {}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品分享二维码 推广员
|
||||
* @param int id
|
||||
*/
|
||||
// #ifndef MP
|
||||
export function getProductCode(id) {
|
||||
return request.get('product/code/' + id, {});
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
export function getProductCode(id) {
|
||||
return request.get('product/code/' + id, {
|
||||
user_type: 'routine'
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
|
||||
/**
|
||||
* 添加收藏
|
||||
* @param int id
|
||||
* @param string category product=普通产品,product_seckill=秒杀产品
|
||||
*/
|
||||
export function collectAdd(id, category) {
|
||||
return request.post('collect/add', {
|
||||
id: id,
|
||||
'category': category === undefined ? 'product' : category
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收藏产品
|
||||
* @param int id
|
||||
* @param string category product=普通产品,product_seckill=秒杀产品
|
||||
*/
|
||||
export function collectDel(id, category) {
|
||||
return request.post('collect/del', {
|
||||
id: id,
|
||||
'category': category === undefined ? 'product' : category
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 购车添加
|
||||
*
|
||||
*/
|
||||
export function postCartAdd(data) {
|
||||
return request.post('cart/save', data, {},1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分类列表
|
||||
*
|
||||
*/
|
||||
export function getCategoryList() {
|
||||
return request.get('category', {}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getProductslist(data) {
|
||||
return request.get('products', data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推荐产品
|
||||
*
|
||||
*/
|
||||
export function getProductHot(page, limit) {
|
||||
return request.get("product/hot", {
|
||||
page: page === undefined ? 1 : page,
|
||||
limit: limit === undefined ? 4 : limit
|
||||
}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量收藏
|
||||
*
|
||||
* @param object id 产品编号 join(',') 切割成字符串
|
||||
* @param string category
|
||||
*/
|
||||
export function collectAll(id, category) {
|
||||
return request.post('collect/all', {
|
||||
id: id,
|
||||
category: category === undefined ? 'product' : category
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页产品的轮播图和产品信息
|
||||
* @param int type
|
||||
*
|
||||
*/
|
||||
export function getGroomList(type, data) {
|
||||
return request.get('groom/list/' + type, data, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收藏列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getCollectUserList(data) {
|
||||
return request.get('collect/user', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品评论
|
||||
* @param int id
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function getReplyList(id, data) {
|
||||
return request.get('reply/list/' + id, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品评价数量和好评度
|
||||
* @param int id
|
||||
*/
|
||||
export function getReplyConfig(id) {
|
||||
return request.get('reply/config/' + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取搜索关键字获取
|
||||
*
|
||||
*/
|
||||
export function getSearchKeyword() {
|
||||
return request.get('search/keyword', {}, {
|
||||
noAuth: true
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店列表
|
||||
* @returns {*}
|
||||
*/
|
||||
export function storeListApi(data) {
|
||||
return request.post("store/list", data, {}, 1);
|
||||
}
|
|
@ -0,0 +1,395 @@
|
|||
import request from "@/utils/request.js";
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
*/
|
||||
export function getUserInfo(){
|
||||
return request.get('user');
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户分享
|
||||
*
|
||||
*/
|
||||
export function userShare(){
|
||||
return request.post('user/share');
|
||||
}
|
||||
|
||||
/**
|
||||
* h5用户登录
|
||||
* @param data object 用户账号密码
|
||||
*/
|
||||
export function loginH5(data) {
|
||||
return request.post("login", data, { noAuth : true });
|
||||
}
|
||||
|
||||
/**
|
||||
* h5用户手机号登录
|
||||
* @param data object 用户手机号 也只能
|
||||
*/
|
||||
export function loginMobile(data) {
|
||||
return request.post("login/mobile", data, { noAuth : true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码key
|
||||
*/
|
||||
export function getCodeApi() {
|
||||
return request.get("verify_code", {}, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* h5用户发送验证码
|
||||
* @param data object 用户手机号
|
||||
*/
|
||||
export function registerVerify(phone){
|
||||
return request.post('sendCode', { phone: phone },{noAuth:true},1)
|
||||
}
|
||||
// export function registerVerify(data) {
|
||||
// return request.post("register/verify", data, { noAuth : true });
|
||||
// }
|
||||
|
||||
/**
|
||||
* h5用户手机号注册
|
||||
* @param data object 用户手机号 验证码 密码
|
||||
*/
|
||||
export function register(data) {
|
||||
return request.post("register", data, { noAuth : true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户手机号修改密码
|
||||
* @param data object 用户手机号 验证码 密码
|
||||
*/
|
||||
export function registerReset(data) {
|
||||
return request.post("register/reset", data, { noAuth: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户中心菜单
|
||||
*
|
||||
*/
|
||||
export function getMenuList() {
|
||||
return request.get("menu/user");
|
||||
}
|
||||
|
||||
/*
|
||||
* 签到用户信息
|
||||
* */
|
||||
export function postSignUser(sign) {
|
||||
return request.post("user/sign/user", sign);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签到配置
|
||||
*
|
||||
*/
|
||||
export function getSignConfig(){
|
||||
return request.get('user/sign/config')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签到列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getSignList(data){
|
||||
return request.get('user/sign/list',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户签到
|
||||
*/
|
||||
export function setSignIntegral(){
|
||||
return request.get('user/sign/integral')
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到列表(年月)
|
||||
* @param object data
|
||||
*
|
||||
*/
|
||||
export function getSignMonthList(data){
|
||||
return request.get('user/sign/month',data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动状态
|
||||
*
|
||||
*/
|
||||
export function userActivity(){
|
||||
return request.get('user/activity');
|
||||
}
|
||||
|
||||
/*
|
||||
* 资金明细(types|0=全部,1=消费,2=充值,3=返佣,4=提现)
|
||||
* */
|
||||
export function getCommissionInfo(q, types) {
|
||||
return request.get("spread/commission/" + types, q);
|
||||
}
|
||||
|
||||
/*
|
||||
* 积分记录
|
||||
* */
|
||||
export function getIntegralList(q) {
|
||||
return request.get("integral/list", q);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分销海报图片
|
||||
*
|
||||
*/
|
||||
export function spreadBanner(data){
|
||||
return request.get('user/spread/banner',data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取推广用户一级和二级
|
||||
* @param object data
|
||||
*/
|
||||
export function spreadPeople(data){
|
||||
return request.get('spread/people',data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 推广佣金/提现总和
|
||||
* @param int type
|
||||
*/
|
||||
export function spreadCount(type){
|
||||
return request.get('spread/count/'+type);
|
||||
}
|
||||
|
||||
/*
|
||||
* 推广数据
|
||||
* */
|
||||
export function getSpreadInfo() {
|
||||
return request.get("commission");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 推广订单
|
||||
* @param object data
|
||||
*/
|
||||
export function spreadOrder(data){
|
||||
return request.get('spread/order',data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取推广人排行
|
||||
* */
|
||||
export function getRankList(q) {
|
||||
return request.get("rank", q);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取佣金排名
|
||||
* */
|
||||
export function getBrokerageRank(q) {
|
||||
return request.get("brokerage_rank", q);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现申请
|
||||
* @param object data
|
||||
*/
|
||||
export function extractCash(data){
|
||||
return request.post('extract/cash',data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现银行/提现最低金额
|
||||
*
|
||||
*/
|
||||
export function extractBank(){
|
||||
return request.get('extract/bank');
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员等级列表
|
||||
*
|
||||
*/
|
||||
export function userLevelGrade(){
|
||||
return request.get('user/level/grade');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个等级任务
|
||||
* @param int id 任务id
|
||||
*/
|
||||
export function userLevelTask(id){
|
||||
return request.get('user/level/task/'+id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否可以成为会员
|
||||
*
|
||||
*/
|
||||
export function userLevelDetection(){
|
||||
return request.get('user/level/detection');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 地址列表
|
||||
* @param object data
|
||||
*/
|
||||
export function getAddressList(data){
|
||||
return request.get('address/list',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认地址
|
||||
* @param int id
|
||||
*/
|
||||
export function setAddressDefault(id){
|
||||
return request.post('address/default/set',{id:id})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改 添加地址
|
||||
* @param object data
|
||||
*/
|
||||
export function editAddress(data){
|
||||
return request.post('address/edit',data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地址
|
||||
* @param int id
|
||||
*
|
||||
*/
|
||||
export function delAddress(id){
|
||||
return request.post('address/del',{id:id})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个地址
|
||||
* @param int id
|
||||
*/
|
||||
export function getAddressDetail(id){
|
||||
return request.get('address/detail/'+id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
* @param object
|
||||
*/
|
||||
export function userEdit(data){
|
||||
return request.post('user/edit',data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 退出登录
|
||||
* */
|
||||
export function getLogout() {
|
||||
return request.get("logout");
|
||||
}
|
||||
/**
|
||||
* 小程序充值
|
||||
*
|
||||
*/
|
||||
export function rechargeRoutine(data){
|
||||
return request.post('recharge/routine',data)
|
||||
}
|
||||
/*
|
||||
* 公众号充值
|
||||
* */
|
||||
export function rechargeWechat(data) {
|
||||
return request.post("recharge/wechat", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 余额充值
|
||||
* */
|
||||
export function transferIn(data) {
|
||||
return request.post("recharge/transferIn", data,{},1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认地址
|
||||
*
|
||||
*/
|
||||
export function getAddressDefault(){
|
||||
return request.get('address/default');
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值金额选择
|
||||
*/
|
||||
export function getRechargeApi() {
|
||||
return request.get("recharge/index");
|
||||
}
|
||||
|
||||
/**
|
||||
* 登陆记录
|
||||
*/
|
||||
export function setVisit(data)
|
||||
{
|
||||
return request.post('user/set_visit', {...data}, { noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 客服列表
|
||||
*/
|
||||
export function serviceList() {
|
||||
return request.get("user/service/lst");
|
||||
}
|
||||
/**
|
||||
* 客服详情
|
||||
*/
|
||||
export function getChatRecord(to_uid, data) {
|
||||
return request.get("user/service/record/" + to_uid, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 静默绑定推广人
|
||||
* @param {Object} puid
|
||||
*/
|
||||
export function spread(puid)
|
||||
{
|
||||
return request.post("user/spread",{puid:puid});
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前用户在佣金排行第几名
|
||||
*
|
||||
*/
|
||||
export function brokerageRankNumber(data)
|
||||
{
|
||||
return request.get("user/brokerageRankNumber",data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员等级经验值;
|
||||
*
|
||||
*/
|
||||
export function getlevelInfo()
|
||||
{
|
||||
return request.get("user/level/grade");
|
||||
}
|
||||
|
||||
/**
|
||||
* 经验值明细;
|
||||
*
|
||||
*/
|
||||
export function getlevelExpList()
|
||||
{
|
||||
return request.get("user/expList");
|
||||
}
|
||||
|
||||
/**
|
||||
* 经验值明细;
|
||||
*
|
||||
*/
|
||||
export function getuserDalance()
|
||||
{
|
||||
return request.get("user/balance");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class='Popup' v-if='isShowAuth'>
|
||||
<image :src='logoUrl'></image>
|
||||
<view class='title'>授权提醒</view>
|
||||
<view class='tip'>请授权头像等信息,以便为您提供更好的服务</view>
|
||||
<view class='bottom flex'>
|
||||
<view class='item' @click='close'>随便逛逛</view>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<button class='item grant' @click="setUserInfo">去授权</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<button class='item grant' type="primary" open-type="getUserInfo" lang="zh_CN" @getuserinfo="setUserInfo">去授权</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<view class='mask' v-if='isShowAuth' @click='close'></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const app = getApp();
|
||||
import Cache from '../utils/cache';
|
||||
import { getLogo } from '../api/public';
|
||||
import { LOGO_URL } from '../config/cache';
|
||||
import { mapGetters } from 'vuex';
|
||||
import Routine from '../libs/routine';
|
||||
|
||||
export default {
|
||||
name:'Authorize',
|
||||
props:{
|
||||
isAuto:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
isGoIndex:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
isShowAuth:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
logoUrl:''
|
||||
}
|
||||
},
|
||||
computed:mapGetters(['isLogin','userInfo']),
|
||||
watch:{
|
||||
isLogin(n){
|
||||
n === true && this.$emit('onLoadFun',this.userInfo);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getLogoUrl();
|
||||
this.setAuthStatus();
|
||||
},
|
||||
methods:{
|
||||
setAuthStatus(){
|
||||
Routine.authorize().then(res=>{
|
||||
if(res.islogin === false)
|
||||
this.setUserInfo();
|
||||
else
|
||||
this.$emit('onLoadFun',this.userInfo);
|
||||
}).catch(res=>{
|
||||
if (this.isAuto)
|
||||
this.$emit('authColse',true);
|
||||
})
|
||||
},
|
||||
getUserInfo(code){
|
||||
Routine.getUserInfo().then(res=>{
|
||||
let userInfo = res.userInfo
|
||||
userInfo.code = code;
|
||||
userInfo.spread_spid = app.globalData.spid;//获取推广人ID
|
||||
userInfo.spread_code = app.globalData.code;//获取推广人分享二维码ID
|
||||
userInfo.avatar = userInfo.userInfo.avatarUrl;
|
||||
userInfo.city = userInfo.userInfo.city;
|
||||
userInfo.country = userInfo.userInfo.country;
|
||||
userInfo.nickName = userInfo.userInfo.nickName;
|
||||
userInfo.province = userInfo.userInfo.province;
|
||||
userInfo.sex = userInfo.userInfo.gender;
|
||||
Routine.authUserInfo(code,userInfo).then(res=>{
|
||||
uni.hideLoading();
|
||||
this.$emit('authColse',false);
|
||||
this.$emit('onLoadFun',this.userInfo);
|
||||
}).catch(res=>{
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:'none',
|
||||
duration:2000
|
||||
});
|
||||
})
|
||||
}).catch(res =>{
|
||||
uni.hideLoading();
|
||||
})
|
||||
},
|
||||
setUserInfo(){
|
||||
uni.showLoading({title:'正在登陆中'});
|
||||
Routine.getCode().then(code=>{
|
||||
this.getUserInfo(code);
|
||||
}).catch(res=>{
|
||||
uni.hideLoading();
|
||||
})
|
||||
},
|
||||
getLogoUrl(){
|
||||
let that = this;
|
||||
if (Cache.has(LOGO_URL)) {
|
||||
this.logoUrl = Cache.get(LOGO_URL);
|
||||
return;
|
||||
}
|
||||
getLogo().then(res=>{
|
||||
that.logoUrl = res.data.logo_url
|
||||
Cache.set(LOGO_URL,that.logoUrl);
|
||||
})
|
||||
},
|
||||
close(){
|
||||
let pages = getCurrentPages(), currPage = pages[pages.length - 1];
|
||||
if(this.isGoIndex){
|
||||
uni.switchTab({url:'/pages/index/index'});
|
||||
} else {
|
||||
this.$emit('authColse',false);
|
||||
}
|
||||
// if (currPage && currPage.isShowAuth != undefined){
|
||||
// currPage.isShowAuth = true;
|
||||
// }
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
.Popup{width:500rpx;background-color:#fff;position:fixed;top:50%;left:50%;margin-left:-250rpx;transform:translateY(-50%);z-index:320;}
|
||||
.Popup image{width:150rpx;height:150rpx;margin:-67rpx auto 0 auto;display:block;border: 8rpx solid #fff;border-radius: 50%}
|
||||
.Popup .title{font-size:28rpx;color:#000;text-align:center;margin-top: 30rpx}
|
||||
.Popup .tip{font-size:22rpx;color:#555;padding:0 24rpx;margin-top:25rpx;}
|
||||
.Popup .bottom .item{width:50%;height:80rpx;background-color:#eeeeee;text-align:center;line-height:80rpx;font-size:24rpx;color:#666;margin-top:54rpx;}
|
||||
.Popup .bottom .item.on{width: 100%}
|
||||
.flex{display:flex;}
|
||||
.Popup .bottom .item.grant{font-size:28rpx;color:#fff;font-weight:bold;background-color:#e93323;border-radius:0;padding:0;}
|
||||
.mask{position:fixed;top:0;right:0;left:0;bottom:0;background-color:rgba(0,0,0,0.65);z-index:310;}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,154 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class='Popup' v-if='isShowAuth'>
|
||||
<image :src='logoUrl'></image>
|
||||
<view class='title'>授权提醒</view>
|
||||
<view class='tip'>请授权头像等信息,以便为您提供更好的服务</view>
|
||||
<view class='bottom flex'>
|
||||
<view class='item' @click='close'>随便逛逛</view>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<button class='item grant' @click="setUserInfo">去授权</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<button class='item grant' type="primary" open-type="getPhoneNumber" lang="zh_CN" @getphonenumber="setUserInfo">去授权</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<view class='mask' v-if='isShowAuth' @click='close'></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const app = getApp();
|
||||
import Cache from '../utils/cache';
|
||||
import { getLogo } from '../api/public';
|
||||
import { LOGO_URL } from '../config/cache';
|
||||
import { mapGetters } from 'vuex';
|
||||
import Routine from '../libs/routine';
|
||||
|
||||
export default {
|
||||
name:'Authorize',
|
||||
props:{
|
||||
isAuto:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
isGoIndex:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
isShowAuth:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
logoUrl:''
|
||||
}
|
||||
},
|
||||
computed:mapGetters(['isLogin','userInfo']),
|
||||
watch:{
|
||||
isLogin(n){
|
||||
n === true && this.$emit('onLoadFun',this.userInfo);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getLogoUrl();
|
||||
this.setAuthStatus();
|
||||
},
|
||||
methods:{
|
||||
setAuthStatus(){
|
||||
Routine.authorize().then(res=>{
|
||||
if(res.islogin === false)
|
||||
this.setUserInfo();
|
||||
else
|
||||
this.$emit('onLoadFun',this.userInfo);
|
||||
}).catch(res=>{
|
||||
if (this.isAuto)
|
||||
this.$emit('authColse',true);
|
||||
})
|
||||
},
|
||||
getUserInfo(code){
|
||||
console.log(456);
|
||||
Routine.getUserInfo().then(res=>{
|
||||
console.log(123);
|
||||
console.log(res);
|
||||
let userInfo = res.userInfo
|
||||
userInfo.code = code;
|
||||
userInfo.spread_spid = app.globalData.spid;//获取推广人ID
|
||||
userInfo.spread_code = app.globalData.code;//获取推广人分享二维码ID
|
||||
userInfo.avatar = userInfo.userInfo.avatarUrl;
|
||||
userInfo.city = userInfo.userInfo.city;
|
||||
userInfo.country = userInfo.userInfo.country;
|
||||
userInfo.nickName = userInfo.userInfo.nickName;
|
||||
userInfo.province = userInfo.userInfo.province;
|
||||
userInfo.sex = userInfo.userInfo.gender;
|
||||
Routine.authUserInfo(code,userInfo).then(res=>{
|
||||
uni.hideLoading();
|
||||
this.$emit('authColse',false);
|
||||
this.$emit('onLoadFun',this.userInfo);
|
||||
}).catch(res=>{
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon:'none',
|
||||
duration:2000
|
||||
});
|
||||
})
|
||||
}).catch(res =>{
|
||||
uni.hideLoading();
|
||||
})
|
||||
},
|
||||
setUserInfo(e){
|
||||
console.log('78878787');
|
||||
console.log(e);
|
||||
uni.showLoading({title:'正在登陆中'});
|
||||
if(e.detail.errMsg == "getPhoneNumber:ok"){
|
||||
console.log('授权成功');
|
||||
Routine.getCode().then(code=>{
|
||||
console.log(code);
|
||||
this.getUserInfo(code);
|
||||
}).catch(res=>{
|
||||
uni.hideLoading();
|
||||
})
|
||||
}
|
||||
},
|
||||
getLogoUrl(){
|
||||
let that = this;
|
||||
if (Cache.has(LOGO_URL)) {
|
||||
this.logoUrl = Cache.get(LOGO_URL);
|
||||
return;
|
||||
}
|
||||
getLogo().then(res=>{
|
||||
that.logoUrl = res.data.logo_url
|
||||
Cache.set(LOGO_URL,that.logoUrl);
|
||||
})
|
||||
},
|
||||
close(){
|
||||
let pages = getCurrentPages(), currPage = pages[pages.length - 1];
|
||||
if(this.isGoIndex){
|
||||
uni.switchTab({url:'/pages/index/index'});
|
||||
} else {
|
||||
this.$emit('authColse',false);
|
||||
}
|
||||
// if (currPage && currPage.isShowAuth != undefined){
|
||||
// currPage.isShowAuth = true;
|
||||
// }
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
.Popup{width:500rpx;background-color:#fff;position:fixed;top:50%;left:50%;margin-left:-250rpx;transform:translateY(-50%);z-index:320;}
|
||||
.Popup image{width:150rpx;height:150rpx;margin:-67rpx auto 0 auto;display:block;border: 8rpx solid #fff;border-radius: 50%}
|
||||
.Popup .title{font-size:28rpx;color:#000;text-align:center;margin-top: 30rpx}
|
||||
.Popup .tip{font-size:22rpx;color:#555;padding:0 24rpx;margin-top:25rpx;}
|
||||
.Popup .bottom .item{width:50%;height:80rpx;background-color:#eeeeee;text-align:center;line-height:80rpx;font-size:24rpx;color:#666;margin-top:54rpx;}
|
||||
.Popup .bottom .item.on{width: 100%}
|
||||
.flex{display:flex;}
|
||||
.Popup .bottom .item.grant{font-size:28rpx;color:#fff;font-weight:bold;background-color:#e93323;border-radius:0;padding:0;}
|
||||
.mask{position:fixed;top:0;right:0;left:0;bottom:0;background-color:rgba(0,0,0,0.65);z-index:310;}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,57 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="Loads acea-row row-center-wrapper" v-if="loading && !loaded" style="margin-top: .2rem;">
|
||||
<view v-if="loading">
|
||||
<view class="iconfont icon-jiazai loading acea-row row-center-wrapper"></view>
|
||||
正在加载中
|
||||
</view>
|
||||
<view v-else>
|
||||
上拉加载更多
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Loading",
|
||||
props: {
|
||||
loaded: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.Loads {
|
||||
height: 80upx;
|
||||
font-size: 25upx;
|
||||
color: #000;
|
||||
}
|
||||
.Loads .iconfont {
|
||||
font-size: 30upx;
|
||||
margin-right: 10upx;
|
||||
height: 32upx;
|
||||
line-height: 32upx;
|
||||
}
|
||||
/*加载动画*/
|
||||
@keyframes load {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.loadingpic {
|
||||
animation: load 3s linear 1s infinite;
|
||||
}
|
||||
.loading {
|
||||
animation: load linear 1s infinite;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,173 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="priceChange" :class="change === true ? 'on' : ''">
|
||||
<view class="priceTitle">
|
||||
{{
|
||||
status == 0
|
||||
? orderInfo.refund_status === 1
|
||||
? "立即退款"
|
||||
: "一键改价"
|
||||
: "订单备注"
|
||||
}}
|
||||
<span class="iconfont icon-guanbi" @click="close"></span>
|
||||
</view>
|
||||
<view class="listChange" v-if="status == 0">
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-if="orderInfo.refund_status === 0"
|
||||
>
|
||||
<view>商品总价(¥)</view>
|
||||
<view class="money">
|
||||
{{ orderInfo.total_price }}<span class="iconfont icon-suozi"></span>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-if="orderInfo.refund_status === 0"
|
||||
>
|
||||
<view>原始邮费(¥)</view>
|
||||
<view class="money">
|
||||
{{ orderInfo.pay_postage }}<span class="iconfont icon-suozi"></span>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-if="orderInfo.refund_status === 0"
|
||||
>
|
||||
<view>实际支付(¥)</view>
|
||||
<view class="money">
|
||||
<input
|
||||
type="text"
|
||||
v-model="price"
|
||||
:class="focus === true ? 'on' : ''"
|
||||
@focus="priceChange"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-if="orderInfo.refund_status === 1"
|
||||
>
|
||||
<view>实际支付(¥)</view>
|
||||
<view class="money">
|
||||
{{ orderInfo.pay_price }}<span class="iconfont icon-suozi"></span>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-if="orderInfo.refund_status === 1"
|
||||
>
|
||||
<view>退款金额(¥)</view>
|
||||
<view class="money">
|
||||
<input
|
||||
type="text"
|
||||
v-model="refund_price"
|
||||
:class="focus === true ? 'on' : ''"
|
||||
@focus="priceChange"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="listChange" v-else>
|
||||
<textarea
|
||||
:placeholder="
|
||||
orderInfo.remark ? orderInfo.remark : '请填写备注信息...'
|
||||
"
|
||||
v-model="remark"
|
||||
></textarea>
|
||||
</view>
|
||||
<view class="modify" @click="save">
|
||||
{{
|
||||
status === 1 || orderInfo.refund_status == 0 ? "立即修改" : "确认退款"
|
||||
}}
|
||||
</view>
|
||||
<view
|
||||
class="modify1"
|
||||
@click="refuse"
|
||||
v-if="orderInfo.refund_status == 1 && status == 0"
|
||||
>
|
||||
拒绝退款
|
||||
</view>
|
||||
</view>
|
||||
<view class="mask" @touchmove.prevent v-show="change === true"></view>
|
||||
</view>
|
||||
</template>
|
||||
<style>
|
||||
.priceChange{position:fixed;width:580upx;height:670upx;background-color:#fff;border-radius:10upx;top:50%;left:50%;margin-left:-290upx;margin-top:-335upx;z-index:666;transition:all 0.3s ease-in-out 0s;transform: scale(0);opacity:0;}
|
||||
.priceChange.on{opacity:1;transform: scale(1);}
|
||||
.priceChange .priceTitle{background:url("~@/static/images/pricetitle.jpg") no-repeat;background-size:100% 100%;width:100%;height:160upx;border-radius:10upx 10upx 0 0;text-align:center;font-size:40upx;color:#fff;line-height:160upx;position:relative;}
|
||||
.priceChange .priceTitle .iconfont{position:absolute;font-size:40upx;right:26upx;top:23upx;width:40upx;height:40upx;line-height:40upx;}
|
||||
.priceChange .listChange{padding:0 40upx;}
|
||||
.priceChange .listChange textarea{box-sizing: border-box;}
|
||||
.priceChange .listChange .item{height:103upx;border-bottom:1px solid #e3e3e3;font-size:32upx;color:#333;}
|
||||
.priceChange .listChange .item .money{color:#666;width:300upx;text-align:right;}
|
||||
.priceChange .listChange .item .money .iconfont{font-size:32upx;margin-left:20upx;}
|
||||
.priceChange .listChange .item .money input{width:100%;height:100%;text-align:right;color:#ccc;}
|
||||
.priceChange .listChange .item .money input.on{color:#666;}
|
||||
.priceChange .modify{font-size:32upx;color:#fff;width:490upx;height:90upx;text-align:center;line-height:90upx;border-radius:45upx;background-color:#2291f8;margin:53upx auto 0 auto;}
|
||||
.priceChange .modify1{font-size:32upx;color:#312b2b;width:490upx;height:90upx;text-align:center;line-height:90upx;border-radius:45upx;background-color:#eee;margin:30upx auto 0 auto;}
|
||||
.priceChange .listChange textarea {
|
||||
border: 1px solid #eee;
|
||||
width: 100%;
|
||||
height: 200upx;
|
||||
margin-top: 50upx;
|
||||
border-radius: 10upx;
|
||||
color: #333;
|
||||
padding: 20upx;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
export default {
|
||||
name: "PriceChange",
|
||||
components: {},
|
||||
props: {
|
||||
change: Boolean,
|
||||
orderInfo: Object,
|
||||
status: String
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
focus: false,
|
||||
price: 0,
|
||||
refund_price: 0,
|
||||
remark: ""
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
orderInfo: function(nVal) {
|
||||
this.price = this.orderInfo.pay_price;
|
||||
this.refund_price = this.orderInfo.pay_price;
|
||||
this.remark = "";
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
},
|
||||
methods: {
|
||||
priceChange: function() {
|
||||
this.focus = true;
|
||||
},
|
||||
close: function() {
|
||||
this.price = this.orderInfo.pay_price;
|
||||
this.$emit("closechange", false);
|
||||
},
|
||||
save: function() {
|
||||
let that = this;
|
||||
that.$emit("savePrice", {
|
||||
price: that.price,
|
||||
refund_price: that.refund_price,
|
||||
type: 1,
|
||||
remark: that.remark
|
||||
});
|
||||
},
|
||||
refuse: function() {
|
||||
let that = this;
|
||||
that.$emit("savePrice", {
|
||||
price: that.price,
|
||||
refund_price: that.refund_price,
|
||||
type: 2,
|
||||
remark: that.remark
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,185 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="address-window" :class="address.address==true?'on':''">
|
||||
<view class='title'>选择地址<text class='iconfont icon-guanbi' @tap='close'></text></view>
|
||||
<view class='list'>
|
||||
<view class='item acea-row row-between-wrapper' :class='active==index?"font-color":""' v-for="(item,index) in addressList"
|
||||
@tap='tapAddress(index,item.id)' :key='index'>
|
||||
<text class='iconfont icon-ditu' :class='active==index?"font-color":""'></text>
|
||||
<view class='address'>
|
||||
<view class='name' :class='active==index?"font-color":""'>{{item.real_name}}<text class='phone'>{{item.phone}}</text></view>
|
||||
<view class='line1'>{{item.province}}{{item.city}}{{item.district}}{{item.detail}}</view>
|
||||
</view>
|
||||
<text class='iconfont icon-complete' :class='active==index?"font-color":""'></text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 无地址 -->
|
||||
<view class='pictrue' v-if="!is_loading && !addressList.length">
|
||||
<image src='../../static/images/noAddress.png'></image>
|
||||
</view>
|
||||
<view class='addressBnt bg-color' @tap='goAddressPages'>选择其地址</view>
|
||||
</view>
|
||||
<view class='mask' catchtouchmove="true" :hidden='address.address==false' @tap='close'></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getAddressList
|
||||
} from '@/api/user.js';
|
||||
export default {
|
||||
props: {
|
||||
pagesUrl: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
address: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
return {
|
||||
address: true,
|
||||
addressId: 0,
|
||||
};
|
||||
}
|
||||
},
|
||||
isLog: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
active: 0,
|
||||
//地址列表
|
||||
addressList: [],
|
||||
is_loading: true
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
tapAddress: function(e, addressid) {
|
||||
this.active = e;
|
||||
this.$emit('OnChangeAddress', addressid);
|
||||
},
|
||||
close: function() {
|
||||
this.$emit('changeClose');
|
||||
this.$emit('changeTextareaStatus');
|
||||
},
|
||||
goAddressPages: function() {
|
||||
this.$emit('changeClose');
|
||||
this.$emit('changeTextareaStatus');
|
||||
uni.navigateTo({
|
||||
url: this.pagesUrl
|
||||
});
|
||||
|
||||
},
|
||||
getAddressList: function() {
|
||||
let that = this;
|
||||
getAddressList({
|
||||
page: 1,
|
||||
limit: 5
|
||||
}).then(res => {
|
||||
let addressList = res.data;
|
||||
//处理默认选中项
|
||||
for (let i = 0, leng = addressList.length; i < leng; i++) {
|
||||
if (addressList[i].id == that.address.addressId) {
|
||||
that.active = i;
|
||||
}
|
||||
}
|
||||
that.$set(that, 'addressList', addressList);
|
||||
that.is_loading = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.address-window {
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 101;
|
||||
transform: translate3d(0, 100%, 0);
|
||||
transition: all .3s cubic-bezier(.25, .5, .5, .9);
|
||||
}
|
||||
|
||||
.address-window.on {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
.address-window .title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
height: 123rpx;
|
||||
line-height: 123rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.address-window .title .iconfont {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
color: #8a8a8a;
|
||||
font-size: 35rpx;
|
||||
}
|
||||
|
||||
.address-window .list .item {
|
||||
margin-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
border-bottom: 1px solid #eee;
|
||||
height: 129rpx;
|
||||
font-size: 25rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.address-window .list .item .iconfont {
|
||||
font-size: 37rpx;
|
||||
color: #2c2c2c;
|
||||
}
|
||||
|
||||
.address-window .list .item .iconfont.icon-complete {
|
||||
font-size: 30rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.address-window .list .item .address {
|
||||
width: 560rpx;
|
||||
}
|
||||
|
||||
.address-window .list .item .address .name {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #282828;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.address-window .list .item .address .name .phone {
|
||||
margin-left: 18rpx;
|
||||
}
|
||||
|
||||
.address-window .addressBnt {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
width: 690rpx;
|
||||
height: 86rpx;
|
||||
border-radius: 43rpx;
|
||||
text-align: center;
|
||||
line-height: 86rpx;
|
||||
margin: 85rpx auto;
|
||||
}
|
||||
|
||||
.address-window .pictrue {
|
||||
width: 414rpx;
|
||||
height: 336rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.address-window .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,184 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="address-window" :class="address.address==true?'on':''">
|
||||
<view class='title'>选择地址<text class='iconfont icon-guanbi' @tap='close'></text></view>
|
||||
<view class='list'>
|
||||
<view class='item acea-row row-between-wrapper' :class='active==index?"font-color":""' v-for="(item,index) in addressList"
|
||||
@tap='tapAddress(index,item.id)' :key='index'>
|
||||
<text class='iconfont icon-ditu' :class='active==index?"font-color":""'></text>
|
||||
<view class='address'>
|
||||
<view class='name' :class='active==index?"font-color":""'>{{item.realName}}<text class='phone'>{{item.phone}}</text></view>
|
||||
<view class='line1'>{{item.province}}{{item.city}}{{item.district}}{{item.detail}}</view>
|
||||
</view>
|
||||
<text class='iconfont icon-complete' :class='active==index?"font-color":""'></text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 无地址 -->
|
||||
<view class='pictrue' v-if="!is_loading && !addressList.length">
|
||||
<image src='../../static/images/noAddress.png'></image>
|
||||
</view>
|
||||
<view class='addressBnt bg-color' @tap='goAddressPages'>选择其地址</view>
|
||||
</view>
|
||||
<view class='mask' catchtouchmove="true" :hidden='address.address==false' @tap='close'></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getAddressList
|
||||
} from '@/api/user.js';
|
||||
export default {
|
||||
props: {
|
||||
pagesUrl: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
address: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
return {
|
||||
address: true,
|
||||
addressId: 0,
|
||||
};
|
||||
}
|
||||
},
|
||||
isLog: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
active: 0,
|
||||
//地址列表
|
||||
addressList: [],
|
||||
is_loading: true
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
tapAddress: function(e, addressid) {
|
||||
this.active = e;
|
||||
this.$emit('OnChangeAddress', addressid);
|
||||
},
|
||||
close: function() {
|
||||
this.$emit('changeClose');
|
||||
this.$emit('changeTextareaStatus');
|
||||
},
|
||||
goAddressPages: function() {
|
||||
this.$emit('changeClose');
|
||||
this.$emit('changeTextareaStatus');
|
||||
uni.navigateTo({
|
||||
url: this.pagesUrl
|
||||
});
|
||||
},
|
||||
getAddressList: function() {
|
||||
let that = this;
|
||||
getAddressList({
|
||||
page: 1,
|
||||
limit: 5
|
||||
}).then(res => {
|
||||
let addressList = res.data.list;
|
||||
//处理默认选中项
|
||||
for (let i = 0, leng = addressList.length; i < leng; i++) {
|
||||
if (addressList[i].id == that.address.addressId) {
|
||||
that.active = i;
|
||||
}
|
||||
}
|
||||
that.$set(that, 'addressList', addressList);
|
||||
that.is_loading = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.address-window {
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 101;
|
||||
transform: translate3d(0, 100%, 0);
|
||||
transition: all .3s cubic-bezier(.25, .5, .5, .9);
|
||||
}
|
||||
|
||||
.address-window.on {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
.address-window .title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
height: 123rpx;
|
||||
line-height: 123rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.address-window .title .iconfont {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
color: #8a8a8a;
|
||||
font-size: 35rpx;
|
||||
}
|
||||
|
||||
.address-window .list .item {
|
||||
margin-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
border-bottom: 1px solid #eee;
|
||||
height: 129rpx;
|
||||
font-size: 25rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.address-window .list .item .iconfont {
|
||||
font-size: 37rpx;
|
||||
color: #2c2c2c;
|
||||
}
|
||||
|
||||
.address-window .list .item .iconfont.icon-complete {
|
||||
font-size: 30rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.address-window .list .item .address {
|
||||
width: 560rpx;
|
||||
}
|
||||
|
||||
.address-window .list .item .address .name {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #282828;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.address-window .list .item .address .name .phone {
|
||||
margin-left: 18rpx;
|
||||
}
|
||||
|
||||
.address-window .addressBnt {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
width: 690rpx;
|
||||
height: 86rpx;
|
||||
border-radius: 43rpx;
|
||||
text-align: center;
|
||||
line-height: 86rpx;
|
||||
margin: 85rpx auto;
|
||||
}
|
||||
|
||||
.address-window .pictrue {
|
||||
width: 414rpx;
|
||||
height: 336rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.address-window .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,120 @@
|
|||
<template>
|
||||
<view class="time" :style="justifyLeft">
|
||||
<text class="red" v-if="tipText">{{ tipText }}</text>
|
||||
<text class="styleAll" v-if="isDay === true">{{ day }}</text>
|
||||
<text class="timeTxt red" v-if="dayText">{{ dayText }}</text>
|
||||
<text class="styleAll">{{ hour }}</text>
|
||||
<text class="timeTxt red" v-if="hourText">{{ hourText }}</text>
|
||||
<text class="styleAll">{{ minute }}</text>
|
||||
<text class="timeTxt red" v-if="minuteText">{{ minuteText }}</text>
|
||||
<text class="styleAll">{{ second }}</text>
|
||||
<text class="timeTxt red" v-if="secondText">{{ secondText }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "countDown",
|
||||
props: {
|
||||
justifyLeft: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
//距离开始提示文字
|
||||
tipText: {
|
||||
type: String,
|
||||
default: "倒计时"
|
||||
},
|
||||
dayText: {
|
||||
type: String,
|
||||
default: "天"
|
||||
},
|
||||
hourText: {
|
||||
type: String,
|
||||
default: "时"
|
||||
},
|
||||
minuteText: {
|
||||
type: String,
|
||||
default: "分"
|
||||
},
|
||||
secondText: {
|
||||
type: String,
|
||||
default: "秒"
|
||||
},
|
||||
datatime: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
isDay: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
day: "00",
|
||||
hour: "00",
|
||||
minute: "00",
|
||||
second: "00"
|
||||
};
|
||||
},
|
||||
created: function() {
|
||||
this.show_time();
|
||||
},
|
||||
mounted: function() {},
|
||||
methods: {
|
||||
show_time: function() {
|
||||
let that = this;
|
||||
|
||||
function runTime() {
|
||||
//时间函数
|
||||
let intDiff = that.datatime - Date.parse(new Date()) / 1000; //获取数据中的时间戳的时间差;
|
||||
let day = 0,
|
||||
hour = 0,
|
||||
minute = 0,
|
||||
second = 0;
|
||||
if (intDiff > 0) {
|
||||
//转换时间
|
||||
if (that.isDay === true) {
|
||||
day = Math.floor(intDiff / (60 * 60 * 24));
|
||||
} else {
|
||||
day = 0;
|
||||
}
|
||||
hour = Math.floor(intDiff / (60 * 60)) - day * 24;
|
||||
minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60;
|
||||
second =
|
||||
Math.floor(intDiff) -
|
||||
day * 24 * 60 * 60 -
|
||||
hour * 60 * 60 -
|
||||
minute * 60;
|
||||
if (hour <= 9) hour = "0" + hour;
|
||||
if (minute <= 9) minute = "0" + minute;
|
||||
if (second <= 9) second = "0" + second;
|
||||
that.day = day;
|
||||
that.hour = hour;
|
||||
that.minute = minute;
|
||||
that.second = second;
|
||||
} else {
|
||||
that.day = "00";
|
||||
that.hour = "00";
|
||||
that.minute = "00";
|
||||
that.second = "00";
|
||||
}
|
||||
}
|
||||
runTime();
|
||||
setInterval(runTime, 1000);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.time{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.red{
|
||||
color: #fc4141;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,109 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class='coupon-list-window' :class='coupon.coupon==true?"on":""'>
|
||||
<view class='title'>优惠券<text class='iconfont icon-guanbi' @click='close'></text></view>
|
||||
<view class='coupon-list' v-if="coupon.list.length">
|
||||
<view class='item acea-row row-center-wrapper' v-for="(item,index) in coupon.list" @click="getCouponUser(index,item.id)" :key='index'>
|
||||
<view class='money acea-row row-column row-center-wrapper' :class='item.isUse?"moneyGray":""'>
|
||||
<view>¥<text class='num'>{{item.money}}</text></view>
|
||||
<view class="pic-num">满{{item.minPrice}}元可用</view>
|
||||
</view>
|
||||
<view class='text'>
|
||||
<view class='condition line1'>
|
||||
<span class='line-title' :class='item.isUse?"gray":""' v-if='item.type===0'>通用劵</span>
|
||||
<span class='line-title' :class='item.isUse?"gray":""' v-else-if='item.type===1'>品类券</span>
|
||||
<span class='line-title' :class='item.isUse?"gray":""' v-else>商品券</span>
|
||||
<span>{{item.name}}</span>
|
||||
</view>
|
||||
<view class='data acea-row row-between-wrapper'>
|
||||
<view>{{ item.receiveStartTime ? item.receiveStartTime + " ~ " : ""}}{{ item.receiveEndTime }}</view>
|
||||
<view class='bnt gray' v-if="item.isUse">{{item.use_title || '已领取'}}</view>
|
||||
<view class='bnt bg-color' v-else>{{coupon.statusTile || '立即领取'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 无优惠券 -->
|
||||
<view class='pictrue' v-else><image src='../../static/images/noCoupon.png'></image></view>
|
||||
</view>
|
||||
<view class='mask' catchtouchmove="true" :hidden='coupon.coupon==false' @click='close'></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { setCouponReceive } from '@/api/api.js';
|
||||
export default {
|
||||
props: {
|
||||
//打开状态 0=领取优惠券,1=使用优惠券
|
||||
openType: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
coupon: {
|
||||
type: Object,
|
||||
default: function(){
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
close: function () {
|
||||
this.$emit('ChangCouponsClone');
|
||||
},
|
||||
getCouponUser:function(index,id){
|
||||
let that = this;
|
||||
let list = that.coupon.list;
|
||||
if (list[index].isUse == true && this.openType==0) return true;
|
||||
switch (this.openType){
|
||||
case 0:
|
||||
//领取优惠券
|
||||
let ids = [];
|
||||
ids.push(id);
|
||||
setCouponReceive(ids).then(res=>{
|
||||
that.$emit('ChangCouponsUseState', index);
|
||||
that.$util.Tips({title: "领取成功"});
|
||||
that.$emit('ChangCoupons', list[index]);
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
that.$emit('ChangCoupons',index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.coupon-list-window{position:fixed;bottom:0;left:0;width:100%;background-color:#f5f5f5;border-radius:16rpx 16rpx 0 0;z-index:555;transform:translate3d(0,100%,0);transition:all .3s cubic-bezier(.25,.5,.5,.9);}
|
||||
.coupon-list-window.on{transform:translate3d(0,0,0);}
|
||||
.coupon-list-window .title{height:124rpx;width:100%;text-align:center;line-height:124rpx;font-size:32rpx;font-weight:bold;position:relative;}
|
||||
.coupon-list-window .title .iconfont{position:absolute;right:30rpx;top:50%;transform:translateY(-50%);font-size:35rpx;color:#8a8a8a;font-weight:normal;}
|
||||
.coupon-list-window .coupon-list{margin:0 0 50rpx 0;height:550rpx;overflow:auto;}
|
||||
.coupon-list-window .pictrue{width:414rpx;height:336rpx;margin:0 auto 50rpx auto;}
|
||||
.coupon-list-window .pictrue image{width:100%;height:100%;}
|
||||
.pic-num{color: #fff;font-size: 24rpx;}
|
||||
.line-title{
|
||||
width:90rpx;
|
||||
padding: 0 10rpx;
|
||||
box-sizing: border-box;
|
||||
background:rgba(255,247,247,1);
|
||||
border:1px solid rgba(232,51,35,1);
|
||||
opacity:1;
|
||||
border-radius:20rpx;
|
||||
font-size:20rpx;
|
||||
color: #E83323;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.line-title.gray{
|
||||
border-color:#BBB;
|
||||
color:#bbb;
|
||||
background-color:#F5F5F5;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,173 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class='coupon-list-window' :class='coupon.coupon==true?"on":""'>
|
||||
<view class='title'>优惠券<text class='iconfont icon-guanbi' @click='close'></text></view>
|
||||
<view class='coupon-list' v-if="coupon.list.length">
|
||||
<view class='item acea-row row-center-wrapper' v-for="(item,index) in coupon.list" @click="getCouponUser(index,item)"
|
||||
:key='index'>
|
||||
<view class='money'>
|
||||
<div>
|
||||
¥<span class="num">{{ item.coupon_price }}</span>
|
||||
</div>
|
||||
<div class="pic-num">满{{ item.use_min_price }}元可用</div>
|
||||
</view>
|
||||
<view class='text'>
|
||||
<view class='condition line1'>
|
||||
<span class="line-title" v-if="item.type === 0">通用劵</span>
|
||||
<span class="line-title" v-else-if="item.type === 1">品类券</span>
|
||||
<span class="line-title" v-else>商品券</span>
|
||||
<span>{{ item.title }}</span>
|
||||
</view>
|
||||
<view class='data acea-row row-between-wrapper'>
|
||||
<view>{{ item.start_time ? item.start_time + "-" : ""}}{{ item.end_time }}</view>
|
||||
<view class="iconfont icon-xuanzhong1 font-color-red" v-if="checked.id === item.id"></view>
|
||||
<view v-else class="iconfont icon-weixuanzhong"></view v-else>
|
||||
<!-- <view class='bnt gray' v-if="item.is_use">{{item.use_title || '已领取'}}</view>
|
||||
<view class='bnt bg-color' v-else>{{coupon.statusTile || '立即领取'}}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 无优惠券 -->
|
||||
<view class='pictrue' v-else>
|
||||
<image src='/static/images/noCoupon.png'></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class='mask' catchtouchmove="true" :hidden='coupon.coupon==false' @click='close'></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
setCouponReceive
|
||||
} from '@/api/api.js';
|
||||
export default {
|
||||
props: {
|
||||
//打开状态 0=领取优惠券,1=使用优惠券
|
||||
openType: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
coupon: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
checked:{
|
||||
type: Object,
|
||||
default: function() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
close: function() {
|
||||
this.$emit('ChangCouponsClone');
|
||||
},
|
||||
getCouponUser: function(index, item) {
|
||||
let that = this;
|
||||
let list = that.coupon.list;
|
||||
that.$emit('ChangCoupons', item);
|
||||
// if (list[index].is_use == true && this.openType == 0) return true;
|
||||
// switch (this.openType) {
|
||||
// case 0:
|
||||
// //领取优惠券
|
||||
// setCouponReceive(id).then(res => {
|
||||
// that.$emit('ChangCouponsUseState', index);
|
||||
// that.$util.Tips({
|
||||
// title: "领取成功"
|
||||
// });
|
||||
// that.$emit('ChangCoupons', list[index]);
|
||||
// })
|
||||
// break;
|
||||
// case 1:
|
||||
// that.$emit('ChangCoupons', index);
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.coupon-list-window {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
z-index: 555;
|
||||
transform: translate3d(0, 100%, 0);
|
||||
transition: all .3s cubic-bezier(.25, .5, .5, .9);
|
||||
}
|
||||
|
||||
.coupon-list-window.on {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
.coupon-list-window .title {
|
||||
height: 124rpx;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
line-height: 124rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.coupon-list-window .title .iconfont {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 35rpx;
|
||||
color: #8a8a8a;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.coupon-list-window .coupon-list {
|
||||
margin: 0 0 50rpx 0;
|
||||
height: 550rpx;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.coupon-list-window .pictrue {
|
||||
width: 414rpx;
|
||||
height: 336rpx;
|
||||
margin: 0 auto 50rpx auto;
|
||||
}
|
||||
|
||||
.coupon-list-window .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.coupon-list .item .money{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
.pic-num{
|
||||
color: #ffffff;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.condition .line-title{
|
||||
width: 90rpx;
|
||||
padding: 0 10rpx;
|
||||
box-sizing: border-box;
|
||||
background: rgba(255, 247, 247, 1);
|
||||
border: 1px solid rgba(232, 51, 35, 1);
|
||||
opacity: 1;
|
||||
border-radius: 22rpx;
|
||||
font-size: 20rpx;
|
||||
color: #e83323;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
</style>
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,261 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="upload">
|
||||
<block v-for="(upload,index) in uploads" :key="index">
|
||||
<view class="uplode-file">
|
||||
<image v-if="types == 'image'" class="uploade-img" :src="upload" :data-src="upload" @tap="previewImage"></image>
|
||||
<image v-if="types == 'image'" class="clear-one-icon" :src="clearIcon" @tap="delImage(index)"></image>
|
||||
<video v-if="types == 'video'" class="uploade-img" :src="upload" controls>
|
||||
<cover-image v-if="types == 'video'" class="clear-one-icon" :src="clearIcon" @tap="delImage(index)"></cover-image>
|
||||
</video>
|
||||
</view>
|
||||
</block>
|
||||
<view class="uploader-input-box" v-if="uploads.length < uploadCount">
|
||||
<view class="uploader-input" @tap="chooseUploads"></view>
|
||||
</view>
|
||||
</view>
|
||||
<button type="primary" v-if="types == 'image'" @tap="upload">上传</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
props: {
|
||||
types: {
|
||||
type: String,
|
||||
default: 'image'
|
||||
},
|
||||
dataList: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return []
|
||||
}
|
||||
},
|
||||
clearIcon: {
|
||||
type: String,
|
||||
default: 'http://img1.imgtn.bdimg.com/it/u=451604666,2295832001&fm=26&gp=0.jpg'
|
||||
},
|
||||
uploadUrl: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
deleteUrl: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
uploadCount: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
//上传图片大小 默认3M
|
||||
upload_max: {
|
||||
type: Number,
|
||||
default: 3
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
//上传的图片地址
|
||||
uploadImages: [],
|
||||
//展示的图片地址
|
||||
uploads: [],
|
||||
// 超出限制数组
|
||||
exceeded_list: [],
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
dataList() {
|
||||
this.uploads = this.dataList
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
previewImage (e) {
|
||||
var current = e.target.dataset.src
|
||||
uni.previewImage({
|
||||
current: current,
|
||||
urls: this.dataList
|
||||
})
|
||||
},
|
||||
chooseUploads(){
|
||||
switch (this.types){
|
||||
case 'image':
|
||||
uni.chooseImage({
|
||||
count: this.uploadCount - this.uploads.length, //默认9
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], //从相册选择
|
||||
success: (res) => {
|
||||
for(let i = 0; i< res.tempFiles.length; i++){
|
||||
if(Math.ceil(res.tempFiles[i].size / 1024) < this.upload_max * 1024){
|
||||
this.uploads.push(res.tempFiles[i].path)
|
||||
this.uploadImages.push(res.tempFiles[i].path)
|
||||
}else {
|
||||
this.exceeded_list.push(i === 0 ? 1 : i + 1);
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `第${[...new Set(this.exceeded_list)].join(',')}张图片超出限制${this.upload_max}MB,已过滤`
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showModal({
|
||||
content: JSON.stringify(err)
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'video' :
|
||||
uni.chooseVideo({
|
||||
sourceType: ['camera', 'album'],
|
||||
success: (res) => {
|
||||
if(Math.ceil(res.size / 1024) < this.upload_max * 1024){
|
||||
this.uploads.push(res.tempFilePath)
|
||||
uni.uploadFile({
|
||||
url: this.uploadUrl, //仅为示例,非真实的接口地址
|
||||
filePath: res.tempFilePath,
|
||||
name: 'file',
|
||||
//请求参数
|
||||
formData: {
|
||||
'user': 'test'
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
this.$emit('successVideo',uploadFileRes)
|
||||
}
|
||||
});
|
||||
}else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `第${[...new Set(this.exceeded_list)].join(',')}张视频超出限制${this.upload_max}MB,已过滤`
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showModal({
|
||||
content: JSON.stringify(err)
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
delImage(index){
|
||||
if(this.uploads[index].substring(0,4) !== 'http'){
|
||||
this.uploads.splice(index,1)
|
||||
return;
|
||||
};
|
||||
if(!this.deleteUrl) {
|
||||
uni.showModal({
|
||||
content: '请填写删除接口'
|
||||
});
|
||||
return;
|
||||
};
|
||||
uni.request({
|
||||
url: this.deleteUrl,
|
||||
method: 'DELETE',
|
||||
data: {
|
||||
image: this.dataList[index]
|
||||
},
|
||||
success: res => {
|
||||
this.uploads.splice(index,1)
|
||||
},
|
||||
});
|
||||
},
|
||||
upload(){
|
||||
debugger
|
||||
if(!this.uploadUrl) {
|
||||
uni.showModal({
|
||||
content: '请填写上传接口'
|
||||
});
|
||||
return;
|
||||
};
|
||||
for (let i of this.uploadImages) {
|
||||
uni.uploadFile({
|
||||
url: this.uploadUrl, //仅为示例,非真实的接口地址
|
||||
filePath: i,
|
||||
name: 'file',
|
||||
//请求参数
|
||||
formData: {
|
||||
'user': 'test'
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
this.$emit('successImage',uploadFileRes)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.upload {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.uplode-file {
|
||||
margin: 10upx;
|
||||
width: 210upx;
|
||||
height: 210upx;
|
||||
position: relative;
|
||||
}
|
||||
.uploade-img {
|
||||
display: block;
|
||||
width: 210upx;
|
||||
height: 210upx;
|
||||
}
|
||||
.clear-one{
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
right: 0;
|
||||
}
|
||||
.clear-one-icon{
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 9;
|
||||
}
|
||||
.uploader-input-box {
|
||||
position: relative;
|
||||
margin:10upx;
|
||||
width: 208upx;
|
||||
height: 208upx;
|
||||
border: 2upx solid #D9D9D9;
|
||||
}
|
||||
.uploader-input-box:before,
|
||||
.uploader-input-box:after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: #D9D9D9;
|
||||
}
|
||||
.uploader-input-box:before {
|
||||
width: 4upx;
|
||||
height: 79upx;
|
||||
}
|
||||
.uploader-input-box:after {
|
||||
width: 79upx;
|
||||
height: 4upx;
|
||||
}
|
||||
.uploader-input-box:active {
|
||||
border-color: #999999;
|
||||
}
|
||||
.uploader-input-box:active:before,
|
||||
.uploader-input-box:active:after {
|
||||
background-color: #999999;
|
||||
}
|
||||
.uploader-input {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,40 @@
|
|||
### easy-upload 组件
|
||||
|
||||
使用方法
|
||||
```js
|
||||
<easy-upload
|
||||
:dataList="imageList" uploadUrl="http://localhost:3000/upload" :types="category"
|
||||
deleteUrl='http://localhost:3000/upload' :uploadCount="6"
|
||||
@successImage="successImage" @successVideo="successvideo"
|
||||
></easy-upload>
|
||||
|
||||
//先引入组件
|
||||
import easyUpload from '@/components/easy-upload/easy-upload.vue'
|
||||
//注册组件
|
||||
components:{
|
||||
easyUpload
|
||||
}
|
||||
|
||||
//使用 easycom 可以直接使用
|
||||
|
||||
```
|
||||
|
||||
| 参数 | 类型 | 是否必填 | 参数描述
|
||||
| ---- | ---- | ---- | ----
|
||||
| types | String | 否 | 上传类型 image/video
|
||||
| dataList | Array | 否 | 图片/视频数据展示
|
||||
| clearIcon | String | 否 | 删除图标(可以换成自己本地图片)
|
||||
| uploadUrl | String | 否 | 上传的接口
|
||||
| deleteUrl | String | 否 | 删除的接口
|
||||
| uploadCount | Number | 否 | 上传图片最大个数(默认为一张)
|
||||
| upload_max | Number | 否 | 上传大小(默认为3M)
|
||||
| upload_max | Number | 否 | 上传大小(默认为3M)
|
||||
| upload_max | Number | 否 | 上传大小(默认为3M)
|
||||
|
||||
| 事件 | 是否必填 | 参数描述
|
||||
| ---- | ---- | ----
|
||||
| successImage | 否 | 上传图片成功事件
|
||||
| successVideo | 否 | 上传视频成功回调
|
||||
|
||||
示例项目中有服务端代码 (node.js)
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<template>
|
||||
<view class="empty-box">
|
||||
<image src="/static/images/empty-box.png"></image>
|
||||
<view class="txt">{{title}}</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: '暂无记录',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.empty-box{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 200rpx;
|
||||
image{
|
||||
width: 414rpx;
|
||||
height: 240rpx;
|
||||
}
|
||||
.txt{
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,143 @@
|
|||
<template>
|
||||
<view class='goodList'>
|
||||
<block v-for="(item,index) in bastList" :key="index">
|
||||
<view @click="goDetail(item)" class='item acea-row row-between-wrapper' hover-class="none">
|
||||
<view class='pictrue'>
|
||||
<image :src='item.image'></image>
|
||||
<span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '1'">秒杀</span>
|
||||
<span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '2'">砍价</span>
|
||||
<span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '3'">拼团</span>
|
||||
</view>
|
||||
<view class='underline'>
|
||||
<view class='text'>
|
||||
<view class='line1'>{{item.storeName}}</view>
|
||||
<view class='money font-color'>¥<text class='num'>{{item.price}}</text></view>
|
||||
<view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">¥{{item.vip_price || 0}}
|
||||
<image src='../../static/images/vip.png'></image><text class='num'>已售{{item.sales}}{{item.unitName}}</text>
|
||||
</view>
|
||||
<view class='vip-money acea-row row-middle' v-else><text class='num'>已售{{item.sales}}{{item.unitName}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='iconfont icon-gouwuche cart-color acea-row row-center-wrapper'></view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import { goShopDetail } from '@/libs/order.js'
|
||||
export default {
|
||||
computed: mapGetters(['uid']),
|
||||
props: {
|
||||
status: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
bastList: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
goDetail(item){
|
||||
goShopDetail(item,this.uid).then(res=>{
|
||||
uni.navigateTo({
|
||||
url:`/pages/goods_details/index?id=${item.id}`
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
.goodList .item {
|
||||
position: relative;
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
|
||||
.goodList .item .pictrue {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.goodList .item .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.goodList .item .pictrue .numPic {
|
||||
position: absolute;
|
||||
left: 7rpx;
|
||||
top: 7rpx;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.goodList .item .underline {
|
||||
padding: 30rpx 30rpx 30rpx 0;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
.goodList .item:nth-last-child(1) .underline {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.goodList .item .text {
|
||||
font-size: 30rpx;
|
||||
color: #222;
|
||||
width: 489rpx;
|
||||
}
|
||||
|
||||
.goodList .item .text .money {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
.goodList .item .text .money .num {
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.goodList .item .text .vip-money {
|
||||
font-size: 24rpx;
|
||||
color: #282828;
|
||||
font-weight: bold;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.goodList .item .text .vip-money image {
|
||||
width: 46rpx;
|
||||
height: 21rpx;
|
||||
margin: 0 22rpx 0 5rpx;
|
||||
}
|
||||
|
||||
.goodList .item .text .vip-money .num {
|
||||
font-size: 22rpx;
|
||||
color: #aaa;
|
||||
font-weight: normal;
|
||||
margin: -2rpx 0 0 0;
|
||||
}
|
||||
|
||||
.goodList .item .iconfont {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 50%;
|
||||
font-size: 30rpx;
|
||||
bottom: 38rpx;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,116 @@
|
|||
<template>
|
||||
<view style="touch-action: none;">
|
||||
<view class="home" style="position:fixed;" :style="{ top: top + 'px'}" id="right-nav" @touchmove.stop.prevent="setTouchMove">
|
||||
<view class="homeCon bg-color-red" :class="homeActive === true ? 'on' : ''" v-if="homeActive">
|
||||
<navigator hover-class='none' url='/pages/index/index' open-type='switchTab' class='iconfont icon-shouye-xianxing'></navigator>
|
||||
<navigator hover-class='none' url='/pages/order_addcart/order_addcart' open-type='switchTab' class='iconfont icon-caigou-xianxing'></navigator>
|
||||
<navigator hover-class='none' url='/pages/user/index' open-type='switchTab' class='iconfont icon-yonghu1'></navigator>
|
||||
</view>
|
||||
<view @click="open" class="pictrueBox">
|
||||
<view class="pictrue">
|
||||
<image :src="
|
||||
homeActive === true
|
||||
? '/static/images/close.gif'
|
||||
: '/static/images/open.gif'
|
||||
"
|
||||
class="image" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
export default {
|
||||
name: "Home",
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
top: "500"
|
||||
};
|
||||
},
|
||||
computed: mapGetters(["homeActive"]),
|
||||
methods: {
|
||||
setTouchMove(e) {
|
||||
var that = this;
|
||||
if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
|
||||
that.top = e.touches[0].clientY
|
||||
// that.setData({
|
||||
// top: e.touches[0].clientY
|
||||
// })
|
||||
}
|
||||
},
|
||||
open: function() {
|
||||
this.homeActive ?
|
||||
this.$store.commit("CLOSE_HOME") :
|
||||
this.$store.commit("OPEN_HOME");
|
||||
}
|
||||
},
|
||||
created() {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pictrueBox {
|
||||
width: 130rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
|
||||
/*返回主页按钮*/
|
||||
.home {
|
||||
position: fixed;
|
||||
color: white;
|
||||
text-align: center;
|
||||
z-index: 9999;
|
||||
right: 15rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.home .homeCon {
|
||||
border-radius: 50rpx;
|
||||
opacity: 0;
|
||||
height: 0;
|
||||
color: #e93323;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.home .homeCon.on {
|
||||
opacity: 1;
|
||||
animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
|
||||
width: 300rpx;
|
||||
height: 86rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: #f44939 !important;
|
||||
}
|
||||
|
||||
.home .homeCon .iconfont {
|
||||
font-size: 48rpx;
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.home .pictrue {
|
||||
width: 86rpx;
|
||||
height: 86rpx;
|
||||
border-radius: 50%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.home .pictrue .image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
transform: rotate(90deg);
|
||||
ms-transform: rotate(90deg);
|
||||
moz-transform: rotate(90deg);
|
||||
webkit-transform: rotate(90deg);
|
||||
o-transform: rotate(90deg);
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,814 @@
|
|||
<!--
|
||||
parser 主模块组件
|
||||
github:https://github.com/jin-yufeng/Parser
|
||||
docs:https://jin-yufeng.github.io/Parser
|
||||
插件市场:https://ext.dcloud.net.cn/plugin?id=805
|
||||
author:JinYufeng
|
||||
update:2020/04/14
|
||||
-->
|
||||
<template>
|
||||
<view>
|
||||
<slot v-if="!nodes.length" />
|
||||
<!--#ifdef APP-PLUS-NVUE-->
|
||||
<web-view id="top" ref="web" :src="src" :style="'margin-top:-2px;height:'+height+'px'" @onPostMessage="_message" />
|
||||
<!--#endif-->
|
||||
<!--#ifndef APP-PLUS-NVUE-->
|
||||
<view id="top" :style="showAm+(selectable?';user-select:text;-webkit-user-select:text':'')" :animation="scaleAm" @tap="_tap"
|
||||
@touchstart="_touchstart" @touchmove="_touchmove">
|
||||
<!--#ifdef H5-->
|
||||
<div :id="'rtf'+uid"></div>
|
||||
<!--#endif-->
|
||||
<!--#ifndef H5-->
|
||||
<trees :nodes="nodes" :lazy-load="lazyLoad" :loadVideo="loadVideo" />
|
||||
<image v-for="(item, index) in imgs" v-bind:key="index" :id="index" :src="item" hidden @load="_load" />
|
||||
<!--#endif-->
|
||||
</view>
|
||||
<!--#endif-->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
import trees from './libs/trees';
|
||||
var cache = {},
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||
fs = uni.getFileSystemManager ? uni.getFileSystemManager() : null,
|
||||
// #endif
|
||||
Parser = require('./libs/MpHtmlParser.js');
|
||||
var document; // document 补丁包 https://jin-yufeng.github.io/Parser/#/instructions?id=document
|
||||
// 计算 cache 的 key
|
||||
function hash(str) {
|
||||
for (var i = str.length, val = 5381; i--;)
|
||||
val += (val << 5) + str.charCodeAt(i);
|
||||
return val;
|
||||
}
|
||||
// #endif
|
||||
// #ifdef H5 || APP-PLUS-NVUE
|
||||
var rpx = uni.getSystemInfoSync().screenWidth / 750,
|
||||
cfg = require('./libs/config.js');
|
||||
// #endif
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
var dom = weex.requireModule('dom');
|
||||
// #endif
|
||||
export default {
|
||||
name: 'parser',
|
||||
data() {
|
||||
return {
|
||||
// #ifdef APP-PLUS
|
||||
loadVideo: false,
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
uid: this._uid,
|
||||
// #endif
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
src: '',
|
||||
height: 1,
|
||||
// #endif
|
||||
// #ifndef APP-PLUS-NVUE
|
||||
scaleAm: '',
|
||||
showAm: '',
|
||||
imgs: [],
|
||||
// #endif
|
||||
nodes: []
|
||||
}
|
||||
},
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
components: {
|
||||
trees
|
||||
},
|
||||
// #endif
|
||||
props: {
|
||||
'html': null,
|
||||
// #ifndef MP-ALIPAY
|
||||
'autopause': {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// #endif
|
||||
'autosetTitle': {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
'compress': Number,
|
||||
'useCache': Boolean,
|
||||
'xml': Boolean,
|
||||
// #endif
|
||||
'domain': String,
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
'gestureZoom': Boolean,
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN || MP-QQ || H5 || APP-PLUS
|
||||
'lazyLoad': Boolean,
|
||||
// #endif
|
||||
'selectable': Boolean,
|
||||
'tagStyle': Object,
|
||||
'showWithAnimation': Boolean,
|
||||
'useAnchor': Boolean
|
||||
},
|
||||
watch: {
|
||||
html(html) {
|
||||
this.setContent(html);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 图片数组
|
||||
this.imgList = [];
|
||||
this.imgList.each = function(f) {
|
||||
for (var i = 0, len = this.length; i < len; i++)
|
||||
this.setItem(i, f(this[i], i, this));
|
||||
}
|
||||
this.imgList.setItem = function(i, src) {
|
||||
if (i == void 0 || !src) return;
|
||||
// #ifndef MP-ALIPAY || APP-PLUS
|
||||
// 去重
|
||||
if (src.indexOf('http') == 0 && this.includes(src)) {
|
||||
var newSrc = '';
|
||||
for (var j = 0, c; c = src[j]; j++) {
|
||||
if (c == '/' && src[j - 1] != '/' && src[j + 1] != '/') break;
|
||||
newSrc += Math.random() > 0.5 ? c.toUpperCase() : c;
|
||||
}
|
||||
newSrc += src.substr(j);
|
||||
return this[i] = newSrc;
|
||||
}
|
||||
// #endif
|
||||
this[i] = src;
|
||||
// 暂存 data src
|
||||
if (src.includes('data:image')) {
|
||||
var filePath, info = src.match(/data:image\/(\S+?);(\S+?),(.+)/);
|
||||
if (!info) return;
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||
filePath = `${wx.env.USER_DATA_PATH}/${Date.now()}.${info[1]}`;
|
||||
fs && fs.writeFile({
|
||||
filePath,
|
||||
data: info[3],
|
||||
encoding: info[2],
|
||||
success: () => this[i] = filePath
|
||||
})
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
filePath = `_doc/parser_tmp/${Date.now()}.${info[1]}`;
|
||||
var bitmap = new plus.nativeObj.Bitmap();
|
||||
bitmap.loadBase64Data(src, () => {
|
||||
bitmap.save(filePath, {}, () => {
|
||||
bitmap.clear()
|
||||
this[i] = filePath;
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
if (this.html) this.setContent(this.html);
|
||||
},
|
||||
beforeDestroy() {
|
||||
// #ifdef H5
|
||||
if (this._observer) this._observer.disconnect();
|
||||
// #endif
|
||||
this.imgList.each(src => {
|
||||
// #ifdef APP-PLUS
|
||||
if (src && src.includes('_doc')) {
|
||||
plus.io.resolveLocalFileSystemURL(src, entry => {
|
||||
entry.remove();
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||
if (src && src.includes(uni.env.USER_DATA_PATH))
|
||||
fs && fs.unlink({
|
||||
filePath: src
|
||||
})
|
||||
// #endif
|
||||
})
|
||||
clearInterval(this._timer);
|
||||
},
|
||||
methods: {
|
||||
// #ifdef H5 || APP-PLUS-NVUE
|
||||
_Dom2Str(nodes) {
|
||||
var str = '';
|
||||
for (var node of nodes) {
|
||||
if (node.type == 'text')
|
||||
str += node.text;
|
||||
else {
|
||||
str += ('<' + node.name);
|
||||
for (var attr in node.attrs || {})
|
||||
str += (' ' + attr + '="' + node.attrs[attr] + '"');
|
||||
if (!node.children || !node.children.length) str += '>';
|
||||
else str += ('>' + this._Dom2Str(node.children) + '</' + node.name + '>');
|
||||
}
|
||||
}
|
||||
return str;
|
||||
},
|
||||
_handleHtml(html, append) {
|
||||
if (typeof html != 'string') html = this._Dom2Str(html.nodes || html);
|
||||
// 处理 rpx
|
||||
if (html.includes('rpx'))
|
||||
html = html.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * rpx + 'px');
|
||||
if (!append) {
|
||||
// 处理 tag-style 和 userAgentStyles
|
||||
var style = '<style>@keyframes show{0%{opacity:0}100%{opacity:1}}';
|
||||
for (var item in cfg.userAgentStyles)
|
||||
style += `${item}{${cfg.userAgentStyles[item]}}`;
|
||||
for (item in this.tagStyle)
|
||||
style += `${item}{${this.tagStyle[item]}}`;
|
||||
style += '</style>';
|
||||
html = style + html;
|
||||
}
|
||||
return html;
|
||||
},
|
||||
// #endif
|
||||
setContent(html, append) {
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
if (!html) {
|
||||
this.src = '';
|
||||
this.height = 1;
|
||||
return;
|
||||
}
|
||||
if (append) return;
|
||||
plus.io.resolveLocalFileSystemURL('_doc', entry => {
|
||||
entry.getDirectory('parser_tmp', {
|
||||
create: true
|
||||
}, entry => {
|
||||
var fileName = Date.now() + '.html';
|
||||
entry.getFile(fileName, {
|
||||
create: true
|
||||
}, entry => {
|
||||
entry.createWriter(writer => {
|
||||
writer.onwriteend = () => {
|
||||
this.nodes = [1];
|
||||
this.src = '_doc/parser_tmp/' + fileName;
|
||||
this.$nextTick(function() {
|
||||
entry.remove();
|
||||
})
|
||||
}
|
||||
html =
|
||||
'<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1' +
|
||||
(this.selectable ? '' : ',user-scalable=no') +
|
||||
'"><script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></' +
|
||||
'script><base href="' + this.domain + '">' + this._handleHtml(html) +
|
||||
'<script>"use strict";function post(t){uni.postMessage({data:t})}' +
|
||||
(this.showWithAnimation ? 'document.body.style.animation="show .5s",' : '') +
|
||||
'document.addEventListener("UniAppJSBridgeReady",function(){post({action:"load",text:document.body.innerText});var t=document.getElementsByTagName("title");t.length&&post({action:"getTitle",title:t[0].innerText});for(var e,o=document.getElementsByTagName("img"),n=[],i=0,r=0;e=o[i];i++)e.onerror=function(){post({action:"error",source:"img",target:this})},e.hasAttribute("ignore")||"A"==e.parentElement.nodeName||(e.i=r++,n.push(e.src),e.onclick=function(){post({action:"preview",img:{i:this.i,src:this.src}})});post({action:"getImgList",imgList:n});for(var a,s=document.getElementsByTagName("a"),c=0;a=s[c];c++)a.onclick=function(){var t,e=this.getAttribute("href");if("#"==e[0]){var r=document.getElementById(e.substr(1));r&&(t=r.offsetTop)}return post({action:"linkpress",href:e,offset:t}),!1};;for(var u,m=document.getElementsByTagName("video"),d=0;u=m[d];d++)u.style.maxWidth="100%",u.onerror=function(){post({action:"error",source:"video",target:this})}' +
|
||||
(this.autopause ? ',u.onplay=function(){for(var t,e=0;t=m[e];e++)t!=this&&t.pause()}' : '') +
|
||||
';for(var g,l=document.getElementsByTagName("audio"),p=0;g=l[p];p++)g.onerror=function(){post({action:"error",source:"audio",target:this})};window.onload=function(){post({action:"ready",height:document.body.scrollHeight})}});</' +
|
||||
'script>';
|
||||
writer.write(html);
|
||||
});
|
||||
})
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
if (!html) {
|
||||
if (this.rtf && !append) this.rtf.parentNode.removeChild(this.rtf);
|
||||
return;
|
||||
}
|
||||
var div = document.createElement('div');
|
||||
if (!append) {
|
||||
if (this.rtf) this.rtf.parentNode.removeChild(this.rtf);
|
||||
this.rtf = div;
|
||||
} else {
|
||||
if (!this.rtf) this.rtf = div;
|
||||
else this.rtf.appendChild(div);
|
||||
}
|
||||
div.innerHTML = this._handleHtml(html, append);
|
||||
for (var styles = this.rtf.getElementsByTagName('style'), i = 0, style; style = styles[i++];) {
|
||||
style.innerHTML = style.innerHTML.replace(/body/g, '#rtf' + this._uid);
|
||||
style.setAttribute('scoped', 'true');
|
||||
}
|
||||
// 懒加载
|
||||
if (!this._observer && this.lazyLoad && IntersectionObserver) {
|
||||
this._observer = new IntersectionObserver(changes => {
|
||||
for (let item, i = 0; item = changes[i++];) {
|
||||
if (item.isIntersecting) {
|
||||
item.target.src = item.target.getAttribute('data-src');
|
||||
item.target.removeAttribute('data-src');
|
||||
this._observer.unobserve(item.target);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
rootMargin: '900px 0px 900px 0px'
|
||||
})
|
||||
}
|
||||
var _ts = this;
|
||||
// 获取标题
|
||||
var title = this.rtf.getElementsByTagName('title');
|
||||
if (title.length && this.autosetTitle)
|
||||
uni.setNavigationBarTitle({
|
||||
title: title[0].innerText
|
||||
})
|
||||
// 图片处理
|
||||
this.imgList.length = 0;
|
||||
var imgs = this.rtf.getElementsByTagName('img');
|
||||
for (let i = 0, j = 0, img; img = imgs[i]; i++) {
|
||||
img.style.maxWidth = '100%';
|
||||
var src = img.getAttribute('src');
|
||||
if (this.domain && src) {
|
||||
if (src[0] == '/') {
|
||||
if (src[1] == '/')
|
||||
img.src = (this.domain.includes('://') ? this.domain.split('://')[0] : '') + ':' + src;
|
||||
else img.src = this.domain + src;
|
||||
} else if (!src.includes('://')) img.src = this.domain + '/' + src;
|
||||
}
|
||||
if (!img.hasAttribute('ignore') && img.parentElement.nodeName != 'A') {
|
||||
img.i = j++;
|
||||
_ts.imgList.push(img.src || img.getAttribute('data-src'));
|
||||
img.onclick = function() {
|
||||
var preview = true;
|
||||
this.ignore = () => preview = false;
|
||||
_ts.$emit('imgtap', this);
|
||||
if (preview) {
|
||||
uni.previewImage({
|
||||
current: this.i,
|
||||
urls: _ts.imgList
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
img.onerror = function() {
|
||||
_ts.$emit('error', {
|
||||
source: 'img',
|
||||
target: this
|
||||
});
|
||||
}
|
||||
if (_ts.lazyLoad && this._observer && img.src && img.i != 0) {
|
||||
img.setAttribute('data-src', img.src);
|
||||
img.removeAttribute('src');
|
||||
this._observer.observe(img);
|
||||
}
|
||||
}
|
||||
// 链接处理
|
||||
var links = this.rtf.getElementsByTagName('a');
|
||||
for (var link of links) {
|
||||
link.onclick = function() {
|
||||
var jump = true,
|
||||
href = this.getAttribute('href');
|
||||
_ts.$emit('linkpress', {
|
||||
href,
|
||||
ignore: () => jump = false
|
||||
});
|
||||
if (jump && href) {
|
||||
if (href[0] == '#') {
|
||||
if (_ts.useAnchor) {
|
||||
_ts.navigateTo({
|
||||
id: href.substr(1)
|
||||
})
|
||||
}
|
||||
} else if (href.indexOf('http') == 0 || href.indexOf('//') == 0)
|
||||
return true;
|
||||
else {
|
||||
uni.navigateTo({
|
||||
url: href
|
||||
})
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 视频处理
|
||||
var videos = this.rtf.getElementsByTagName('video');
|
||||
_ts.videoContexts = videos;
|
||||
for (let video, i = 0; video = videos[i++];) {
|
||||
video.style.maxWidth = '100%';
|
||||
video.onerror = function() {
|
||||
_ts.$emit('error', {
|
||||
source: 'video',
|
||||
target: this
|
||||
});
|
||||
}
|
||||
video.onplay = function() {
|
||||
if (_ts.autopause)
|
||||
for (let item, i = 0; item = _ts.videoContexts[i++];)
|
||||
if (item != this) item.pause();
|
||||
}
|
||||
}
|
||||
// 音频处理
|
||||
var audios = this.rtf.getElementsByTagName('audios');
|
||||
for (var audio of audios)
|
||||
audio.onerror = function() {
|
||||
_ts.$emit('error', {
|
||||
source: 'audio',
|
||||
target: this
|
||||
});
|
||||
}
|
||||
this.document = this.rtf;
|
||||
if (!append) document.getElementById('rtf' + this._uid).appendChild(this.rtf);
|
||||
this.$nextTick(() => {
|
||||
this.nodes = [1];
|
||||
this.$emit('load');
|
||||
})
|
||||
setTimeout(() => this.showAm = '', 500);
|
||||
// #endif
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
var nodes;
|
||||
if (!html)
|
||||
return this.nodes = [];
|
||||
else if (typeof html == 'string') {
|
||||
let parser = new Parser(html, this);
|
||||
// 缓存读取
|
||||
if (this.useCache) {
|
||||
var hashVal = hash(html);
|
||||
if (cache[hashVal])
|
||||
nodes = cache[hashVal];
|
||||
else {
|
||||
nodes = parser.parse();
|
||||
cache[hashVal] = nodes;
|
||||
}
|
||||
} else nodes = parser.parse();
|
||||
this.$emit('parse', nodes);
|
||||
} else if (Object.prototype.toString.call(html) == '[object Array]') {
|
||||
// 非本插件产生的 array 需要进行一些转换
|
||||
if (html.length && html[0].PoweredBy != 'Parser') {
|
||||
let parser = new Parser(html, this);
|
||||
(function f(ns) {
|
||||
for (var i = 0, n; n = ns[i]; i++) {
|
||||
if (n.type == 'text') continue;
|
||||
n.attrs = n.attrs || {};
|
||||
for (var item in n.attrs)
|
||||
if (typeof n.attrs[item] != 'string') n.attrs[item] = n.attrs[item].toString();
|
||||
parser.matchAttr(n, parser);
|
||||
if (n.children && n.children.length) {
|
||||
parser.STACK.push(n);
|
||||
f(n.children);
|
||||
parser.popNode(parser.STACK.pop());
|
||||
} else n.children = void 0;
|
||||
}
|
||||
})(html);
|
||||
}
|
||||
nodes = html;
|
||||
} else if (typeof html == 'object' && html.nodes) {
|
||||
nodes = html.nodes;
|
||||
console.warn('错误的 html 类型:object 类型已废弃');
|
||||
} else
|
||||
return console.warn('错误的 html 类型:' + typeof html);
|
||||
// #ifdef APP-PLUS
|
||||
this.loadVideo = false;
|
||||
// #endif
|
||||
if (document) this.document = new document(this.nodes, 'nodes', this);
|
||||
if (append) this.nodes = this.nodes.concat(nodes);
|
||||
else this.nodes = nodes;
|
||||
if (nodes.length && nodes[0].title && this.autosetTitle)
|
||||
uni.setNavigationBarTitle({
|
||||
title: nodes[0].title
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.imgList.length = 0;
|
||||
this.videoContexts = [];
|
||||
// #ifdef MP-TOUTIAO
|
||||
setTimeout(() => {
|
||||
// #endif
|
||||
var f = (cs) => {
|
||||
for (let i = 0, c; c = cs[i++];) {
|
||||
if (c.$options.name == 'trees') {
|
||||
for (var j = c.nodes.length, item; item = c.nodes[--j];) {
|
||||
if (item.c) continue;
|
||||
if (item.name == 'img') {
|
||||
this.imgList.setItem(item.attrs.i, item.attrs.src);
|
||||
// #ifndef MP-ALIPAY
|
||||
if (!c.observer && !c.imgLoad && item.attrs.i != '0') {
|
||||
if (this.lazyLoad && uni.createIntersectionObserver) {
|
||||
c.observer = uni.createIntersectionObserver(c);
|
||||
c.observer.relativeToViewport({
|
||||
top: 900,
|
||||
bottom: 900
|
||||
}).observe('._img', () => {
|
||||
c.imgLoad = true;
|
||||
c.observer.disconnect();
|
||||
})
|
||||
} else
|
||||
c.imgLoad = true;
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #ifndef MP-ALIPAY
|
||||
else if (item.name == 'video') {
|
||||
var ctx = uni.createVideoContext(item.attrs.id, c);
|
||||
ctx.id = item.attrs.id;
|
||||
this.videoContexts.push(ctx);
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
if (item.attrs && item.attrs.id) {
|
||||
this.anchors = this.anchors || [];
|
||||
this.anchors.push({
|
||||
id: item.attrs.id,
|
||||
node: c
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
if (c.$children.length)
|
||||
f(c.$children)
|
||||
}
|
||||
}
|
||||
f(this.$children);
|
||||
// #ifdef MP-TOUTIAO
|
||||
}, 200)
|
||||
this.$emit('load');
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
setTimeout(() => {
|
||||
this.loadVideo = true;
|
||||
}, 3000);
|
||||
// #endif
|
||||
})
|
||||
// #endif
|
||||
// #ifndef APP-PLUS-NVUE
|
||||
var height;
|
||||
clearInterval(this._timer);
|
||||
this._timer = setInterval(() => {
|
||||
// #ifdef H5
|
||||
var res = [this.rtf.getBoundingClientRect()];
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// #ifdef APP-PLUS
|
||||
uni.createSelectorQuery().in(this)
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
this.createSelectorQuery()
|
||||
// #endif
|
||||
.select('#top').boundingClientRect().exec(res => {
|
||||
// #endif
|
||||
this.width = res[0].width;
|
||||
if (res[0].height == height) {
|
||||
this.$emit('ready', res[0])
|
||||
clearInterval(this._timer);
|
||||
}
|
||||
height = res[0].height;
|
||||
// #ifndef H5
|
||||
});
|
||||
// #endif
|
||||
}, 350)
|
||||
if (this.showWithAnimation && !append) this.showAm = 'animation:show .5s';
|
||||
// #endif
|
||||
},
|
||||
getText(ns = this.nodes) {
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
return this._text;
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
return this.rtf.innerText;
|
||||
// #endif
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
var txt = '';
|
||||
for (var i = 0, n; n = ns[i++];) {
|
||||
if (n.type == 'text') txt += n.text.replace(/ /g, '\u00A0').replace(/</g, '<').replace(/>/g, '>')
|
||||
.replace(/&/g, '&');
|
||||
else if (n.type == 'br') txt += '\n';
|
||||
else {
|
||||
// 块级标签前后加换行
|
||||
var block = n.name == 'p' || n.name == 'div' || n.name == 'tr' || n.name == 'li' || (n.name[0] == 'h' && n.name[1] >
|
||||
'0' && n.name[1] < '7');
|
||||
if (block && txt && txt[txt.length - 1] != '\n') txt += '\n';
|
||||
if (n.children) txt += this.getText(n.children);
|
||||
if (block && txt[txt.length - 1] != '\n') txt += '\n';
|
||||
else if (n.name == 'td' || n.name == 'th') txt += '\t';
|
||||
}
|
||||
}
|
||||
return txt;
|
||||
// #endif
|
||||
},
|
||||
navigateTo(obj) {
|
||||
if (!this.useAnchor)
|
||||
return obj.fail && obj.fail({
|
||||
errMsg: 'Anchor is disabled'
|
||||
})
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
if (!obj.id)
|
||||
dom.scrollToElement(this.$refs.web);
|
||||
else
|
||||
this.$refs.web.evalJs('var pos=document.getElementById("' + obj.id +
|
||||
'");if(pos)post({action:"linkpress",href:"#",offset:pos.offsetTop})');
|
||||
return obj.success && obj.success({
|
||||
errMsg: 'pageScrollTo:ok'
|
||||
});
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
if (!obj.id) {
|
||||
window.scrollTo(0, this.rtf.offsetTop);
|
||||
return obj.success && obj.success({
|
||||
errMsg: 'pageScrollTo:ok'
|
||||
});
|
||||
}
|
||||
var target = document.getElementById(obj.id);
|
||||
if (!target) return obj.fail && obj.fail({
|
||||
errMsg: 'Label not found'
|
||||
});
|
||||
obj.scrollTop = this.rtf.offsetTop + target.offsetTop;
|
||||
uni.pageScrollTo(obj);
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
var Scroll = (selector, component) => {
|
||||
uni.createSelectorQuery().in(component ? component : this).select(selector).boundingClientRect().selectViewport()
|
||||
.scrollOffset()
|
||||
.exec(res => {
|
||||
if (!res || !res[0])
|
||||
return obj.fail && obj.fail({
|
||||
errMsg: 'Label not found'
|
||||
});
|
||||
obj.scrollTop = res[1].scrollTop + res[0].top;
|
||||
uni.pageScrollTo(obj);
|
||||
})
|
||||
}
|
||||
if (!obj.id) Scroll('#top');
|
||||
else {
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
Scroll('#top >>> #' + obj.id + ', #top >>> .' + obj.id);
|
||||
// #endif
|
||||
// #ifdef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
for (var anchor of this.anchors)
|
||||
if (anchor.id == obj.id)
|
||||
Scroll('#' + obj.id + ', .' + obj.id, anchor.node);
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
getVideoContext(id) {
|
||||
// #ifndef APP-PLUS-NVUE
|
||||
if (!id) return this.videoContexts;
|
||||
else
|
||||
for (var i = this.videoContexts.length; i--;)
|
||||
if (this.videoContexts[i].id == id) return this.videoContexts[i];
|
||||
// #endif
|
||||
},
|
||||
// 预加载
|
||||
preLoad(html, num) {
|
||||
// #ifdef H5 || APP-PLUS-NVUE
|
||||
if (html.constructor == Array)
|
||||
html = this._Dom2Str(html);
|
||||
var script = "var contain=document.createElement('div');contain.innerHTML='" + html.replace(/'/g, "\\'") +
|
||||
"';for(var imgs=contain.querySelectorAll('img'),i=imgs.length-1;i>=" + num +
|
||||
";i--)imgs[i].removeAttribute('src');";
|
||||
// #endif
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
this.$refs.web.evalJs(script);
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
eval(script);
|
||||
// #endif
|
||||
// #ifndef H5 || APP-PLUS-NVUE
|
||||
if (typeof html == 'string') {
|
||||
var id = hash(html);
|
||||
html = new Parser(html, this).parse();
|
||||
cache[id] = html;
|
||||
}
|
||||
var wait = [];
|
||||
(function f(ns) {
|
||||
for (var i = 0, n; n = ns[i++];) {
|
||||
if (n.name == 'img' && n.attrs.src && !wait.includes(n.attrs.src))
|
||||
wait.push(n.attrs.src);
|
||||
f(n.children || []);
|
||||
}
|
||||
})(html);
|
||||
if (num) wait = wait.slice(0, num);
|
||||
this._wait = (this._wait || []).concat(wait);
|
||||
if (!this.imgs) this.imgs = this._wait.splice(0, 15);
|
||||
else if (this.imgs.length < 15)
|
||||
this.imgs = this.imgs.concat(this._wait.splice(0, 15 - this.imgs.length));
|
||||
// #endif
|
||||
},
|
||||
// #ifdef APP-PLUS-NVUE
|
||||
_message(e) {
|
||||
// 接收 web-view 消息
|
||||
var data = e.detail.data[0];
|
||||
if (data.action == 'load') {
|
||||
this.$emit('load');
|
||||
this._text = data.text;
|
||||
} else if (data.action == 'getTitle') {
|
||||
if (this.autosetTitle)
|
||||
uni.setNavigationBarTitle({
|
||||
title: data.title
|
||||
})
|
||||
} else if (data.action == 'getImgList') {
|
||||
this.imgList.length = 0;
|
||||
for (var i = data.imgList.length; i--;)
|
||||
this.imgList.setItem(i, data.imgList[i]);
|
||||
} else if (data.action == 'preview') {
|
||||
var preview = true;
|
||||
data.img.ignore = () => preview = false;
|
||||
this.$emit('imgtap', data.img);
|
||||
if (preview)
|
||||
uni.previewImage({
|
||||
current: data.img.i,
|
||||
urls: this.imgList
|
||||
})
|
||||
} else if (data.action == 'linkpress') {
|
||||
var jump = true,
|
||||
href = data.href;
|
||||
this.$emit('linkpress', {
|
||||
href,
|
||||
ignore: () => jump = false
|
||||
})
|
||||
if (jump && href) {
|
||||
if (href[0] == '#') {
|
||||
if (this.useAnchor)
|
||||
dom.scrollToElement(this.$refs.web, {
|
||||
offset: data.offset
|
||||
})
|
||||
} else if (href.includes('://'))
|
||||
plus.runtime.openWeb(href);
|
||||
else
|
||||
uni.navigateTo({
|
||||
url: href
|
||||
})
|
||||
}
|
||||
} else if (data.action == 'error')
|
||||
this.$emit('error', {
|
||||
source: data.source,
|
||||
target: data.target
|
||||
})
|
||||
else if (data.action == 'ready') {
|
||||
this.height = data.height;
|
||||
this.$nextTick(() => {
|
||||
uni.createSelectorQuery().in(this).select('#top').boundingClientRect().exec(res => {
|
||||
this.rect = res[0];
|
||||
this.$emit('ready', res[0]);
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
// #ifndef APP-PLUS-NVUE
|
||||
// #ifndef H5
|
||||
_load(e) {
|
||||
if (this._wait.length)
|
||||
this.$set(this.imgs, e.target.id, this._wait.shift());
|
||||
},
|
||||
// #endif
|
||||
_tap(e) {
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
if (this.gestureZoom && e.timeStamp - this._lastT < 300) {
|
||||
var initY = e.touches[0].pageY - e.currentTarget.offsetTop;
|
||||
if (this._zoom) {
|
||||
this._scaleAm.translateX(0).scale(1).step();
|
||||
uni.pageScrollTo({
|
||||
scrollTop: (initY + this._initY) / 2 - e.touches[0].clientY,
|
||||
duration: 400
|
||||
})
|
||||
} else {
|
||||
var initX = e.touches[0].pageX - e.currentTarget.offsetLeft;
|
||||
this._initY = initY;
|
||||
this._scaleAm = uni.createAnimation({
|
||||
transformOrigin: `${initX}px ${this._initY}px 0`,
|
||||
timingFunction: 'ease-in-out'
|
||||
});
|
||||
// #ifdef MP-TOUTIAO
|
||||
this._scaleAm.opacity(1);
|
||||
// #endif
|
||||
this._scaleAm.scale(2).step();
|
||||
this._tMax = initX / 2;
|
||||
this._tMin = (initX - this.width) / 2;
|
||||
this._tX = 0;
|
||||
}
|
||||
this._zoom = !this._zoom;
|
||||
this.scaleAm = this._scaleAm.export();
|
||||
}
|
||||
this._lastT = e.timeStamp;
|
||||
// #endif
|
||||
},
|
||||
_touchstart(e) {
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
if (e.touches.length == 1)
|
||||
this._initX = this._lastX = e.touches[0].pageX;
|
||||
// #endif
|
||||
},
|
||||
_touchmove(e) {
|
||||
// #ifndef MP-BAIDU || MP-ALIPAY || APP-PLUS
|
||||
var diff = e.touches[0].pageX - this._lastX;
|
||||
if (this._zoom && e.touches.length == 1 && Math.abs(diff) > 20) {
|
||||
this._lastX = e.touches[0].pageX;
|
||||
if ((this._tX <= this._tMin && diff < 0) || (this._tX >= this._tMax && diff > 0))
|
||||
return;
|
||||
this._tX += (diff * Math.abs(this._lastX - this._initX) * 0.05);
|
||||
if (this._tX < this._tMin) this._tX = this._tMin;
|
||||
if (this._tX > this._tMax) this._tX = this._tMax;
|
||||
this._scaleAm.translateX(this._tX).step();
|
||||
this.scaleAm = this._scaleAm.export();
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@keyframes show {
|
||||
0% {
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* #ifdef MP-WEIXIN */
|
||||
:host {
|
||||
display: block;
|
||||
overflow: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
</style>
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
解析和匹配 Css 的选择器
|
||||
github:https://github.com/jin-yufeng/Parser
|
||||
docs:https://jin-yufeng.github.io/Parser
|
||||
author:JinYufeng
|
||||
update:2020/03/15
|
||||
*/
|
||||
var cfg = require('./config.js');
|
||||
class CssHandler {
|
||||
constructor(tagStyle) {
|
||||
var styles = Object.assign({}, cfg.userAgentStyles);
|
||||
for (var item in tagStyle)
|
||||
styles[item] = (styles[item] ? styles[item] + ';' : '') + tagStyle[item];
|
||||
this.styles = styles;
|
||||
}
|
||||
getStyle = data => this.styles = new CssParser(data, this.styles).parse();
|
||||
match(name, attrs) {
|
||||
var tmp, matched = (tmp = this.styles[name]) ? tmp + ';' : '';
|
||||
if (attrs.class) {
|
||||
var items = attrs.class.split(' ');
|
||||
for (var i = 0, item; item = items[i]; i++)
|
||||
if (tmp = this.styles['.' + item])
|
||||
matched += tmp + ';';
|
||||
}
|
||||
if (tmp = this.styles['#' + attrs.id])
|
||||
matched += tmp + ';';
|
||||
return matched;
|
||||
}
|
||||
}
|
||||
module.exports = CssHandler;
|
||||
class CssParser {
|
||||
constructor(data, init) {
|
||||
this.data = data;
|
||||
this.floor = 0;
|
||||
this.i = 0;
|
||||
this.list = [];
|
||||
this.res = init;
|
||||
this.state = this.Space;
|
||||
}
|
||||
parse() {
|
||||
for (var c; c = this.data[this.i]; this.i++)
|
||||
this.state(c);
|
||||
return this.res;
|
||||
}
|
||||
section = () => this.data.substring(this.start, this.i);
|
||||
isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
// 状态机
|
||||
Space(c) {
|
||||
if (c == '.' || c == '#' || this.isLetter(c)) {
|
||||
this.start = this.i;
|
||||
this.state = this.Name;
|
||||
} else if (c == '/' && this.data[this.i + 1] == '*')
|
||||
this.Comment();
|
||||
else if (!cfg.blankChar[c] && c != ';')
|
||||
this.state = this.Ignore;
|
||||
}
|
||||
Comment() {
|
||||
this.i = this.data.indexOf('*/', this.i) + 1;
|
||||
if (!this.i) this.i = this.data.length;
|
||||
this.state = this.Space;
|
||||
}
|
||||
Ignore(c) {
|
||||
if (c == '{') this.floor++;
|
||||
else if (c == '}' && !--this.floor) this.state = this.Space;
|
||||
}
|
||||
Name(c) {
|
||||
if (cfg.blankChar[c]) {
|
||||
this.list.push(this.section());
|
||||
this.state = this.NameSpace;
|
||||
} else if (c == '{') {
|
||||
this.list.push(this.section());
|
||||
this.Content();
|
||||
} else if (c == ',') {
|
||||
this.list.push(this.section());
|
||||
this.Comma();
|
||||
} else if (!this.isLetter(c) && (c < '0' || c > '9') && c != '-' && c != '_')
|
||||
this.state = this.Ignore;
|
||||
}
|
||||
NameSpace(c) {
|
||||
if (c == '{') this.Content();
|
||||
else if (c == ',') this.Comma();
|
||||
else if (!cfg.blankChar[c]) this.state = this.Ignore;
|
||||
}
|
||||
Comma() {
|
||||
while (cfg.blankChar[this.data[++this.i]]);
|
||||
if (this.data[this.i] == '{') this.Content();
|
||||
else {
|
||||
this.start = this.i--;
|
||||
this.state = this.Name;
|
||||
}
|
||||
}
|
||||
Content() {
|
||||
this.start = ++this.i;
|
||||
if ((this.i = this.data.indexOf('}', this.i)) == -1) this.i = this.data.length;
|
||||
var content = this.section();
|
||||
for (var i = 0, item; item = this.list[i++];)
|
||||
if (this.res[item]) this.res[item] += ';' + content;
|
||||
else this.res[item] = content;
|
||||
this.list = [];
|
||||
this.state = this.Space;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,577 @@
|
|||
/*
|
||||
将 html 解析为适用于小程序 rich-text 的 DOM 结构
|
||||
github:https://github.com/jin-yufeng/Parser
|
||||
docs:https://jin-yufeng.github.io/Parser
|
||||
author:JinYufeng
|
||||
update:2020/04/13
|
||||
*/
|
||||
var cfg = require('./config.js'),
|
||||
blankChar = cfg.blankChar,
|
||||
CssHandler = require('./CssHandler.js'),
|
||||
{
|
||||
screenWidth,
|
||||
system
|
||||
} = wx.getSystemInfoSync();
|
||||
// #ifdef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO
|
||||
var entities = {
|
||||
lt: '<',
|
||||
gt: '>',
|
||||
amp: '&',
|
||||
quot: '"',
|
||||
apos: "'",
|
||||
nbsp: '\xA0',
|
||||
ensp: '\u2002',
|
||||
emsp: '\u2003',
|
||||
ndash: '–',
|
||||
mdash: '—',
|
||||
middot: '·',
|
||||
lsquo: '‘',
|
||||
rsquo: '’',
|
||||
ldquo: '“',
|
||||
rdquo: '”',
|
||||
bull: '•',
|
||||
hellip: '…',
|
||||
permil: '‰',
|
||||
copy: '©',
|
||||
reg: '®',
|
||||
trade: '™',
|
||||
times: '×',
|
||||
divide: '÷',
|
||||
cent: '¢',
|
||||
pound: '£',
|
||||
yen: '¥',
|
||||
euro: '€',
|
||||
sect: '§'
|
||||
};
|
||||
// #endif
|
||||
var emoji; // emoji 补丁包 https://jin-yufeng.github.io/Parser/#/instructions?id=emoji
|
||||
class MpHtmlParser {
|
||||
constructor(data, options = {}) {
|
||||
this.attrs = {};
|
||||
this.compress = options.compress;
|
||||
this.CssHandler = new CssHandler(options.tagStyle, screenWidth);
|
||||
this.data = data;
|
||||
this.domain = options.domain;
|
||||
this.DOM = [];
|
||||
this.i = this.start = this.audioNum = this.imgNum = this.videoNum = 0;
|
||||
this.protocol = this.domain && this.domain.includes('://') ? this.domain.split('://')[0] : '';
|
||||
this.state = this.Text;
|
||||
this.STACK = [];
|
||||
this.useAnchor = options.useAnchor;
|
||||
this.xml = options.xml;
|
||||
}
|
||||
parse() {
|
||||
if (emoji) this.data = emoji.parseEmoji(this.data);
|
||||
for (var c; c = this.data[this.i]; this.i++)
|
||||
this.state(c);
|
||||
if (this.state == this.Text) this.setText();
|
||||
while (this.STACK.length) this.popNode(this.STACK.pop());
|
||||
// #ifdef MP-BAIDU || MP-TOUTIAO
|
||||
// 将顶层标签的一些样式提取出来给 rich-text
|
||||
(function f(ns) {
|
||||
for (var i = ns.length, n; n = ns[--i];) {
|
||||
if (n.type == 'text') continue;
|
||||
if (!n.c) {
|
||||
var style = n.attrs.style;
|
||||
if (style) {
|
||||
var j, k, res;
|
||||
if ((j = style.indexOf('display')) != -1)
|
||||
res = style.substring(j, (k = style.indexOf(';', j)) == -1 ? style.length : k);
|
||||
if ((j = style.indexOf('float')) != -1)
|
||||
res += ';' + style.substring(j, (k = style.indexOf(';', j)) == -1 ? style.length : k);
|
||||
n.attrs.contain = res;
|
||||
}
|
||||
} else f(n.children);
|
||||
}
|
||||
})(this.DOM);
|
||||
// #endif
|
||||
if (this.DOM.length) {
|
||||
this.DOM[0].PoweredBy = 'Parser';
|
||||
if (this.title) this.DOM[0].title = this.title;
|
||||
}
|
||||
return this.DOM;
|
||||
}
|
||||
// 设置属性
|
||||
setAttr() {
|
||||
var name = this.getName(this.attrName);
|
||||
if (cfg.trustAttrs[name]) {
|
||||
if (!this.attrVal) {
|
||||
if (cfg.boolAttrs[name]) this.attrs[name] = 'T';
|
||||
} else if (name == 'src') this.attrs[name] = this.getUrl(this.attrVal.replace(/&/g, '&'));
|
||||
else this.attrs[name] = this.attrVal;
|
||||
}
|
||||
this.attrVal = '';
|
||||
while (blankChar[this.data[this.i]]) this.i++;
|
||||
if (this.isClose()) this.setNode();
|
||||
else {
|
||||
this.start = this.i;
|
||||
this.state = this.AttrName;
|
||||
}
|
||||
}
|
||||
// 设置文本节点
|
||||
setText() {
|
||||
var back, text = this.section();
|
||||
if (!text) return;
|
||||
text = (cfg.onText && cfg.onText(text, () => back = true)) || text;
|
||||
if (back) {
|
||||
this.data = this.data.substr(0, this.start) + text + this.data.substr(this.i);
|
||||
let j = this.start + text.length;
|
||||
for (this.i = this.start; this.i < j; this.i++) this.state(this.data[this.i]);
|
||||
return;
|
||||
}
|
||||
if (!this.pre) {
|
||||
// 合并空白符
|
||||
var tmp = [];
|
||||
for (let i = text.length, c; c = text[--i];)
|
||||
if (!blankChar[c] || (!blankChar[tmp[0]] && (c = ' '))) tmp.unshift(c);
|
||||
text = tmp.join('');
|
||||
if (text == ' ') return;
|
||||
}
|
||||
// 处理实体
|
||||
var siblings = this.siblings(),
|
||||
i = -1,
|
||||
j, en;
|
||||
while (1) {
|
||||
if ((i = text.indexOf('&', i + 1)) == -1) break;
|
||||
if ((j = text.indexOf(';', i + 2)) == -1) break;
|
||||
if (text[i + 1] == '#') {
|
||||
en = parseInt((text[i + 2] == 'x' ? '0' : '') + text.substring(i + 2, j));
|
||||
if (!isNaN(en)) text = text.substr(0, i) + String.fromCharCode(en) + text.substring(j + 1);
|
||||
} else {
|
||||
en = text.substring(i + 1, j);
|
||||
// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
|
||||
if (en == 'nbsp') text = text.substr(0, i) + '\xA0' + text.substr(j + 1); // 解决 失效
|
||||
else if (en != 'lt' && en != 'gt' && en != 'amp' && en != 'ensp' && en != 'emsp' && en != 'quot' && en != 'apos') {
|
||||
i && siblings.push({
|
||||
type: 'text',
|
||||
text: text.substr(0, i)
|
||||
})
|
||||
siblings.push({
|
||||
type: 'text',
|
||||
text: `&${en};`,
|
||||
en: 1
|
||||
})
|
||||
text = text.substr(j + 1);
|
||||
i = -1;
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO
|
||||
if (entities[en]) text = text.substr(0, i) + entities[en] + text.substr(j + 1);
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
text && siblings.push({
|
||||
type: 'text',
|
||||
text
|
||||
})
|
||||
}
|
||||
// 设置元素节点
|
||||
setNode() {
|
||||
var node = {
|
||||
name: this.tagName.toLowerCase(),
|
||||
attrs: this.attrs
|
||||
},
|
||||
close = cfg.selfClosingTags[node.name] || (this.xml && this.data[this.i] == '/');
|
||||
this.attrs = {};
|
||||
if (!cfg.ignoreTags[node.name]) {
|
||||
this.matchAttr(node);
|
||||
if (!close) {
|
||||
node.children = [];
|
||||
if (node.name == 'pre' && cfg.highlight) {
|
||||
this.remove(node);
|
||||
this.pre = node.pre = true;
|
||||
}
|
||||
this.siblings().push(node);
|
||||
this.STACK.push(node);
|
||||
} else if (!cfg.filter || cfg.filter(node, this) != false)
|
||||
this.siblings().push(node);
|
||||
} else {
|
||||
if (!close) this.remove(node);
|
||||
else if (node.name == 'source') {
|
||||
var parent = this.STACK[this.STACK.length - 1],
|
||||
attrs = node.attrs;
|
||||
if (parent && attrs.src)
|
||||
if (parent.name == 'video' || parent.name == 'audio')
|
||||
parent.attrs.source.push(attrs.src);
|
||||
else {
|
||||
var i, media = attrs.media;
|
||||
if (parent.name == 'picture' && !parent.attrs.src && !(attrs.src.indexOf('.webp') && system.includes('iOS')) &&
|
||||
(!media || (media.includes('px') &&
|
||||
(((i = media.indexOf('min-width')) != -1 && (i = media.indexOf(':', i + 8)) != -1 && screenWidth > parseInt(
|
||||
media.substr(i + 1))) ||
|
||||
((i = media.indexOf('max-width')) != -1 && (i = media.indexOf(':', i + 8)) != -1 && screenWidth < parseInt(
|
||||
media.substr(i + 1)))))))
|
||||
parent.attrs.src = attrs.src;
|
||||
}
|
||||
} else if (node.name == 'base' && !this.domain) this.domain = node.attrs.href;
|
||||
}
|
||||
if (this.data[this.i] == '/') this.i++;
|
||||
this.start = this.i + 1;
|
||||
this.state = this.Text;
|
||||
}
|
||||
// 移除标签
|
||||
remove(node) {
|
||||
var name = node.name,
|
||||
j = this.i;
|
||||
while (1) {
|
||||
if ((this.i = this.data.indexOf('</', this.i + 1)) == -1) {
|
||||
if (name == 'pre' || name == 'svg') this.i = j;
|
||||
else this.i = this.data.length;
|
||||
return;
|
||||
}
|
||||
this.start = (this.i += 2);
|
||||
while (!blankChar[this.data[this.i]] && !this.isClose()) this.i++;
|
||||
if (this.getName(this.section()) == name) {
|
||||
// 代码块高亮
|
||||
if (name == 'pre') {
|
||||
this.data = this.data.substr(0, j + 1) + cfg.highlight(this.data.substring(j + 1, this.i - 5), node.attrs) +
|
||||
this.data.substr(this.i - 5);
|
||||
return this.i = j;
|
||||
} else if (name == 'style')
|
||||
this.CssHandler.getStyle(this.data.substring(j + 1, this.i - 7));
|
||||
else if (name == 'title')
|
||||
this.title = this.data.substring(j + 1, this.i - 7);
|
||||
if ((this.i = this.data.indexOf('>', this.i)) == -1) this.i = this.data.length;
|
||||
// 处理 svg
|
||||
if (name == 'svg') {
|
||||
var src = this.data.substring(j, this.i + 1);
|
||||
if (!node.attrs.xmlns) src = ' xmlns="http://www.w3.org/2000/svg"' + src;
|
||||
var i = j;
|
||||
while (this.data[j] != '<') j--;
|
||||
src = this.data.substring(j, i) + src;
|
||||
var parent = this.STACK[this.STACK.length - 1];
|
||||
if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline'))
|
||||
parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style;
|
||||
this.siblings().push({
|
||||
name: 'img',
|
||||
attrs: {
|
||||
src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'),
|
||||
ignore: 'T'
|
||||
}
|
||||
})
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理属性
|
||||
matchAttr(node) {
|
||||
var attrs = node.attrs,
|
||||
style = this.CssHandler.match(node.name, attrs, node) + (attrs.style || ''),
|
||||
styleObj = {};
|
||||
if (attrs.id) {
|
||||
if (this.compress & 1) attrs.id = void 0;
|
||||
else if (this.useAnchor) this.bubble();
|
||||
}
|
||||
if ((this.compress & 2) && attrs.class) attrs.class = void 0;
|
||||
switch (node.name) {
|
||||
case 'img':
|
||||
if (attrs['data-src']) {
|
||||
attrs.src = attrs.src || attrs['data-src'];
|
||||
attrs['data-src'] = void 0;
|
||||
}
|
||||
if (attrs.src && !attrs.ignore) {
|
||||
if (this.bubble()) attrs.i = (this.imgNum++).toString();
|
||||
else attrs.ignore = 'T';
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
case 'ad':
|
||||
// #ifdef APP-PLUS
|
||||
case 'iframe':
|
||||
case 'embed':
|
||||
// #endif
|
||||
this.bubble();
|
||||
break;
|
||||
case 'font':
|
||||
if (attrs.color) {
|
||||
styleObj['color'] = attrs.color;
|
||||
attrs.color = void 0;
|
||||
}
|
||||
if (attrs.face) {
|
||||
styleObj['font-family'] = attrs.face;
|
||||
attrs.face = void 0;
|
||||
}
|
||||
if (attrs.size) {
|
||||
var size = parseInt(attrs.size);
|
||||
if (size < 1) size = 1;
|
||||
else if (size > 7) size = 7;
|
||||
var map = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
|
||||
styleObj['font-size'] = map[size - 1];
|
||||
attrs.size = void 0;
|
||||
}
|
||||
break;
|
||||
case 'video':
|
||||
case 'audio':
|
||||
if (!attrs.id) attrs.id = node.name + (++this[`${node.name}Num`]);
|
||||
else this[`${node.name}Num`]++;
|
||||
if (node.name == 'video') {
|
||||
if (attrs.width) {
|
||||
style = `width:${parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px')};${style}`;
|
||||
attrs.width = void 0;
|
||||
}
|
||||
if (attrs.height) {
|
||||
style = `height:${parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px')};${style}`;
|
||||
attrs.height = void 0;
|
||||
}
|
||||
if (this.videoNum > 3) node.lazyLoad = true;
|
||||
}
|
||||
attrs.source = [];
|
||||
if (attrs.src) attrs.source.push(attrs.src);
|
||||
if (!attrs.controls && !attrs.autoplay)
|
||||
console.warn(`存在没有 controls 属性的 ${node.name} 标签,可能导致无法播放`, node);
|
||||
this.bubble();
|
||||
break;
|
||||
case 'td':
|
||||
case 'th':
|
||||
if (attrs.colspan || attrs.rowspan)
|
||||
for (var k = this.STACK.length, item; item = this.STACK[--k];)
|
||||
if (item.name == 'table') {
|
||||
item.c = void 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (attrs.align) {
|
||||
styleObj['text-align'] = attrs.align;
|
||||
attrs.align = void 0;
|
||||
}
|
||||
// 压缩 style
|
||||
var styles = style.replace(/"/g, '"').replace(/&/g, '&').split(';');
|
||||
style = '';
|
||||
for (var i = 0, len = styles.length; i < len; i++) {
|
||||
var info = styles[i].split(':');
|
||||
if (info.length < 2) continue;
|
||||
let key = info[0].trim().toLowerCase(),
|
||||
value = info.slice(1).join(':').trim();
|
||||
if (value.includes('-webkit') || value.includes('-moz') || value.includes('-ms') || value.includes('-o') || value
|
||||
.includes(
|
||||
'safe'))
|
||||
style += `;${key}:${value}`;
|
||||
else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import'))
|
||||
styleObj[key] = value;
|
||||
}
|
||||
if (node.name == 'img' && parseInt(styleObj.width || attrs.width) > screenWidth)
|
||||
styleObj.height = 'auto';
|
||||
for (var key in styleObj) {
|
||||
var value = styleObj[key];
|
||||
if (key.includes('flex') || key == 'order' || key == 'self-align') node.c = 1;
|
||||
// 填充链接
|
||||
if (value.includes('url')) {
|
||||
var j = value.indexOf('(');
|
||||
if (j++ != -1) {
|
||||
while (value[j] == '"' || value[j] == "'" || blankChar[value[j]]) j++;
|
||||
value = value.substr(0, j) + this.getUrl(value.substr(j));
|
||||
}
|
||||
}
|
||||
// 转换 rpx
|
||||
else if (value.includes('rpx'))
|
||||
value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * screenWidth / 750 + 'px');
|
||||
else if (key == 'white-space' && value.includes('pre'))
|
||||
this.pre = node.pre = true;
|
||||
style += `;${key}:${value}`;
|
||||
}
|
||||
style = style.substr(1);
|
||||
if (style) attrs.style = style;
|
||||
}
|
||||
// 节点出栈处理
|
||||
popNode(node) {
|
||||
// 空白符处理
|
||||
if (node.pre) {
|
||||
node.pre = this.pre = void 0;
|
||||
for (let i = this.STACK.length; i--;)
|
||||
if (this.STACK[i].pre)
|
||||
this.pre = true;
|
||||
}
|
||||
if (node.name == 'head' || (cfg.filter && cfg.filter(node, this) == false))
|
||||
return this.siblings().pop();
|
||||
var attrs = node.attrs;
|
||||
// 替换一些标签名
|
||||
if (node.name == 'picture') {
|
||||
node.name = 'img';
|
||||
if (!attrs.src && (node.children[0] || '').name == 'img')
|
||||
attrs.src = node.children[0].attrs.src;
|
||||
if (attrs.src && !attrs.ignore)
|
||||
attrs.i = (this.imgNum++).toString();
|
||||
return node.children = void 0;
|
||||
}
|
||||
if (cfg.blockTags[node.name]) node.name = 'div';
|
||||
else if (!cfg.trustTags[node.name]) node.name = 'span';
|
||||
// 处理列表
|
||||
if (node.c) {
|
||||
if (node.name == 'ul') {
|
||||
var floor = 1;
|
||||
for (let i = this.STACK.length; i--;)
|
||||
if (this.STACK[i].name == 'ul') floor++;
|
||||
if (floor != 1)
|
||||
for (let i = node.children.length; i--;)
|
||||
node.children[i].floor = floor;
|
||||
} else if (node.name == 'ol') {
|
||||
for (let i = 0, num = 1, child; child = node.children[i++];)
|
||||
if (child.name == 'li') {
|
||||
child.type = 'ol';
|
||||
child.num = ((num, type) => {
|
||||
if (type == 'a') return String.fromCharCode(97 + (num - 1) % 26);
|
||||
if (type == 'A') return String.fromCharCode(65 + (num - 1) % 26);
|
||||
if (type == 'i' || type == 'I') {
|
||||
num = (num - 1) % 99 + 1;
|
||||
var one = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'],
|
||||
ten = ['X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'],
|
||||
res = (ten[Math.floor(num / 10) - 1] || '') + (one[num % 10 - 1] || '');
|
||||
if (type == 'i') return res.toLowerCase();
|
||||
return res;
|
||||
}
|
||||
return num;
|
||||
})(num++, attrs.type) + '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理表格的边框
|
||||
if (node.name == 'table') {
|
||||
var padding = attrs.cellpadding,
|
||||
spacing = attrs.cellspacing,
|
||||
border = attrs.border;
|
||||
if (node.c) {
|
||||
this.bubble();
|
||||
if (!padding) padding = 2;
|
||||
if (!spacing) spacing = 2;
|
||||
}
|
||||
if (border) attrs.style = `border:${border}px solid gray;${attrs.style || ''}`;
|
||||
if (spacing) attrs.style = `border-spacing:${spacing}px;${attrs.style || ''}`;
|
||||
if (border || padding)
|
||||
(function f(ns) {
|
||||
for (var i = 0, n; n = ns[i]; i++) {
|
||||
if (n.name == 'th' || n.name == 'td') {
|
||||
if (border) n.attrs.style = `border:${border}px solid gray;${n.attrs.style}`;
|
||||
if (padding) n.attrs.style = `padding:${padding}px;${n.attrs.style}`;
|
||||
} else f(n.children || []);
|
||||
}
|
||||
})(node.children)
|
||||
}
|
||||
this.CssHandler.pop && this.CssHandler.pop(node);
|
||||
// 自动压缩
|
||||
if (node.name == 'div' && !Object.keys(attrs).length) {
|
||||
var siblings = this.siblings();
|
||||
if (node.children.length == 1 && node.children[0].name == 'div')
|
||||
siblings[siblings.length - 1] = node.children[0];
|
||||
}
|
||||
}
|
||||
// 工具函数
|
||||
bubble() {
|
||||
for (var i = this.STACK.length, item; item = this.STACK[--i];) {
|
||||
if (cfg.richOnlyTags[item.name]) {
|
||||
if (item.name == 'table' && !Object.hasOwnProperty.call(item, 'c')) item.c = 1;
|
||||
return false;
|
||||
}
|
||||
item.c = 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
getName = val => this.xml ? val : val.toLowerCase();
|
||||
getUrl(url) {
|
||||
if (url[0] == '/') {
|
||||
if (url[1] == '/') url = this.protocol + ':' + url;
|
||||
else if (this.domain) url = this.domain + url;
|
||||
} else if (this.domain && url.indexOf('data:') != 0 && !url.includes('://'))
|
||||
url = this.domain + '/' + url;
|
||||
return url;
|
||||
}
|
||||
isClose = () => this.data[this.i] == '>' || (this.data[this.i] == '/' && this.data[this.i + 1] == '>');
|
||||
section = () => this.data.substring(this.start, this.i);
|
||||
siblings = () => this.STACK.length ? this.STACK[this.STACK.length - 1].children : this.DOM;
|
||||
// 状态机
|
||||
Text(c) {
|
||||
if (c == '<') {
|
||||
var next = this.data[this.i + 1],
|
||||
isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
if (isLetter(next)) {
|
||||
this.setText();
|
||||
this.start = this.i + 1;
|
||||
this.state = this.TagName;
|
||||
} else if (next == '/') {
|
||||
this.setText();
|
||||
if (isLetter(this.data[++this.i + 1])) {
|
||||
this.start = this.i + 1;
|
||||
this.state = this.EndTag;
|
||||
} else
|
||||
this.Comment();
|
||||
} else if (next == '!') {
|
||||
this.setText();
|
||||
this.Comment();
|
||||
}
|
||||
}
|
||||
}
|
||||
Comment() {
|
||||
var key;
|
||||
if (this.data.substring(this.i + 2, this.i + 4) == '--') key = '-->';
|
||||
else if (this.data.substring(this.i + 2, this.i + 9) == '[CDATA[') key = ']]>';
|
||||
else key = '>';
|
||||
if ((this.i = this.data.indexOf(key, this.i + 2)) == -1) this.i = this.data.length;
|
||||
else this.i += key.length - 1;
|
||||
this.start = this.i + 1;
|
||||
this.state = this.Text;
|
||||
}
|
||||
TagName(c) {
|
||||
if (blankChar[c]) {
|
||||
this.tagName = this.section();
|
||||
while (blankChar[this.data[this.i]]) this.i++;
|
||||
if (this.isClose()) this.setNode();
|
||||
else {
|
||||
this.start = this.i;
|
||||
this.state = this.AttrName;
|
||||
}
|
||||
} else if (this.isClose()) {
|
||||
this.tagName = this.section();
|
||||
this.setNode();
|
||||
}
|
||||
}
|
||||
AttrName(c) {
|
||||
var blank = blankChar[c];
|
||||
if (blank) {
|
||||
this.attrName = this.section();
|
||||
c = this.data[this.i];
|
||||
}
|
||||
if (c == '=') {
|
||||
if (!blank) this.attrName = this.section();
|
||||
while (blankChar[this.data[++this.i]]);
|
||||
this.start = this.i--;
|
||||
this.state = this.AttrValue;
|
||||
} else if (blank) this.setAttr();
|
||||
else if (this.isClose()) {
|
||||
this.attrName = this.section();
|
||||
this.setAttr();
|
||||
}
|
||||
}
|
||||
AttrValue(c) {
|
||||
if (c == '"' || c == "'") {
|
||||
this.start++;
|
||||
if ((this.i = this.data.indexOf(c, this.i + 1)) == -1) return this.i = this.data.length;
|
||||
this.attrVal = this.section();
|
||||
this.i++;
|
||||
} else {
|
||||
for (; !blankChar[this.data[this.i]] && !this.isClose(); this.i++);
|
||||
this.attrVal = this.section();
|
||||
}
|
||||
this.setAttr();
|
||||
}
|
||||
EndTag(c) {
|
||||
if (blankChar[c] || c == '>' || c == '/') {
|
||||
var name = this.getName(this.section());
|
||||
for (var i = this.STACK.length; i--;)
|
||||
if (this.STACK[i].name == name) break;
|
||||
if (i != -1) {
|
||||
var node;
|
||||
while ((node = this.STACK.pop()).name != name);
|
||||
this.popNode(node);
|
||||
} else if (name == 'p' || name == 'br')
|
||||
this.siblings().push({
|
||||
name,
|
||||
attrs: {}
|
||||
});
|
||||
this.i = this.data.indexOf('>', this.i);
|
||||
this.start = this.i + 1;
|
||||
if (this.i == -1) this.i = this.data.length;
|
||||
else this.state = this.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = MpHtmlParser;
|
|
@ -0,0 +1,80 @@
|
|||
/* 配置文件 */
|
||||
// #ifdef MP-WEIXIN
|
||||
const canIUse = wx.canIUse('editor'); // 高基础库标识,用于兼容
|
||||
// #endif
|
||||
module.exports = {
|
||||
// 过滤器函数
|
||||
filter: null,
|
||||
// 代码高亮函数
|
||||
highlight: null,
|
||||
// 文本处理函数
|
||||
onText: null,
|
||||
blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
|
||||
// 块级标签,将被转为 div
|
||||
blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,section' + (
|
||||
// #ifdef MP-WEIXIN
|
||||
canIUse ? '' :
|
||||
// #endif
|
||||
',pre')),
|
||||
// 将被移除的标签
|
||||
ignoreTags: makeMap(
|
||||
'area,base,basefont,canvas,command,frame,input,isindex,keygen,link,map,meta,param,script,source,style,svg,textarea,title,track,use,wbr'
|
||||
// #ifdef MP-WEIXIN
|
||||
+ (canIUse ? ',rp' : '')
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
+ ',embed,iframe'
|
||||
// #endif
|
||||
),
|
||||
// 只能被 rich-text 显示的标签
|
||||
richOnlyTags: makeMap('a,colgroup,fieldset,legend,picture,table'
|
||||
// #ifdef MP-WEIXIN
|
||||
+ (canIUse ? ',bdi,bdo,caption,rt,ruby' : '')
|
||||
// #endif
|
||||
),
|
||||
// 自闭合的标签
|
||||
selfClosingTags: makeMap(
|
||||
'area,base,basefont,br,col,circle,ellipse,embed,frame,hr,img,input,isindex,keygen,line,link,meta,param,path,polygon,rect,source,track,use,wbr'
|
||||
),
|
||||
// 信任的属性
|
||||
trustAttrs: makeMap(
|
||||
'align,alt,app-id,author,autoplay,border,cellpadding,cellspacing,class,color,colspan,controls,data-src,dir,face,height,href,id,ignore,loop,media,muted,name,path,poster,rowspan,size,span,src,start,style,type,unit-id,width,xmlns'
|
||||
),
|
||||
// bool 型的属性
|
||||
boolAttrs: makeMap('autoplay,controls,ignore,loop,muted'),
|
||||
// 信任的标签
|
||||
trustTags: makeMap(
|
||||
'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'
|
||||
// #ifdef MP-WEIXIN
|
||||
+ (canIUse ? ',bdi,bdo,caption,pre,rt,ruby' : '')
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
+ ',embed,iframe'
|
||||
// #endif
|
||||
),
|
||||
// 默认的标签样式
|
||||
userAgentStyles: {
|
||||
address: 'font-style:italic',
|
||||
big: 'display:inline;font-size:1.2em',
|
||||
blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px',
|
||||
caption: 'display:table-caption;text-align:center',
|
||||
center: 'text-align:center',
|
||||
cite: 'font-style:italic',
|
||||
dd: 'margin-left:40px',
|
||||
img: 'max-width:100%',
|
||||
mark: 'background-color:yellow',
|
||||
picture: 'max-width:100%',
|
||||
pre: 'font-family:monospace;white-space:pre;overflow:scroll',
|
||||
s: 'text-decoration:line-through',
|
||||
small: 'display:inline;font-size:0.8em',
|
||||
u: 'text-decoration:underline'
|
||||
}
|
||||
}
|
||||
|
||||
function makeMap(str) {
|
||||
var map = {},
|
||||
list = str.split(',');
|
||||
for (var i = list.length; i--;)
|
||||
map[list[i]] = true;
|
||||
return map;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
var inlineTags = {
|
||||
abbr: 1,
|
||||
b: 1,
|
||||
big: 1,
|
||||
code: 1,
|
||||
del: 1,
|
||||
em: 1,
|
||||
i: 1,
|
||||
ins: 1,
|
||||
label: 1,
|
||||
q: 1,
|
||||
small: 1,
|
||||
span: 1,
|
||||
strong: 1
|
||||
}
|
||||
export default {
|
||||
// 从顶层标签的样式中取出一些给 rich-text
|
||||
getStyle: function(style) {
|
||||
if (style) {
|
||||
var i, j, res = '';
|
||||
if ((i = style.indexOf('display')) != -1)
|
||||
res = style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j);
|
||||
if ((i = style.indexOf('float')) != -1)
|
||||
res += ';' + style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j);
|
||||
return res;
|
||||
}
|
||||
},
|
||||
getNode: function(item) {
|
||||
return [item];
|
||||
},
|
||||
// 是否通过 rich-text 显示
|
||||
useRichText: function(item) {
|
||||
return !item.c && !inlineTags[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
var inlineTags = {
|
||||
abbr: 1,
|
||||
b: 1,
|
||||
big: 1,
|
||||
code: 1,
|
||||
del: 1,
|
||||
em: 1,
|
||||
i: 1,
|
||||
ins: 1,
|
||||
label: 1,
|
||||
q: 1,
|
||||
small: 1,
|
||||
span: 1,
|
||||
strong: 1
|
||||
}
|
||||
module.exports = {
|
||||
// 从顶层标签的样式中取出一些给 rich-text
|
||||
getStyle: function(style) {
|
||||
if (style) {
|
||||
var i, j, res = '';
|
||||
if ((i = style.indexOf('display')) != -1)
|
||||
res = style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j);
|
||||
if ((i = style.indexOf('float')) != -1)
|
||||
res += ';' + style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j);
|
||||
return res;
|
||||
}
|
||||
},
|
||||
// 处理懒加载
|
||||
getNode: function(item, imgLoad) {
|
||||
if (!imgLoad && item.attrs.i != '0') {
|
||||
var img = {
|
||||
name: 'img',
|
||||
attrs: JSON.parse(JSON.stringify(item.attrs))
|
||||
}
|
||||
delete img.attrs.src;
|
||||
img.attrs.style += ';width:20px;height:20px';
|
||||
return [img];
|
||||
} else return [item];
|
||||
},
|
||||
// 是否通过 rich-text 显示
|
||||
useRichText: function(item) {
|
||||
return !item.c && !inlineTags[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,476 @@
|
|||
<!--
|
||||
trees 递归显示组件
|
||||
github:https://github.com/jin-yufeng/Parser
|
||||
docs:https://jin-yufeng.github.io/Parser
|
||||
插件市场:https://ext.dcloud.net.cn/plugin?id=805
|
||||
author:JinYufeng
|
||||
update:2020/04/13
|
||||
-->
|
||||
<template>
|
||||
<view class="interlayer">
|
||||
<block v-for="(n, index) in nodes" v-bind:key="index">
|
||||
<!--图片-->
|
||||
<!--#ifdef MP-WEIXIN || MP-QQ || MP-ALIPAY || APP-PLUS-->
|
||||
<rich-text v-if="n.name=='img'" :id="n.attrs.id" class="_img" :style="''+handler.getStyle(n.attrs.style)" :nodes="handler.getNode(n,!lazyLoad||imgLoad)"
|
||||
:data-attrs="n.attrs" @tap="imgtap" @longpress="imglongtap" />
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-BAIDU || MP-TOUTIAO-->
|
||||
<rich-text v-if="n.name=='img'" :id="n.attrs.id" class="_img" :style="n.attrs.contain" :nodes='[n]' :data-attrs="n.attrs"
|
||||
@tap="imgtap" @longpress="imglongtap" />
|
||||
<!--#endif-->
|
||||
<!--文本-->
|
||||
<!--#ifdef MP-WEIXIN || MP-QQ || APP-PLUS-->
|
||||
<rich-text v-else-if="n.decode" class="_entity" :nodes="[n]"></rich-text>
|
||||
<!--#endif-->
|
||||
<text v-else-if="n.type=='text'" decode>{{n.text}}</text>
|
||||
<text v-else-if="n.name=='br'">\n</text>
|
||||
<!--视频-->
|
||||
<view v-else-if="n.name=='video'">
|
||||
<view v-if="(!loadVideo||n.lazyLoad)&&!(controls[n.attrs.id]&&controls[n.attrs.id].play)" :id="n.attrs.id" :class="'_video '+(n.attrs.class||'')"
|
||||
:style="n.attrs.style" @tap="_loadVideo" />
|
||||
<video v-else :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay||(controls[n.attrs.id]&&controls[n.attrs.id].play)"
|
||||
:controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :poster="n.attrs.poster" :src="n.attrs.source[(controls[n.attrs.id]&&controls[n.attrs.id].index)||0]"
|
||||
:unit-id="n.attrs['unit-id']" :data-id="n.attrs.id" data-from="video" data-source="source" @error="error" @play="play" />
|
||||
</view>
|
||||
<!--音频-->
|
||||
<audio v-else-if="n.name=='audio'" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author" :autoplay="n.attrs.autoplay"
|
||||
:controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster" :src="n.attrs.source[(controls[n.attrs.id]&&controls[n.attrs.id].index)||0]"
|
||||
:data-id="n.attrs.id" data-from="audio" data-source="source" @error="error" @play="play" />
|
||||
<!--链接-->
|
||||
<view v-else-if="n.name=='a'" :class="'_a '+(n.attrs.class||'')" hover-class="_hover" :style="n.attrs.style"
|
||||
:data-attrs="n.attrs" @tap="linkpress">
|
||||
<trees class="_span" :nodes="n.children" />
|
||||
</view>
|
||||
<!--广告(按需打开注释)-->
|
||||
<!--#ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO-->
|
||||
<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :unit-id="n.attrs['unit-id']"
|
||||
data-from="ad" @error="error" />-->
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-BAIDU-->
|
||||
<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :appid="n.attrs.appid"
|
||||
:apid="n.attrs.apid" :type="n.attrs.type" data-from="ad" @error="error" />-->
|
||||
<!--#endif-->
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :adpid="n.attrs.adpid"
|
||||
data-from="ad" @error="error" />-->
|
||||
<!--#endif-->
|
||||
<!--列表-->
|
||||
<view v-else-if="n.name=='li'" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:flex'">
|
||||
<view v-if="n.type=='ol'" class="_ol-bef">{{n.num}}</view>
|
||||
<view v-else class="_ul-bef">
|
||||
<view v-if="n.floor%3==0" class="_ul-p1">█</view>
|
||||
<view v-else-if="n.floor%3==2" class="_ul-p2" />
|
||||
<view v-else class="_ul-p1" style="border-radius:50%">█</view>
|
||||
</view>
|
||||
<!--#ifdef MP-ALIPAY-->
|
||||
<view class="_li">
|
||||
<trees :nodes="n.children" />
|
||||
</view>
|
||||
<!--#endif-->
|
||||
<!--#ifndef MP-ALIPAY-->
|
||||
<trees class="_li" :nodes="n.children" :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
|
||||
<!--#endif-->
|
||||
</view>
|
||||
<!--表格-->
|
||||
<view v-else-if="n.name=='table'&&n.c" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:table'">
|
||||
<view v-for="(tbody, i) in n.children" v-bind:key="i" :class="tbody.attrs.class" :style="(tbody.attrs.style||'')+(tbody.name[0]=='t'?';display:table-'+(tbody.name=='tr'?'row':'row-group'):'')">
|
||||
<view v-for="(tr, j) in tbody.children" v-bind:key="j" :class="tr.attrs.class" :style="(tr.attrs.style||'')+(tr.name[0]=='t'?';display:table-'+(tr.name=='tr'?'row':'cell'):'')">
|
||||
<trees v-if="tr.name=='td'" :nodes="tr.children" :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
|
||||
<block v-else>
|
||||
<!--#ifdef MP-ALIPAY-->
|
||||
<view v-for="(td, k) in tr.children" v-bind:key="k" :class="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')">
|
||||
<trees :nodes="td.children" />
|
||||
</view>
|
||||
<!--#endif-->
|
||||
<!--#ifndef MP-ALIPAY-->
|
||||
<trees v-for="(td, k) in tr.children" v-bind:key="k" :class="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')"
|
||||
:nodes="td.children" :lazyLoad="lazyLoad" :loadVideo="loadVideo" />
|
||||
<!--#endif-->
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<iframe v-else-if="n.name=='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder"
|
||||
:width="n.attrs.width" :height="n.attrs.height" :src="n.attrs.src" />
|
||||
<embed v-else-if="n.name=='embed'" :style="n.attrs.style" :width="n.attrs.width" :height="n.attrs.height" :src="n.attrs.src" />
|
||||
<!--#endif-->
|
||||
<!--富文本-->
|
||||
<!--#ifdef MP-WEIXIN || MP-QQ || MP-ALIPAY || APP-PLUS-->
|
||||
<rich-text v-else-if="handler.useRichText(n)" :id="n.attrs.id" :class="'_p __'+n.name" :nodes="[n]" />
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-BAIDU || MP-TOUTIAO-->
|
||||
<rich-text v-else-if="!(n.c||n.continue)" :id="n.attrs.id" :class="_p" :style="n.attrs.contain" :nodes="[n]" />
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-ALIPAY-->
|
||||
<view v-else :id="n.attrs.id" :class="'_'+n.name+' '+(n.attrs.class||'')" :style="n.attrs.style">
|
||||
<trees :nodes="n.children" />
|
||||
</view>
|
||||
<!--#endif-->
|
||||
<!--#ifndef MP-ALIPAY-->
|
||||
<trees v-else :class="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')" :style="n.attrs.style" :nodes="n.children"
|
||||
:lazyLoad="lazyLoad" :loadVideo="loadVideo" />
|
||||
<!--#endif-->
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
<script module="handler" lang="wxs" src="./handler.wxs"></script>
|
||||
<script module="handler" lang="sjs" src="./handler.sjs"></script>
|
||||
<script>
|
||||
global.Parser = {};
|
||||
import trees from './trees'
|
||||
export default {
|
||||
components: {
|
||||
trees
|
||||
},
|
||||
name: 'trees',
|
||||
data() {
|
||||
return {
|
||||
controls: {},
|
||||
// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
|
||||
imgLoad: false,
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
loadVideo: true
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
props: {
|
||||
nodes: Array,
|
||||
// #ifdef MP-WEIXIN || MP-QQ || H5 || APP-PLUS
|
||||
lazyLoad: Boolean,
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
loadVideo: Boolean
|
||||
// #endif
|
||||
},
|
||||
mounted() {
|
||||
// 获取顶层组件
|
||||
this.top = this.$parent;
|
||||
while (this.top.$options.name != 'parser') {
|
||||
if (this.top.top) {
|
||||
this.top = this.top.top;
|
||||
break;
|
||||
}
|
||||
this.top = this.top.$parent;
|
||||
}
|
||||
},
|
||||
// #ifdef MP-WEIXIN || MP-QQ || APP-PLUS
|
||||
beforeDestroy() {
|
||||
if (this.observer)
|
||||
this.observer.disconnect();
|
||||
},
|
||||
// #endif
|
||||
methods: {
|
||||
// #ifndef MP-ALIPAY
|
||||
play(e) {
|
||||
if (this.top.videoContexts.length > 1 && this.top.autopause)
|
||||
for (var i = this.top.videoContexts.length; i--;)
|
||||
if (this.top.videoContexts[i].id != e.currentTarget.dataset.id)
|
||||
this.top.videoContexts[i].pause();
|
||||
},
|
||||
// #endif
|
||||
imgtap(e) {
|
||||
var attrs = e.currentTarget.dataset.attrs;
|
||||
if (!attrs.ignore) {
|
||||
var preview = true, data = {
|
||||
id: e.target.id,
|
||||
src: attrs.src,
|
||||
ignore: () => preview = false
|
||||
};
|
||||
global.Parser.onImgtap && global.Parser.onImgtap(data);
|
||||
this.top.$emit('imgtap', data);
|
||||
if (preview) {
|
||||
var urls = this.top.imgList,
|
||||
current = urls[attrs.i] ? parseInt(attrs.i) : (urls = [attrs.src], 0);
|
||||
uni.previewImage({
|
||||
current,
|
||||
urls
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
imglongtap(e) {
|
||||
var attrs = e.item.dataset.attrs;
|
||||
if (!attrs.ignore)
|
||||
this.top.$emit('imglongtap', {
|
||||
id: e.target.id,
|
||||
src: attrs.src
|
||||
})
|
||||
},
|
||||
linkpress(e) {
|
||||
var jump = true,
|
||||
attrs = e.currentTarget.dataset.attrs;
|
||||
attrs.ignore = () => jump = false;
|
||||
global.Parser.onLinkpress && global.Parser.onLinkpress(attrs);
|
||||
this.top.$emit('linkpress', attrs);
|
||||
if (jump) {
|
||||
// #ifdef MP
|
||||
if (attrs['app-id']) {
|
||||
return uni.navigateToMiniProgram({
|
||||
appId: attrs['app-id'],
|
||||
path: attrs.path
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
if (attrs.href) {
|
||||
if (attrs.href[0] == '#') {
|
||||
if (this.top.useAnchor)
|
||||
this.top.navigateTo({
|
||||
id: attrs.href.substring(1)
|
||||
})
|
||||
} else if (attrs.href.indexOf('http') == 0 || attrs.href.indexOf('//') == 0) {
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openWeb(attrs.href);
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
uni.setClipboardData({
|
||||
data: attrs.href,
|
||||
success: () =>
|
||||
uni.showToast({
|
||||
title: '链接已复制'
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
} else
|
||||
uni.navigateTo({
|
||||
url: attrs.href
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
error(e) {
|
||||
var context, target = e.currentTarget,
|
||||
source = target.dataset.from;
|
||||
if (source == 'video' || source == 'audio') {
|
||||
// 加载其他 source
|
||||
var index = this.controls[target.id] ? this.controls[target.id].index + 1 : 1;
|
||||
if (index < target.dataset.source.length)
|
||||
this.$set(this.controls, target.id + '.index', index);
|
||||
if (source == 'video') context = uni.createVideoContext(target.id, this);
|
||||
}
|
||||
this.top && this.top.$emit('error', {
|
||||
source,
|
||||
target,
|
||||
errMsg: e.detail.errMsg,
|
||||
errCode: e.detail.errCode,
|
||||
context
|
||||
});
|
||||
},
|
||||
_loadVideo(e) {
|
||||
this.$set(this.controls, e.currentTarget.id, {
|
||||
play: true,
|
||||
index: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 在这里引入自定义样式 */
|
||||
|
||||
/* 链接和图片效果 */
|
||||
._a {
|
||||
display: inline;
|
||||
color: #366092;
|
||||
word-break: break-all;
|
||||
padding: 1.5px 0 1.5px 0;
|
||||
}
|
||||
|
||||
._hover {
|
||||
opacity: 0.7;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
._img {
|
||||
display: inline-block;
|
||||
text-indent: 0;
|
||||
}
|
||||
|
||||
/* #ifdef MP-WEIXIN */
|
||||
:host {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef MP */
|
||||
.interlayer {
|
||||
align-content: inherit;
|
||||
align-items: inherit;
|
||||
display: inherit;
|
||||
flex-direction: inherit;
|
||||
flex-wrap: inherit;
|
||||
justify-content: inherit;
|
||||
width: 100%;
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
._b,
|
||||
._strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
._blockquote,
|
||||
._div,
|
||||
._p,
|
||||
._ol,
|
||||
._ul,
|
||||
._li {
|
||||
display: block;
|
||||
}
|
||||
|
||||
._code {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
._del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
._em,
|
||||
._i {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
._h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
._h2 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
._h3 {
|
||||
font-size: 1.17em;
|
||||
}
|
||||
|
||||
._h5 {
|
||||
font-size: 0.83em;
|
||||
}
|
||||
|
||||
._h6 {
|
||||
font-size: 0.67em;
|
||||
}
|
||||
|
||||
._h1,
|
||||
._h2,
|
||||
._h3,
|
||||
._h4,
|
||||
._h5,
|
||||
._h6 {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
._ins {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
._li {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
._ol-bef {
|
||||
margin-right: 5px;
|
||||
text-align: right;
|
||||
width: 36px;
|
||||
}
|
||||
|
||||
._ul-bef {
|
||||
line-height: normal;
|
||||
margin: 0 12px 0 23px;
|
||||
}
|
||||
|
||||
._ol-bef,
|
||||
._ul_bef {
|
||||
flex: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
._ul-p1 {
|
||||
display: inline-block;
|
||||
height: 0.3em;
|
||||
line-height: 0.3em;
|
||||
overflow: hidden;
|
||||
width: 0.3em;
|
||||
}
|
||||
|
||||
._ul-p2 {
|
||||
border: 0.05em solid black;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
height: 0.23em;
|
||||
width: 0.23em;
|
||||
}
|
||||
|
||||
._q::before {
|
||||
content: '"';
|
||||
}
|
||||
|
||||
._q::after {
|
||||
content: '"';
|
||||
}
|
||||
|
||||
._sub {
|
||||
font-size: smaller;
|
||||
vertical-align: sub;
|
||||
}
|
||||
|
||||
._sup {
|
||||
font-size: smaller;
|
||||
vertical-align: super;
|
||||
}
|
||||
|
||||
/* #ifndef MP-WEIXIN */
|
||||
._abbr,
|
||||
._b,
|
||||
._code,
|
||||
._del,
|
||||
._em,
|
||||
._i,
|
||||
._ins,
|
||||
._label,
|
||||
._q,
|
||||
._span,
|
||||
._strong,
|
||||
._sub,
|
||||
._sup {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef MP-WEIXIN || MP-QQ || MP-ALIPAY */
|
||||
.__bdo,
|
||||
.__bdi,
|
||||
.__ruby,
|
||||
.__rt,
|
||||
._entity {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
._video {
|
||||
background-color: black;
|
||||
display: inline-block;
|
||||
height: 225px;
|
||||
position: relative;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
._video::after {
|
||||
border-color: transparent transparent transparent white;
|
||||
border-style: solid;
|
||||
border-width: 15px 0 15px 30px;
|
||||
content: '';
|
||||
left: 50%;
|
||||
margin: -15px 0 0 -15px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,406 @@
|
|||
.mpvue-calendar {
|
||||
margin:auto;
|
||||
width: 100%;
|
||||
min-width:350px;
|
||||
background: #fff;
|
||||
user-select:none;
|
||||
position: relative;
|
||||
}
|
||||
.calendar-tools{
|
||||
height:40px;
|
||||
font-size: 20px;
|
||||
line-height: 40px;
|
||||
color:#5e7a88;
|
||||
box-shadow: 0px 4px 8px rgba(25, 47, 89, 0.1);
|
||||
margin-bottom: 20px;
|
||||
border-top: 1px solid rgba(200, 200, 200, .1);
|
||||
}
|
||||
.calendar-tools span{
|
||||
cursor: pointer;
|
||||
}
|
||||
.calendar-prev{
|
||||
width: 14.28571429%;
|
||||
float:left;
|
||||
text-align: center;
|
||||
}
|
||||
.calendar-prev img, .calendar-next img{
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
.calendar-info{
|
||||
font-size:16px;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
width: 220px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.calendar-info>div.mc-month{
|
||||
margin:auto;
|
||||
height:24px;
|
||||
width:100px;
|
||||
text-align: center;
|
||||
color:#5e7a88;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.calendar-info>div.mc-month .mc-month-inner{
|
||||
position: absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
height:480px;
|
||||
}
|
||||
.month-transition{
|
||||
transition:top .5s cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
}
|
||||
.calendar-info .mc-month-text{
|
||||
display:block;
|
||||
font-size:28px;
|
||||
height:40px;
|
||||
width:200px;
|
||||
overflow:hidden;
|
||||
text-align:center;
|
||||
}
|
||||
.calendar-info>div.mc-month .mc-month-inner>span{
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
height:24px;
|
||||
line-height:24px;
|
||||
width:100px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
}
|
||||
.calendar-info>div.mc-year{
|
||||
font-size:10px;
|
||||
line-height: 1;
|
||||
color:#999;
|
||||
}
|
||||
.calendar-next{
|
||||
width: 14.28571429%;
|
||||
float:right;
|
||||
text-align: center;
|
||||
}
|
||||
.mpvue-calendar table {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
margin-bottom:10px;
|
||||
border-collapse: collapse;
|
||||
color: #444444;
|
||||
}
|
||||
.mpvue-calendar td {
|
||||
margin:2px !important;
|
||||
padding: 4px;
|
||||
width: 14.28571429%;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
font-size:14px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
}
|
||||
.mpvue-calendar td.mc-week{
|
||||
font-size:10px;
|
||||
pointer-events:none !important;
|
||||
cursor: default !important;
|
||||
}
|
||||
.mpvue-calendar td.disabled {
|
||||
color: #ccc;
|
||||
}
|
||||
.mpvue-calendar td.disabled div{
|
||||
color: #ccc;
|
||||
}
|
||||
.mpvue-calendar td span{
|
||||
display:block;
|
||||
height:100%;
|
||||
width:100%;
|
||||
margin:0px auto;
|
||||
border-radius:50%;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
.mpvue-calendar td:not(.disabled) span.mc-date-red{
|
||||
color:#ea6151;
|
||||
}
|
||||
.mc-today{
|
||||
color: #3b75fb;
|
||||
}
|
||||
.mpvue-calendar td.selected span{
|
||||
background-color: #3b75fb;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.mpvue-calendar td .mc-text{
|
||||
box-sizing: border-box;
|
||||
height: 0.7em;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
font-size: 0.7em;
|
||||
line-height: 0.7em;
|
||||
z-index: 4;
|
||||
}
|
||||
.mpvue-calendar td .isGregorianFestival,
|
||||
.mpvue-calendar td .isTerm,
|
||||
.mpvue-calendar td .isLunarFestival{
|
||||
color:#ea6151;
|
||||
}
|
||||
.mpvue-calendar td.selected span.mc-date-red{
|
||||
background-color: #3b75fb;
|
||||
color: #fff;
|
||||
}
|
||||
.selected .mc-text {
|
||||
color: #fff !important;
|
||||
}
|
||||
.mpvue-calendar .lunarStyle .mc-text{
|
||||
overflow: visible;
|
||||
bottom: 20%;
|
||||
}
|
||||
.mpvue-calendar thead td {
|
||||
text-transform: uppercase;
|
||||
height:30px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.mc-head {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.mc-head div {
|
||||
overflow: hidden;
|
||||
}
|
||||
.mc-head-box div {
|
||||
flex:1;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
}
|
||||
.mc-head-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-content: space-between
|
||||
}
|
||||
.mc-body {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.mc-body tr {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-content: space-between;
|
||||
}
|
||||
.mc-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: #ea6151;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
bottom: -4px;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
z-index: 5;
|
||||
}
|
||||
.remark-text {
|
||||
box-sizing: border-box;
|
||||
height: 0.7em;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
font-size: 0.7em;
|
||||
line-height: 0.7em;
|
||||
z-index: 5;
|
||||
}
|
||||
.slot-element{
|
||||
line-height: normal;
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
}
|
||||
.mpvue-calendar-change{
|
||||
position: absolute;
|
||||
left:0px;
|
||||
top:42px;
|
||||
right:0px;
|
||||
bottom:0px;
|
||||
background:#fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap:wrap;
|
||||
overflow: auto;
|
||||
transition:all .5s cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translateY(-10px);
|
||||
z-index: 9;
|
||||
}
|
||||
.mpvue-calendar-change.show{
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
transform: translateY(0px);
|
||||
}
|
||||
.mpvue-calendar-change span{
|
||||
margin:4px 2%;
|
||||
display: inline-block;
|
||||
line-height: 30px;
|
||||
border-radius: 20px;
|
||||
text-align:center;
|
||||
color:#999;
|
||||
width: 20%;
|
||||
float: left;
|
||||
text-align: center;
|
||||
border-radius: 40px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 4%;
|
||||
cursor: pointer;
|
||||
}
|
||||
.mpvue-calendar-change span.active{
|
||||
background-color: #587dff;
|
||||
box-shadow: 2px 2px 2px rgba(88, 125, 255, 0.7);
|
||||
color:#fff;
|
||||
}
|
||||
.mpvue-calendar-change .calendar-week-switch-months{
|
||||
height: 100%;
|
||||
}
|
||||
.mpvue-calendar-change .calendar-week-switch-months span {
|
||||
margin-bottom: 10px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
.calendar-years, .calendar-months{
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
.calendar-years:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 86%;
|
||||
height: 1px;
|
||||
background-color: #eee;
|
||||
position: absolute;
|
||||
bottom: 2%;
|
||||
left: 7%;
|
||||
}
|
||||
/*range background*/
|
||||
.mc-range-mode .selected .mc-range-bg{
|
||||
content: '';
|
||||
display: block;
|
||||
width: 150%;
|
||||
height: 100%;
|
||||
background-color: #01a1ed;
|
||||
position: relative;
|
||||
top: -100%;
|
||||
left: 50%;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .selected .calendar-date{
|
||||
background-color: transparent;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .mc-range-row-last .calendar-date, .mpvue-calendar .mc-range-mode .mc-range-row-first .calendar-date{
|
||||
border-radius: 4px;
|
||||
background-color: #01a1ed;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .mc-range-month-first.selected .calendar-date, .mpvue-calendar .mc-range-mode .mc-range-month-last.selected .calendar-date{
|
||||
background-color: #01a1ed;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.mc-range-mode .mc-range-month-last .mc-range-bg{
|
||||
background-color: transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.mc-range-mode .mc-range-end .mc-range-bg, .mc-range-mode .mc-range-row-last .mc-range-bg{
|
||||
display: none;
|
||||
}
|
||||
.mc-range-row-first.mc-range-end .mc-range-bg{
|
||||
display: block;
|
||||
margin-left: -50%;
|
||||
width: 50%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.mpvue-calendar .mc-range-row-first.mc-range-end.month-first-date .mc-range-bg{
|
||||
margin-left: 0px;
|
||||
}
|
||||
.mc-range-row-last.mc-range-begin .mc-range-bg{
|
||||
display: block;
|
||||
width: 50%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .selected.mc-range-second-to-last span{
|
||||
background-color: #01a1ed;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.mc-range-begin.mc-range-second-to-last{
|
||||
background-color: #01a1ed;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .mc-range-end span.calendar-date, .mpvue-calendar .mc-range-mode .mc-range-begin span.calendar-date{
|
||||
background-color: #3b75fb;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .month-last-date.mc-range-begin .mc-range-bg{
|
||||
display: block;
|
||||
width: 50%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .month-first-date.mc-range-end .mc-range-bg{
|
||||
display: block;
|
||||
width: 50%;
|
||||
border-radius: 4px;
|
||||
left: 0px;
|
||||
}
|
||||
.calendar-wrapper .mpvue-calendar .mc-range-mode .mc-range-select-one div.mc-range-bg{
|
||||
display: none;
|
||||
}
|
||||
.mc-range-mode .mc-range-second-to-last .mc-range-bg{
|
||||
border-radius: 0px 25% 25% 0px;
|
||||
}
|
||||
.mc-today-element .calendar-date{
|
||||
background-color: rgba(25, 47, 89, 0.1);
|
||||
border-radius: 4px;
|
||||
}
|
||||
/*week switch*/
|
||||
.mpvue-calendar .mc-range-mode.week-switch .month-last-date.mc-range-begin .mc-range-bg{
|
||||
width: 150%;
|
||||
border-radius: 0px 20% 20% 0px;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode.week-switch .mc-range-month-last .mc-range-bg{
|
||||
background-color: #01a1ed;
|
||||
border-radius: 0px 20% 20% 0px;
|
||||
}
|
||||
/*month range*/
|
||||
.mpvue-calendar .month-range-mode{
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
position: relative;
|
||||
}
|
||||
.mpvue-calendar .mc-month-range-mode-head{
|
||||
box-shadow: 0 4px 8px rgba(25,47,89,.1);
|
||||
padding: 8px 0px;
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
background-color: #fff;
|
||||
z-index: 9;
|
||||
}
|
||||
.month-range-mode .month-rang-head {
|
||||
text-align: left;
|
||||
margin: 10px 0px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
.month-range-mode .mc-last-month, .month-range-mode .mc-next-month{
|
||||
opacity: 0 !important;
|
||||
}
|
||||
.month-text-background{
|
||||
position: absolute;
|
||||
font-size: 140px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
line-height: 2.4;
|
||||
}
|
|
@ -0,0 +1,524 @@
|
|||
/**
|
||||
* @1900-2100区间内的公历、农历互转
|
||||
* @charset UTF-8
|
||||
* @Author Jea杨(JJonline@JJonline.Cn)
|
||||
* @Time 2014-7-21
|
||||
* @Time 2016-8-13 Fixed 2033hex、Attribution Annals
|
||||
* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
|
||||
* @Version 1.0.2
|
||||
* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
|
||||
* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
|
||||
*/
|
||||
var calendar = {
|
||||
|
||||
/**
|
||||
* 农历1900-2100的润大小信息表
|
||||
* @Array Of Property
|
||||
* @return Hex
|
||||
*/
|
||||
lunarInfo:[0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,//1900-1909
|
||||
0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,//1910-1919
|
||||
0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,//1920-1929
|
||||
0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,//1930-1939
|
||||
0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,//1940-1949
|
||||
0x06ca0,0x0b550,0x15355,0x04da0,0x0a5b0,0x14573,0x052b0,0x0a9a8,0x0e950,0x06aa0,//1950-1959
|
||||
0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,//1960-1969
|
||||
0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b6a0,0x195a6,//1970-1979
|
||||
0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,//1980-1989
|
||||
0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,//1990-1999
|
||||
0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,//2000-2009
|
||||
0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,//2010-2019
|
||||
0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,//2020-2029
|
||||
0x05aa0,0x076a3,0x096d0,0x04afb,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,//2030-2039
|
||||
0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0,//2040-2049
|
||||
/**Add By JJonline@JJonline.Cn**/
|
||||
0x14b63,0x09370,0x049f8,0x04970,0x064b0,0x168a6,0x0ea50, 0x06b20,0x1a6c4,0x0aae0,//2050-2059
|
||||
0x0a2e0,0x0d2e3,0x0c960,0x0d557,0x0d4a0,0x0da50,0x05d55,0x056a0,0x0a6d0,0x055d4,//2060-2069
|
||||
0x052d0,0x0a9b8,0x0a950,0x0b4a0,0x0b6a6,0x0ad50,0x055a0,0x0aba4,0x0a5b0,0x052b0,//2070-2079
|
||||
0x0b273,0x06930,0x07337,0x06aa0,0x0ad50,0x14b55,0x04b60,0x0a570,0x054e4,0x0d160,//2080-2089
|
||||
0x0e968,0x0d520,0x0daa0,0x16aa6,0x056d0,0x04ae0,0x0a9d4,0x0a2d0,0x0d150,0x0f252,//2090-2099
|
||||
0x0d520],//2100
|
||||
|
||||
/**
|
||||
* 公历每个月份的天数普通表
|
||||
* @Array Of Property
|
||||
* @return Number
|
||||
*/
|
||||
solarMonth:[31,28,31,30,31,30,31,31,30,31,30,31],
|
||||
|
||||
/**
|
||||
* 天干地支之天干速查表
|
||||
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Gan:["\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"],
|
||||
|
||||
/**
|
||||
* 天干地支之地支速查表
|
||||
* @Array Of Property
|
||||
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Zhi:["\u5b50","\u4e11","\u5bc5","\u536f","\u8fb0","\u5df3","\u5348","\u672a","\u7533","\u9149","\u620c","\u4ea5"],
|
||||
|
||||
/**
|
||||
* 天干地支之地支速查表<=>生肖
|
||||
* @Array Of Property
|
||||
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Animals:["\u9f20","\u725b","\u864e","\u5154","\u9f99","\u86c7","\u9a6c","\u7f8a","\u7334","\u9e21","\u72d7","\u732a"],
|
||||
|
||||
/**
|
||||
* 24节气速查表
|
||||
* @Array Of Property
|
||||
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
|
||||
* @return Cn string
|
||||
*/
|
||||
solarTerm:["\u5c0f\u5bd2","\u5927\u5bd2","\u7acb\u6625","\u96e8\u6c34","\u60ca\u86f0","\u6625\u5206","\u6e05\u660e","\u8c37\u96e8","\u7acb\u590f","\u5c0f\u6ee1","\u8292\u79cd","\u590f\u81f3","\u5c0f\u6691","\u5927\u6691","\u7acb\u79cb","\u5904\u6691","\u767d\u9732","\u79cb\u5206","\u5bd2\u9732","\u971c\u964d","\u7acb\u51ac","\u5c0f\u96ea","\u5927\u96ea","\u51ac\u81f3"],
|
||||
|
||||
/**
|
||||
* 1900-2100各年的24节气日期速查表
|
||||
* @Array Of Property
|
||||
* @return 0x string For splice
|
||||
*/
|
||||
sTermInfo:['9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f',
|
||||
'97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f',
|
||||
'b027097bd097c36b0b6fc9274c91aa','9778397bd19801ec9210c965cc920e','97b6b97bd19801ec95f8c965cc920f',
|
||||
'97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2','9778397bd197c36c9210c9274c91aa',
|
||||
'97b6b97bd19801ec95f8c965cc920e','97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2',
|
||||
'9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec95f8c965cc920e','97bcf97c3598082c95f8e1cfcc920f',
|
||||
'97bd097bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722',
|
||||
'9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f',
|
||||
'97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf97c359801ec95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f','97bd097bd07f595b0b6fc920fb0722',
|
||||
'9778397bd097c36b0b6fc9210c8dc2','9778397bd19801ec9210c9274c920e','97b6b97bd19801ec95f8c965cc920f',
|
||||
'97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e',
|
||||
'97b6b97bd19801ec95f8c965cc920f','97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2',
|
||||
'9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e','97bd07f1487f595b0b0bc920fb0722',
|
||||
'7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c965cc920e','97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
|
||||
'9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf7f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf7f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
|
||||
'9778397bd097c36b0b6fc9210c91aa','97b6b97bd197c36c9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722',
|
||||
'7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e',
|
||||
'97b6b7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2',
|
||||
'9778397bd097c36b0b70c9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722',
|
||||
'7f0e397bd097c35b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e27f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
|
||||
'9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b7f0e47f531b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
|
||||
'9778397bd097c36b0b6fc9210c91aa','97b6b7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
|
||||
'7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','977837f0e37f149b0723b0787b0721',
|
||||
'7f07e7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c35b0b6fc9210c8dc2',
|
||||
'977837f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722',
|
||||
'7f0e397bd097c35b0b6fc9210c8dc2','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','977837f0e37f14998082b0787b06bd',
|
||||
'7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
|
||||
'977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd',
|
||||
'7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
|
||||
'977837f0e37f14998082b0723b06bd','7f07e7f0e37f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
|
||||
'7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b0721',
|
||||
'7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f595b0b0bb0b6fb0722','7f0e37f0e37f14898082b0723b02d5',
|
||||
'7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e37f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e37f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd',
|
||||
'7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35',
|
||||
'7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f149b0723b0787b0721',
|
||||
'7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0723b06bd',
|
||||
'7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722','7f0e37f0e366aa89801eb072297c35',
|
||||
'7ec967f0e37f14998082b0723b06bd','7f07e7f0e37f14998083b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
|
||||
'7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14898082b0723b02d5','7f07e7f0e37f14998082b0787b0721',
|
||||
'7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66aa89801e9808297c35','665f67f0e37f14898082b0723b02d5',
|
||||
'7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66a449801e9808297c35',
|
||||
'665f67f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e36665b66a449801e9808297c35','665f67f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd',
|
||||
'7f07e7f0e47f531b0723b0b6fb0721','7f0e26665b66a449801e9808297c35','665f67f0e37f1489801eb072297c35',
|
||||
'7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722'],
|
||||
|
||||
/**
|
||||
* 数字转中文速查表
|
||||
* @Array Of Property
|
||||
* @trans ['日','一','二','三','四','五','六','七','八','九','十']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr1:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341"],
|
||||
|
||||
/**
|
||||
* 日期转农历称呼速查表
|
||||
* @Array Of Property
|
||||
* @trans ['初','十','廿','卅']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr2:["\u521d","\u5341","\u5eff","\u5345"],
|
||||
|
||||
/**
|
||||
* 月份转农历称呼速查表
|
||||
* @Array Of Property
|
||||
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr3:["\u6b63","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u51ac","\u814a"],
|
||||
|
||||
/**
|
||||
* 返回农历y年一整年的总天数
|
||||
* @param lunar Year
|
||||
* @return Number
|
||||
* @eg:var count = calendar.lYearDays(1987) ;//count=387
|
||||
*/
|
||||
lYearDays:function(y) {
|
||||
var i, sum = 348;
|
||||
for(i=0x8000; i>0x8; i>>=1) { sum += (calendar.lunarInfo[y-1900] & i)? 1: 0; }
|
||||
return(sum+calendar.leapDays(y));
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
|
||||
* @param lunar Year
|
||||
* @return Number (0-12)
|
||||
* @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
|
||||
*/
|
||||
leapMonth:function(y) { //闰字编码 \u95f0
|
||||
return(calendar.lunarInfo[y-1900] & 0xf);
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回农历y年闰月的天数 若该年没有闰月则返回0
|
||||
* @param lunar Year
|
||||
* @return Number (0、29、30)
|
||||
* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
|
||||
*/
|
||||
leapDays:function(y) {
|
||||
if(calendar.leapMonth(y)) {
|
||||
return((calendar.lunarInfo[y-1900] & 0x10000)? 30: 29);
|
||||
}
|
||||
return(0);
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
|
||||
* @param lunar Year
|
||||
* @return Number (-1、29、30)
|
||||
* @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
|
||||
*/
|
||||
monthDays:function(y,m) {
|
||||
if(m>12 || m<1) {return -1}//月份参数从1至12,参数错误返回-1
|
||||
return( (calendar.lunarInfo[y-1900] & (0x10000>>m))? 30: 29 );
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回公历(!)y年m月的天数
|
||||
* @param solar Year
|
||||
* @return Number (-1、28、29、30、31)
|
||||
* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
|
||||
*/
|
||||
solarDays:function(y,m) {
|
||||
if(m>12 || m<1) {return -1} //若参数错误 返回-1
|
||||
var ms = m-1;
|
||||
if(ms==1) { //2月份的闰平规律测算后确认返回28或29
|
||||
return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28);
|
||||
}else {
|
||||
return(calendar.solarMonth[ms]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 农历年份转换为干支纪年
|
||||
* @param lYear 农历年的年份数
|
||||
* @return Cn string
|
||||
*/
|
||||
toGanZhiYear:function(lYear) {
|
||||
var ganKey = (lYear - 3) % 10;
|
||||
var zhiKey = (lYear - 3) % 12;
|
||||
if(ganKey == 0) ganKey = 10;//如果余数为0则为最后一个天干
|
||||
if(zhiKey == 0) zhiKey = 12;//如果余数为0则为最后一个地支
|
||||
return calendar.Gan[ganKey-1] + calendar.Zhi[zhiKey-1];
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 公历月、日判断所属星座
|
||||
* @param cMonth [description]
|
||||
* @param cDay [description]
|
||||
* @return Cn string
|
||||
*/
|
||||
toAstro:function(cMonth,cDay) {
|
||||
var s = "\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf";
|
||||
var arr = [20,19,21,21,21,22,23,23,23,23,22,22];
|
||||
return s.substr(cMonth*2 - (cDay < arr[cMonth-1] ? 2 : 0),2) + "\u5ea7";//座
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入offset偏移量返回干支
|
||||
* @param offset 相对甲子的偏移量
|
||||
* @return Cn string
|
||||
*/
|
||||
toGanZhi:function(offset) {
|
||||
return calendar.Gan[offset%10] + calendar.Zhi[offset%12];
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入公历(!)y年获得该年第n个节气的公历日期
|
||||
* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
|
||||
* @return day Number
|
||||
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
|
||||
*/
|
||||
getTerm:function(y,n) {
|
||||
if(y<1900 || y>2100) {return -1;}
|
||||
if(n<1 || n>24) {return -1;}
|
||||
var _table = calendar.sTermInfo[y-1900];
|
||||
var _info = [
|
||||
parseInt('0x'+_table.substr(0,5)).toString() ,
|
||||
parseInt('0x'+_table.substr(5,5)).toString(),
|
||||
parseInt('0x'+_table.substr(10,5)).toString(),
|
||||
parseInt('0x'+_table.substr(15,5)).toString(),
|
||||
parseInt('0x'+_table.substr(20,5)).toString(),
|
||||
parseInt('0x'+_table.substr(25,5)).toString()
|
||||
];
|
||||
var _calday = [
|
||||
_info[0].substr(0,1),
|
||||
_info[0].substr(1,2),
|
||||
_info[0].substr(3,1),
|
||||
_info[0].substr(4,2),
|
||||
|
||||
_info[1].substr(0,1),
|
||||
_info[1].substr(1,2),
|
||||
_info[1].substr(3,1),
|
||||
_info[1].substr(4,2),
|
||||
|
||||
_info[2].substr(0,1),
|
||||
_info[2].substr(1,2),
|
||||
_info[2].substr(3,1),
|
||||
_info[2].substr(4,2),
|
||||
|
||||
_info[3].substr(0,1),
|
||||
_info[3].substr(1,2),
|
||||
_info[3].substr(3,1),
|
||||
_info[3].substr(4,2),
|
||||
|
||||
_info[4].substr(0,1),
|
||||
_info[4].substr(1,2),
|
||||
_info[4].substr(3,1),
|
||||
_info[4].substr(4,2),
|
||||
|
||||
_info[5].substr(0,1),
|
||||
_info[5].substr(1,2),
|
||||
_info[5].substr(3,1),
|
||||
_info[5].substr(4,2),
|
||||
];
|
||||
return parseInt(_calday[n-1]);
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入农历数字月份返回汉语通俗表示法
|
||||
* @param lunar month
|
||||
* @return Cn string
|
||||
* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
|
||||
*/
|
||||
toChinaMonth:function(m) { // 月 => \u6708
|
||||
if(m>12 || m<1) {return -1} //若参数错误 返回-1
|
||||
var s = calendar.nStr3[m-1];
|
||||
s+= "\u6708";//加上月字
|
||||
return s;
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入农历日期数字返回汉字表示法
|
||||
* @param lunar day
|
||||
* @return Cn string
|
||||
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
|
||||
*/
|
||||
toChinaDay:function(d){ //日 => \u65e5
|
||||
var s;
|
||||
switch (d) {
|
||||
case 10:
|
||||
s = '\u521d\u5341'; break;
|
||||
case 20:
|
||||
s = '\u4e8c\u5341'; break;
|
||||
break;
|
||||
case 30:
|
||||
s = '\u4e09\u5341'; break;
|
||||
break;
|
||||
default :
|
||||
s = calendar.nStr2[Math.floor(d/10)];
|
||||
s += calendar.nStr1[d%10];
|
||||
}
|
||||
return(s);
|
||||
},
|
||||
|
||||
/**
|
||||
* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
|
||||
* @param y year
|
||||
* @return Cn string
|
||||
* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
|
||||
*/
|
||||
getAnimal: function(y) {
|
||||
return calendar.Animals[(y - 4) % 12]
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
|
||||
* @param y solar year
|
||||
* @param m solar month
|
||||
* @param d solar day
|
||||
* @return JSON object
|
||||
* @eg:console.log(calendar.solar2lunar(1987,11,01));
|
||||
*/
|
||||
solar2lunar:function (y,m,d) { //参数区间1900.1.31~2100.12.31
|
||||
if(y<1900 || y>2100) {return -1;}//年份限定、上限
|
||||
if(y==1900&&m==1&&d<31) {return -1;}//下限
|
||||
if(!y) { //未传参 获得当天
|
||||
var objDate = new Date();
|
||||
}else {
|
||||
var objDate = new Date(y,parseInt(m)-1,d)
|
||||
}
|
||||
var i, leap=0, temp=0;
|
||||
//修正ymd参数
|
||||
var y = objDate.getFullYear(),m = objDate.getMonth()+1,d = objDate.getDate();
|
||||
var offset = (Date.UTC(objDate.getFullYear(),objDate.getMonth(),objDate.getDate()) - Date.UTC(1900,0,31))/86400000;
|
||||
for(i=1900; i<2101 && offset>0; i++) { temp=calendar.lYearDays(i); offset-=temp; }
|
||||
if(offset<0) { offset+=temp; i--; }
|
||||
|
||||
//是否今天
|
||||
var isTodayObj = new Date(),isToday=false;
|
||||
if(isTodayObj.getFullYear()==y && isTodayObj.getMonth()+1==m && isTodayObj.getDate()==d) {
|
||||
isToday = true;
|
||||
}
|
||||
//星期几
|
||||
var nWeek = objDate.getDay(),cWeek = calendar.nStr1[nWeek];
|
||||
if(nWeek==0) {nWeek =7;}//数字表示周几顺应天朝周一开始的惯例
|
||||
//农历年
|
||||
var year = i;
|
||||
|
||||
var leap = calendar.leapMonth(i); //闰哪个月
|
||||
var isLeap = false;
|
||||
|
||||
//效验闰月
|
||||
for(i=1; i<13 && offset>0; i++) {
|
||||
//闰月
|
||||
if(leap>0 && i==(leap+1) && isLeap==false){
|
||||
--i;
|
||||
isLeap = true; temp = calendar.leapDays(year); //计算农历闰月天数
|
||||
}
|
||||
else{
|
||||
temp = calendar.monthDays(year, i);//计算农历普通月天数
|
||||
}
|
||||
//解除闰月
|
||||
if(isLeap==true && i==(leap+1)) { isLeap = false; }
|
||||
offset -= temp;
|
||||
}
|
||||
|
||||
if(offset==0 && leap>0 && i==leap+1)
|
||||
if(isLeap){
|
||||
isLeap = false;
|
||||
}else{
|
||||
isLeap = true; --i;
|
||||
}
|
||||
if(offset<0){ offset += temp; --i; }
|
||||
//农历月
|
||||
var month = i;
|
||||
//农历日
|
||||
var day = offset + 1;
|
||||
|
||||
//天干地支处理
|
||||
var sm = m-1;
|
||||
var gzY = calendar.toGanZhiYear(year);
|
||||
|
||||
//月柱 1900年1月小寒以前为 丙子月(60进制12)
|
||||
var firstNode = calendar.getTerm(year,(m*2-1));//返回当月「节」为几日开始
|
||||
var secondNode = calendar.getTerm(year,(m*2));//返回当月「节」为几日开始
|
||||
|
||||
//依据12节气修正干支月
|
||||
var gzM = calendar.toGanZhi((y-1900)*12+m+11);
|
||||
if(d>=firstNode) {
|
||||
gzM = calendar.toGanZhi((y-1900)*12+m+12);
|
||||
}
|
||||
|
||||
//传入的日期的节气与否
|
||||
var isTerm = false;
|
||||
var Term = null;
|
||||
if(firstNode==d) {
|
||||
isTerm = true;
|
||||
Term = calendar.solarTerm[m*2-2];
|
||||
}
|
||||
if(secondNode==d) {
|
||||
isTerm = true;
|
||||
Term = calendar.solarTerm[m*2-1];
|
||||
}
|
||||
//日柱 当月一日与 1900/1/1 相差天数
|
||||
var dayCyclical = Date.UTC(y,sm,1,0,0,0,0)/86400000+25567+10;
|
||||
var gzD = calendar.toGanZhi(dayCyclical+d-1);
|
||||
//该日期所属的星座
|
||||
var astro = calendar.toAstro(m,d);
|
||||
|
||||
return {'lYear':year,'lMonth':month,'lDay':day,'Animal':calendar.getAnimal(year),'IMonthCn':(isLeap?"\u95f0":'')+calendar.toChinaMonth(month),'IDayCn':calendar.toChinaDay(day),'cYear':y,'cMonth':m,'cDay':d,'gzYear':gzY,'gzMonth':gzM,'gzDay':gzD,'isToday':isToday,'isLeap':isLeap,'nWeek':nWeek,'ncWeek':"\u661f\u671f"+cWeek,'isTerm':isTerm,'Term':Term,'astro':astro};
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
|
||||
* @param y lunar year
|
||||
* @param m lunar month
|
||||
* @param d lunar day
|
||||
* @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
|
||||
* @return JSON object
|
||||
* @eg:console.log(calendar.lunar2solar(1987,9,10));
|
||||
*/
|
||||
lunar2solar:function(y,m,d,isLeapMonth) { //参数区间1900.1.31~2100.12.1
|
||||
var isLeapMonth = !!isLeapMonth;
|
||||
var leapOffset = 0;
|
||||
var leapMonth = calendar.leapMonth(y);
|
||||
var leapDay = calendar.leapDays(y);
|
||||
if(isLeapMonth&&(leapMonth!=m)) {return -1;}//传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
|
||||
if(y==2100&&m==12&&d>1 || y==1900&&m==1&&d<31) {return -1;}//超出了最大极限值
|
||||
var day = calendar.monthDays(y,m);
|
||||
var _day = day;
|
||||
//bugFix 2016-9-25
|
||||
//if month is leap, _day use leapDays method
|
||||
if(isLeapMonth) {
|
||||
_day = calendar.leapDays(y,m);
|
||||
}
|
||||
if(y < 1900 || y > 2100 || d > _day) {return -1;}//参数合法性效验
|
||||
|
||||
//计算农历的时间差
|
||||
var offset = 0;
|
||||
for(var i=1900;i<y;i++) {
|
||||
offset+=calendar.lYearDays(i);
|
||||
}
|
||||
var leap = 0,isAdd= false;
|
||||
for(var i=1;i<m;i++) {
|
||||
leap = calendar.leapMonth(y);
|
||||
if(!isAdd) {//处理闰月
|
||||
if(leap<=i && leap>0) {
|
||||
offset+=calendar.leapDays(y);isAdd = true;
|
||||
}
|
||||
}
|
||||
offset+=calendar.monthDays(y,i);
|
||||
}
|
||||
//转换闰月农历 需补充该年闰月的前一个月的时差
|
||||
if(isLeapMonth) {offset+=day;}
|
||||
//1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
|
||||
var stmap = Date.UTC(1900,1,30,0,0,0);
|
||||
var calObj = new Date((offset+d-31)*86400000+stmap);
|
||||
var cY = calObj.getUTCFullYear();
|
||||
var cM = calObj.getUTCMonth()+1;
|
||||
var cD = calObj.getUTCDate();
|
||||
|
||||
return calendar.solar2lunar(cY,cM,cD);
|
||||
}
|
||||
};
|
||||
|
||||
export default calendar
|
|
@ -0,0 +1,15 @@
|
|||
@font-face {font-family: "iconfont";
|
||||
src: url('data:font/truetype;charset=utf-8;base64,d09GRgABAAAAAASEAAsAAAAABuwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFY7d0f0Y21hcAAAAYAAAABTAAABhmJUzs9nbHlmAAAB1AAAALcAAADIzC0F5mhlYWQAAAKMAAAALwAAADYS7IZUaGhlYQAAArwAAAAcAAAAJAfeA4RobXR4AAAC2AAAAAwAAAAMDAAAAGxvY2EAAALkAAAACAAAAAgANgBkbWF4cAAAAuwAAAAfAAAAIAEOACluYW1lAAADDAAAAUUAAAJtPlT+fXBvc3QAAARUAAAALQAAAEOUPjuMeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2BkYWCcwMDKwMHUyXSGgYGhH0IzvmYwYuRgYGBiYGVmwAoC0lxTGByeMj5jYm7438AQw9zA0AAUZgTJAQDdSgvleJztkMERgDAIBPdIzMOxEB8W5MvuTRsRMHbhzSwHR/IBWIDiHE4FXYjQ6akyL6yZ13zT3IXd6jYGfO6S75q7xT81fm1Z9zlZXOsl+j5BD35IDU4AeJwVzUEOwUAYBeD/mfxTEso/mkEJoYluqgtajUjYsHEOSytncROJK/QErjNMd+8lL+8jEP3eqq8uNCPiokK1L4t1ihzVCSPMEekAep3mQCh4tpVm95JWz2QGj3iyiN3LZMJBODU49IMuDxk32YifuI89X4+xqwcsHUtEjfVVWt1p5MvWNs9RY4RowNLrJ7Tq8ZKNN7wmvMp8jBc7PDpW3RPfPrISV5ss4QEO9pxcdrix/gMMIyHOAHicY2BkYGAAYmNBZtV4fpuvDNwsDCBw/dlCBQT9fzMLA3MKkMvBwAQSBQDyNAlAAHicY2BkYGBu+N/AEMPCAAJAkpEBFTADAEcJAmwEAAAABAAAAAQAAAAAAAAAADYAZHicY2BkYGBgZpBlANEMDExAzAWEDAz/wXwGAAuHATgAeJxlj01OwzAQhV/6B6QSqqhgh+QFYgEo/RGrblhUavdddN+mTpsqiSPHrdQDcB6OwAk4AtyAO/BIJ5s2lsffvHljTwDc4Acejt8t95E9XDI7cg0XuBeuU38QbpBfhJto41W4Rf1N2MczpsJtdGF5g9e4YvaEd2EPHXwI13CNT+E69S/hBvlbuIk7/Aq30PHqwj7mXle4jUcv9sdWL5xeqeVBxaHJIpM5v4KZXu+Sha3S6pxrW8QmU4OgX0lTnWlb3VPs10PnIhVZk6oJqzpJjMqt2erQBRvn8lGvF4kehCblWGP+tsYCjnEFhSUOjDFCGGSIyujoO1Vm9K+xQ8Jee1Y9zed0WxTU/3OFAQL0z1xTurLSeTpPgT1fG1J1dCtuy56UNJFezUkSskJe1rZUQuoBNmVXjhF6XNGJPyhnSP8ACVpuyAAAAHicY2BigAAuBuyAmZGJkZmRhYEnKzMxryS/tDgjMS+dC8qpzC9lYAAAiPIJlAAAAA==');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family:"iconfont" !important;
|
||||
font-size:16px;
|
||||
font-style:normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-arrow-right:before { content: "\e602"; }
|
||||
|
||||
.icon-arrow-left:before { content: "\e501"; }
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,394 @@
|
|||
.mpvue-calendar {
|
||||
margin:auto;
|
||||
width: 100%;
|
||||
min-width:300rpx;
|
||||
background: #fff;
|
||||
user-select:none;
|
||||
position: relative;
|
||||
}
|
||||
.calendar-tools{
|
||||
height:40px;
|
||||
font-size: 20px;
|
||||
line-height: 40px;
|
||||
color:#5e7a88;
|
||||
box-shadow: 0rpx 4rpx 8rpx rgba(25, 47, 89, 0.1);
|
||||
margin-bottom: 30rpx;
|
||||
border-top: 1px solid rgba(200, 200, 200, .1);
|
||||
}
|
||||
.calendar-prev{
|
||||
width: 14.28571429%;
|
||||
float:left;
|
||||
text-align: center;
|
||||
}
|
||||
.calendar-prev img, .calendar-next img{
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
}
|
||||
.calendar-info{
|
||||
padding-top: 3px;
|
||||
font-size:16px;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
width: 220rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.calendar-info>div.mc-month{
|
||||
margin:auto;
|
||||
height:40rpx;
|
||||
width:100px;
|
||||
text-align: center;
|
||||
color:#5e7a88;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.calendar-info>div.mc-month .mc-month-inner{
|
||||
position: absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
height:480rpx;
|
||||
}
|
||||
.month-transition{
|
||||
transition:top .5s cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
}
|
||||
.calendar-info .mc-month-text{
|
||||
display:block;
|
||||
font-size:28rpx;
|
||||
height:40rpx;
|
||||
width:200rpx;
|
||||
overflow:hidden;
|
||||
text-align:center;
|
||||
}
|
||||
.calendar-info>div.mc-month .mc-month-inner>span{
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
height:20px;
|
||||
width:100px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
}
|
||||
.calendar-info>div.mc-year{
|
||||
font-size:10px;
|
||||
line-height: 1;
|
||||
color:#999;
|
||||
}
|
||||
.calendar-next{
|
||||
width: 14.28571429%;
|
||||
float:right;
|
||||
text-align: center;
|
||||
}
|
||||
.mpvue-calendar table {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
margin-bottom:10px;
|
||||
border-collapse: collapse;
|
||||
color: #444444;
|
||||
}
|
||||
.mpvue-calendar td {
|
||||
margin:2px !important;
|
||||
padding:0px 0;
|
||||
width: 14.28571429%;
|
||||
height:88rpx;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
font-size:14px;
|
||||
line-height: 125%;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
vertical-align: top;
|
||||
}
|
||||
.mpvue-calendar td.mc-week{
|
||||
font-size:10px;
|
||||
pointer-events:none !important;
|
||||
cursor: default !important;
|
||||
}
|
||||
.mpvue-calendar td.disabled {
|
||||
color: #ccc;
|
||||
}
|
||||
.mpvue-calendar td.disabled div{
|
||||
color: #ccc;
|
||||
}
|
||||
.mpvue-calendar td span{
|
||||
display:block;
|
||||
height:76rpx;
|
||||
width:76rpx;
|
||||
font-size: 28rpx;
|
||||
line-height:76rpx;
|
||||
margin:0px auto;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
.mpvue-calendar td:not(.disabled) span.mc-date-red{
|
||||
color:#ea6151;
|
||||
}
|
||||
.mc-today{
|
||||
color: #3b75fb;
|
||||
}
|
||||
.mpvue-calendar td.selected span{
|
||||
background-color: #3b75fb;
|
||||
color: #fff;
|
||||
border-radius:50%;
|
||||
}
|
||||
.mpvue-calendar td .mc-text{
|
||||
position: absolute;
|
||||
top:28px;
|
||||
left:0;
|
||||
right:0;
|
||||
text-align: center;
|
||||
padding:2px;
|
||||
font-size:20rpx;
|
||||
line-height: 1.2;
|
||||
color:#444;
|
||||
z-index: 4;
|
||||
}
|
||||
.mpvue-calendar td .isGregorianFestival,
|
||||
.mpvue-calendar td .isTerm,
|
||||
.mpvue-calendar td .isLunarFestival{
|
||||
color:#ea6151;
|
||||
}
|
||||
.mpvue-calendar td.selected span.mc-date-red{
|
||||
background-color: #3b75fb;
|
||||
color: #fff;
|
||||
}
|
||||
.selected .mc-text {
|
||||
color: #fff !important;
|
||||
}
|
||||
.mpvue-calendar .lunarStyle span{
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
line-height:54rpx;
|
||||
}
|
||||
.mpvue-calendar .lunarStyle .mc-text{
|
||||
top: 44rpx;
|
||||
}
|
||||
.mpvue-calendar thead td {
|
||||
text-transform: uppercase;
|
||||
height:30px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.mc-head {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.mc-head div {
|
||||
overflow: hidden;
|
||||
}
|
||||
.mc-head-box div {
|
||||
flex:1;
|
||||
text-align: center;
|
||||
}
|
||||
.mc-head-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-content: space-between
|
||||
}
|
||||
.mc-head-box div {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.mc-body tr {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-content: space-between
|
||||
}
|
||||
.mc-dot {
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
background-color: #ea6151;
|
||||
border-radius: 50%;
|
||||
margin: 0 auto;
|
||||
margin-top: 5rpx;
|
||||
position: absolute;
|
||||
bottom: -5rpx;
|
||||
left: 50%;
|
||||
margin-left: -5rpx;
|
||||
z-index: 5;
|
||||
}
|
||||
.remark-text {
|
||||
padding-left: 8rpx;
|
||||
padding-right: 8rpx;
|
||||
box-sizing: border-box;
|
||||
height: 34rpx;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.slot-element{
|
||||
line-height: normal;
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
}
|
||||
.mpvue-calendar-change{
|
||||
position: absolute;
|
||||
left:0rpx;
|
||||
top:85rpx;
|
||||
right:0rpx;
|
||||
bottom:0rpx;
|
||||
background:#fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap:wrap;
|
||||
overflow: auto;
|
||||
transition:all .5s cubic-bezier(0.075, 0.82, 0.165, 1);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translateY(-10px);
|
||||
z-index: 9;
|
||||
}
|
||||
.mpvue-calendar-change.show{
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
transform: translateY(0px);
|
||||
}
|
||||
.mpvue-calendar-change span{
|
||||
margin:4px 2%;
|
||||
display: inline-block;
|
||||
line-height: 30px;
|
||||
border-radius: 20px;
|
||||
text-align:center;
|
||||
color:#999;
|
||||
width: 20%;
|
||||
float: left;
|
||||
text-align: center;
|
||||
border-radius: 40px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 4%;
|
||||
}
|
||||
.mpvue-calendar-change span.active{
|
||||
background-color: #587dff;
|
||||
box-shadow: 2px 2px 2px rgba(88, 125, 255, 0.7);
|
||||
color:#fff;
|
||||
}
|
||||
.mpvue-calendar-change .calendar-week-switch-months{
|
||||
height: 100%;
|
||||
padding: 10rpx 20rpx;
|
||||
}
|
||||
.mpvue-calendar-change .calendar-week-switch-months span {
|
||||
margin-bottom: 20rpx;
|
||||
margin-top: 0px;
|
||||
font-size: 26rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.calendar-years, .calendar-months{
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
.calendar-years:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 86%;
|
||||
height: 1rpx;
|
||||
background-color: #eee;
|
||||
position: absolute;
|
||||
bottom: 2%;
|
||||
left: 7%;
|
||||
}
|
||||
/*range background*/
|
||||
.mc-range-mode .selected .mc-range-bg{
|
||||
content: '';
|
||||
display: block;
|
||||
width: 110rpx;
|
||||
height: 80rpx;
|
||||
background-color: #01a1ed;
|
||||
position: absolute;
|
||||
top: 0rpx;
|
||||
left: 50%;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .selected .calendar-date{
|
||||
background-color: transparent;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .mc-range-row-last span.calendar-date, .mpvue-calendar .mc-range-mode .mc-range-row-first span.calendar-date{
|
||||
border-radius: 6rpx;
|
||||
background-color: #01a1ed;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .mc-range-month-first.selected .calendar-date, .mpvue-calendar .mc-range-mode .mc-range-month-last.selected .calendar-date{
|
||||
border-radius: 6rpx;
|
||||
background-color: #01a1ed;
|
||||
}
|
||||
.mc-range-mode .mc-range-month-last .mc-range-bg{
|
||||
background-color: transparent;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.mc-range-mode .mc-range-end .mc-range-bg, .mc-range-mode .mc-range-row-last .mc-range-bg{
|
||||
display: none;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .mc-range-end span.calendar-date, .mpvue-calendar .mc-range-mode .mc-range-begin span.calendar-date{
|
||||
background-color: #3b75fb;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.mc-range-mode .mc-range-row-first.mc-range-end .mc-range-bg{
|
||||
display: block;
|
||||
border-radius: 6rpx;
|
||||
width: 40rpx;
|
||||
left: 5px;
|
||||
}
|
||||
.mpvue-calendar .mc-range-row-first.mc-range-end.month-first-date .mc-range-bg{
|
||||
margin-left: 0px;
|
||||
}
|
||||
.mc-range-mode .mc-range-row-last.mc-range-begin .mc-range-bg{
|
||||
display: block;
|
||||
border-radius: 4rpx;
|
||||
width: 40rpx;
|
||||
right: 10px;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .month-last-date.mc-range-begin .mc-range-bg{
|
||||
display: block;
|
||||
width: 40rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .month-first-date.mc-range-end .mc-range-bg{
|
||||
display: block;
|
||||
width: 40rpx;
|
||||
border-radius: 6rpx;
|
||||
left: 10rpx;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode .mc-range-select-one div.mc-range-bg{
|
||||
display: none !important;
|
||||
}
|
||||
.mc-body .mc-today-element .calendar-date{
|
||||
background-color: rgba(25, 47, 89, 0.1);
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
/*week switch*/
|
||||
.mpvue-calendar .mc-range-mode.week-switch .month-last-date.mc-range-begin .mc-range-bg{
|
||||
width: 130%;
|
||||
border-radius: 0px 20% 20% 0px;
|
||||
}
|
||||
.mpvue-calendar .mc-range-mode.week-switch .mc-range-month-last .mc-range-bg{
|
||||
background-color: #01a1ed;
|
||||
border-radius: 0px 20% 20% 0px;
|
||||
}
|
||||
/*month range*/
|
||||
.mpvue-calendar .month-range-mode{
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
position: relative;
|
||||
}
|
||||
.mpvue-calendar .mc-month-range-mode-head{
|
||||
box-shadow: 0 4px 8px rgba(25,47,89,.1);
|
||||
padding: 15rpx 0rpx;
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
background-color: #fff;
|
||||
z-index: 9;
|
||||
}
|
||||
.month-range-mode .month-rang-head {
|
||||
text-align: left;
|
||||
margin: 20rpx 0px;
|
||||
padding-left: 40rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.month-range-mode .mc-last-month, .month-range-mode .mc-next-month{
|
||||
opacity: 0 !important;
|
||||
}
|
||||
.month-text-background{
|
||||
position: absolute;
|
||||
font-size: 140px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
line-height: 2.4;
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
<template>
|
||||
<view class="orderGoods">
|
||||
<view class='total'>共{{totalNmu}}件商品</view>
|
||||
<view class='goodWrapper'>
|
||||
<view class='item acea-row row-between-wrapper' v-for="(item,index) in cartInfo" :key="index" @click="jumpCon(item.productId)">
|
||||
<view class='pictrue'>
|
||||
<image :src='item.productInfo.attrInfo.image' v-if="item.productInfo.attrInfo"></image>
|
||||
<image :src='item.productInfo.image' v-else></image>
|
||||
</view>
|
||||
<view class='text'>
|
||||
<view class='acea-row row-between-wrapper'>
|
||||
<view class='name line1'>{{item.productInfo.storeName}}</view>
|
||||
<view class='num'>x {{item.cartNum}}</view>
|
||||
</view>
|
||||
<view class='attr line1' v-if="item.productInfo.attrInfo">{{item.productInfo.attrInfo.suk}}</view>
|
||||
<view class='money font-color' v-if="item.productInfo.attrInfo">¥{{item.productInfo.attrInfo.price}}</view>
|
||||
<view class='money font-color' v-else>¥{{item.productInfo.price}}</view>
|
||||
<view class='evaluate' v-if='item.isReply==0 && evaluate==3' @click.stop="evaluateTap(item.productAttrUnique,orderId,ids)">评价</view>
|
||||
<view class='evaluate' v-else-if="item.isReply==1 && evaluate==3">已评价</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
evaluate: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
cartInfo: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
orderId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
ids: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
jump: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
totalNmu:''
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
cartInfo:function(nVal,oVal){
|
||||
let num = 0
|
||||
nVal.forEach((item,index)=>{
|
||||
num += item.cartNum
|
||||
})
|
||||
this.totalNmu = num
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
evaluateTap:function(unique,orderId,ids){
|
||||
uni.navigateTo({
|
||||
url:"/pages/users/goods_comment_con/index?unique="+unique+"&uni="+orderId + "&id=" + ids
|
||||
})
|
||||
},
|
||||
jumpCon:function(id){
|
||||
if(this.jump){
|
||||
uni.navigateTo({
|
||||
url: `/pages/goods_details/index?id=${id}`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.orderGoods {
|
||||
background-color: #fff;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.orderGoods .total {
|
||||
width: 100%;
|
||||
height: 86rpx;
|
||||
padding: 0 30rpx;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
font-size: 30rpx;
|
||||
color: #282828;
|
||||
line-height: 86rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,300 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="payment" :class="pay_close ? 'on' : ''">
|
||||
<view class="title acea-row row-center-wrapper">
|
||||
选择付款方式<text class="iconfont icon-guanbi" @click='close'></text>
|
||||
</view>
|
||||
<view class="item acea-row row-between-wrapper" @click='goPay(item.number || 0 , item.value)' v-for="(item,index) in payMode"
|
||||
:key="index">
|
||||
<view class="left acea-row row-between-wrapper">
|
||||
<view class="iconfont" :class="item.icon"></view>
|
||||
<view class="text">
|
||||
<view class="name">{{item.name}}</view>
|
||||
<view class="info" v-if="item.number">
|
||||
{{item.title}} <span class="money">¥{{ item.number }}</span>
|
||||
</view>
|
||||
<view class="info" v-else>{{item.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="iconfont icon-xiangyou"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mask" @click='close' v-if="pay_close"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
orderPay
|
||||
} from '@/api/order.js';
|
||||
export default {
|
||||
props: {
|
||||
payMode: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
pay_close: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
order_id: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
totalPrice: {
|
||||
type: String,
|
||||
default: '0'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
close: function() {
|
||||
this.$emit('onChangeFun', {
|
||||
action: 'payClose'
|
||||
});
|
||||
},
|
||||
goPay: function(number, paytype) {
|
||||
let that = this;
|
||||
if (!that.order_id) return that.$util.Tips({
|
||||
title: '请选择要支付的订单'
|
||||
});
|
||||
if (paytype == 'yue' && parseFloat(number) < parseFloat(that.totalPrice)) return that.$util.Tips({
|
||||
title: '余额不足!'
|
||||
});
|
||||
uni.showLoading({
|
||||
title: '支付中'
|
||||
});
|
||||
orderPay({
|
||||
uni: that.order_id,
|
||||
paytype: paytype,
|
||||
// #ifdef MP
|
||||
'from': 'routine',
|
||||
// #endif
|
||||
// #ifdef H5 || APP-PLUS
|
||||
'from': this.$wechat.isWeixin() ? 'weixin' : 'weixinh5',
|
||||
// #endif
|
||||
}).then(res => {
|
||||
switch (paytype) {
|
||||
case 'weixin':
|
||||
if (res.data.result === undefined) return that.$util.Tips({
|
||||
title: '缺少支付参数'
|
||||
});
|
||||
// #ifdef MP || APP-PLUS
|
||||
let jsConfig = res.data.jsConfig;
|
||||
let packages = 'prepay_id=' + jsConfig.prepayId;
|
||||
uni.requestPayment({
|
||||
timeStamp: jsConfig.timeStamp.toString(),
|
||||
nonceStr: jsConfig.nonceStr,
|
||||
package: packages,
|
||||
signType: jsConfig.signType,
|
||||
paySign: jsConfig.paySign,
|
||||
success: function(res) {
|
||||
uni.hideLoading();
|
||||
return that.$util.Tips({
|
||||
title: '支付成功',
|
||||
icon: 'success'
|
||||
}, () => {
|
||||
that.$emit('onChangeFun', {
|
||||
action: 'pay_complete'
|
||||
});
|
||||
});
|
||||
},
|
||||
fail: function(e) {
|
||||
uni.hideLoading();
|
||||
return that.$util.Tips({
|
||||
title: '取消支付'
|
||||
}, () => {
|
||||
that.$emit('onChangeFun', {
|
||||
action: 'pay_fail'
|
||||
});
|
||||
});
|
||||
},
|
||||
complete: function(e) {
|
||||
uni.hideLoading();
|
||||
if (e.errMsg == 'requestPayment:cancel') return that.$util.Tips({
|
||||
title: '取消支付'
|
||||
}, () => {
|
||||
that.$emit('onChangeFun', {
|
||||
action: 'pay_fail'
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
let data = res.data;
|
||||
if (data.status == "WECHAT_H5_PAY") {
|
||||
uni.hideLoading();
|
||||
location.replace(data.result.jsConfig.mweb_url);
|
||||
return that.$util.Tips({
|
||||
title: "支付成功",
|
||||
icon: 'success'
|
||||
}, () => {
|
||||
that.$emit('onChangeFun', {
|
||||
action: 'pay_complete'
|
||||
});
|
||||
});
|
||||
} else {
|
||||
let jsConfig = data.result.jsConfig;
|
||||
let packages = 'prepay_id=' + jsConfig.prepayId;
|
||||
let data = {
|
||||
timestamp:jsConfig.timeStamp,
|
||||
nonceStr:jsConfig.nonceStr,
|
||||
package:packages,
|
||||
signType:jsConfig.signType,
|
||||
paySign:jsConfig.paySign
|
||||
};
|
||||
that.$wechat.pay(data)
|
||||
.finally(() => {
|
||||
return that.$util.Tips({
|
||||
title: "支付成功",
|
||||
icon: 'success'
|
||||
}, () => {
|
||||
that.$emit('onChangeFun', {
|
||||
action: 'pay_complete'
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(function() {
|
||||
return that.$util.Tips({
|
||||
title: '支付失败'
|
||||
});
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
break;
|
||||
case 'yue':
|
||||
uni.hideLoading();
|
||||
return that.$util.Tips({
|
||||
title: '余额支付成功',
|
||||
icon: 'success'
|
||||
}, () => {
|
||||
that.$emit('onChangeFun', {
|
||||
action: 'pay_complete'
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'offline':
|
||||
uni.hideLoading();
|
||||
return that.$util.Tips({
|
||||
title: '线下支付成功',
|
||||
icon: 'success'
|
||||
}, () => {
|
||||
that.$emit('onChangeFun', {
|
||||
action: 'pay_complete'
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
return that.$util.Tips({
|
||||
title: err
|
||||
}, () => {
|
||||
that.$emit('onChangeFun', {
|
||||
action: 'pay_fail'
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.payment {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
background-color: #fff;
|
||||
padding-bottom: 60rpx;
|
||||
z-index: 99;
|
||||
transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
|
||||
transform: translate3d(0, 100%, 0);
|
||||
}
|
||||
|
||||
.payment.on {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
.payment .title {
|
||||
text-align: center;
|
||||
height: 123rpx;
|
||||
font-size: 32rpx;
|
||||
color: #282828;
|
||||
font-weight: bold;
|
||||
padding-right: 30rpx;
|
||||
margin-left: 30rpx;
|
||||
position: relative;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.payment .title .iconfont {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 43rpx;
|
||||
color: #8a8a8a;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.payment .item {
|
||||
border-bottom: 1rpx solid #eee;
|
||||
height: 130rpx;
|
||||
margin-left: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
}
|
||||
|
||||
.payment .item .left {
|
||||
width: 610rpx;
|
||||
}
|
||||
|
||||
.payment .item .left .text {
|
||||
width: 540rpx;
|
||||
}
|
||||
|
||||
.payment .item .left .text .name {
|
||||
font-size: 32rpx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.payment .item .left .text .info {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.payment .item .left .text .info .money {
|
||||
color: #ff9900;
|
||||
}
|
||||
|
||||
.payment .item .left .iconfont {
|
||||
font-size: 45rpx;
|
||||
color: #09bb07;
|
||||
}
|
||||
|
||||
.payment .item .left .iconfont.icon-zhifubao {
|
||||
color: #00aaea;
|
||||
}
|
||||
|
||||
.payment .item .left .iconfont.icon-yuezhifu {
|
||||
color: #ff9900;
|
||||
}
|
||||
|
||||
.payment .item .left .iconfont.icon-yuezhifu1 {
|
||||
color: #eb6623;
|
||||
}
|
||||
|
||||
.payment .item .iconfont {
|
||||
font-size: 0.3rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,89 @@
|
|||
<template>
|
||||
<!-- <view class='product-bg'>
|
||||
<swiper :indicator-dots="indicatorDots"
|
||||
:autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration" @change="change">
|
||||
<block v-for="(item,index) in imgUrls" :key="index">
|
||||
<swiper-item>
|
||||
<image :src="item" class="slide-image"/>
|
||||
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<view class='pages'>{{currents}}/{{imgUrls.length || 1}}</view>
|
||||
</view> -->
|
||||
<view class='product-bg'>
|
||||
<swiper :indicator-dots="indicatorDots" indicator-active-color="#e93323"
|
||||
:autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration" @change="change">
|
||||
<swiper-item v-if="videoline">
|
||||
<view class="item">
|
||||
<video id="myVideo" :src='videoline' objectFit="cover" controls style="width:100%;height:100% " show-center-play-btn show-mute-btn="true" auto-pause-if-navigate :custom-cache="false"></video>
|
||||
<view class="poster" v-if="controls">
|
||||
<image class="image" :src="imgUrls[0]"></image>
|
||||
</view>
|
||||
<view class="stop" v-if="controls" @tap="bindPause">
|
||||
<image class="image" src="../../static/images/stop.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
<block v-for="(item,index) in imgUrls" :key='index'>
|
||||
<swiper-item>
|
||||
<image :src="item" class="slide-image"/>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
imgUrls: {
|
||||
type: Array,
|
||||
default: function(){
|
||||
return [];
|
||||
}
|
||||
},
|
||||
videoline:
|
||||
{
|
||||
type:String,
|
||||
value:""
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
indicatorDots: true,
|
||||
circular: true,
|
||||
autoplay: false,
|
||||
interval: 3000,
|
||||
duration: 500,
|
||||
currents: "1",
|
||||
controls:true
|
||||
};
|
||||
},
|
||||
mounted(){
|
||||
this.videoContext = uni.createVideoContext('myVideo',this);
|
||||
},
|
||||
methods: {
|
||||
bindPause:function(){
|
||||
this.videoContext.play();
|
||||
this.$set(this,'controls',false)
|
||||
},
|
||||
change: function (e) {
|
||||
this.$set(this,'currents',e.detail.current + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.product-bg{width:100%;height:750rpx;position:relative;}
|
||||
.product-bg swiper{width:100%;height:100%;position:relative;}
|
||||
.product-bg .slide-image{width:100%;height:100%;}
|
||||
.product-bg .pages{position:absolute;background-color:#fff;height:34rpx;padding:0 10rpx;border-radius:3rpx;right:30rpx;bottom:30rpx;line-height:34rpx;font-size:24rpx;color:#050505;}
|
||||
#myVideo{width: 100%;height: 100%}
|
||||
.product-bg .item{position:relative;width:100%;height:100%;}
|
||||
.product-bg .item .poster{position:absolute;top:0;left:0;height:750rpx;width:100%;z-index:9;}
|
||||
.product-bg .item .poster .image{width:100%;height:100%;}
|
||||
.product-bg .item .stop{position:absolute;top:50%;left:50%;width:136rpx;height:136rpx;margin-top:-68rpx;margin-left:-68rpx;z-index:9;}
|
||||
.product-bg .item .stop .image{width:100%;height:100%;}
|
||||
</style>
|
|
@ -0,0 +1,302 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="product-window" :class="(attr.cartAttr === true ? 'on' : '') + ' ' + (iSbnt?'join':'') + ' ' + (iScart?'joinCart':'')">
|
||||
<view class="textpic acea-row row-between-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="attr.productSelect.image"></image>
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="line1">
|
||||
{{ attr.productSelect.storeName }}
|
||||
</view>
|
||||
<view class="money font-color">
|
||||
¥<text class="num">{{ attr.productSelect.price }}</text>
|
||||
<text class="stock" v-if='isShow'>库存: {{ attr.productSelect.stock }}</text>
|
||||
<text class='stock' v-if="limitNum">限量: {{attr.productSelect.quota_show}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="iconfont icon-guanbi" @click="closeAttr"></view>
|
||||
</view>
|
||||
<view class="productWinList">
|
||||
<view class="item" v-for="(item, indexw) in attr.productAttr" :key="indexw">
|
||||
<view class="title">{{ item.attrName }}</view>
|
||||
<view class="listn acea-row row-middle">
|
||||
<view class="itemn" :class="item.index === itemn.attr ? 'on' : ''" v-for="(itemn, indexn) in item.attrValue"
|
||||
@click="tapAttr(indexw, indexn)" :key="indexn">
|
||||
{{ itemn.attr }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cart">
|
||||
<view class="title">数量</view>
|
||||
<view class="carnum acea-row row-left">
|
||||
<view class="item reduce" :class="attr.productSelect.cart_num <= 1 ? 'on' : ''" @click="CartNumDes">
|
||||
-
|
||||
</view>
|
||||
<view class='item num'>
|
||||
<input type="number" v-model="attr.productSelect.cart_num" data-name="productSelect.cart_num" @input="bindCode(attr.productSelect.cart_num)"></input>
|
||||
</view>
|
||||
<view v-if="iSplus" class="item plus" :class="
|
||||
attr.productSelect.cart_num >= attr.productSelect.stock
|
||||
? 'on'
|
||||
: ''
|
||||
"
|
||||
@click="CartNumAdd">
|
||||
+
|
||||
</view>
|
||||
<view v-else class='item plus' :class='(attr.productSelect.cart_num >= attr.productSelect.quota_show) || (attr.productSelect.cart_num >= attr.productSelect.product_stock)? "on":""' @click='CartNumAdd'>+</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="joinBnt bg-color" v-if="iSbnt && attr.productSelect.product_stock>0 &&attr.productSelect.quota>0" @click="goCat">我要参团</view>
|
||||
<view class="joinBnt on" v-else-if="(iSbnt && attr.productSelect.quota<=0)||(iSbnt &&attr.productSelect.product_stock<=0)">已售罄</view>
|
||||
<view class="joinBnt bg-color" v-if="iScart && attr.productSelect.stock" @click="goCat">确定</view>
|
||||
<view class="joinBnt on" v-else-if="iScart && !attr.productSelect.stock">已售罄</view>
|
||||
</view>
|
||||
<view class="mask" @touchmove.prevent :hidden="attr.cartAttr === false" @click="closeAttr"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
props: {
|
||||
attr: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
limitNum:{
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
isShow:{
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
iSbnt:{
|
||||
type:Number,
|
||||
value:0
|
||||
},
|
||||
iSplus:{
|
||||
type:Number,
|
||||
value:0
|
||||
},
|
||||
iScart:{
|
||||
type:Number,
|
||||
value:0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
goCat:function(){
|
||||
this.$emit('goCat');
|
||||
},
|
||||
/**
|
||||
* 购物车手动输入数量
|
||||
*
|
||||
*/
|
||||
bindCode: function (e) {
|
||||
this.$emit('iptCartNum', this.attr.productSelect.cart_num);
|
||||
},
|
||||
closeAttr: function() {
|
||||
this.$emit('myevent');
|
||||
},
|
||||
CartNumDes: function() {
|
||||
this.$emit('ChangeCartNum', false);
|
||||
},
|
||||
CartNumAdd: function() {
|
||||
this.$emit('ChangeCartNum', true);
|
||||
},
|
||||
tapAttr: function(indexw, indexn) {
|
||||
console.log('45454555');
|
||||
let that = this;
|
||||
that.$emit("attrVal", {
|
||||
indexw: indexw,
|
||||
indexn: indexn
|
||||
});
|
||||
this.$set(this.attr.productAttr[indexw], 'index', this.attr.productAttr[indexw].attrValues[indexn]);
|
||||
let value = that
|
||||
.getCheckedValue()
|
||||
.sort()
|
||||
.join(",");
|
||||
that.$emit("ChangeAttr", value);
|
||||
|
||||
},
|
||||
//获取被选中属性;
|
||||
getCheckedValue: function() {
|
||||
let productAttr = this.attr.productAttr;
|
||||
let value = [];
|
||||
for (let i = 0; i < productAttr.length; i++) {
|
||||
for (let j = 0; j < productAttr[i].attrValues.length; j++) {
|
||||
if (productAttr[i].index === productAttr[i].attrValues[j]) {
|
||||
value.push(productAttr[i].attrValues[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.product-window {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
z-index: 77;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
padding-bottom: 140rpx;
|
||||
transform: translate3d(0, 100%, 0);
|
||||
transition: all .3s cubic-bezier(.25, .5, .5, .9);
|
||||
}
|
||||
|
||||
.product-window.on {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
.product-window.join{padding-bottom: 30rpx;}
|
||||
|
||||
.product-window.joinCart{
|
||||
padding-bottom: 30rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.product-window .textpic {
|
||||
padding: 0 130rpx 0 30rpx;
|
||||
margin-top: 29rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.product-window .textpic .pictrue {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
}
|
||||
|
||||
.product-window .textpic .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.product-window .textpic .text {
|
||||
width: 410rpx;
|
||||
font-size: 32rpx;
|
||||
color: #202020;
|
||||
}
|
||||
|
||||
.product-window .textpic .text .money {
|
||||
font-size: 24rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.product-window .textpic .text .money .num {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.product-window .textpic .text .money .stock {
|
||||
color: #999;
|
||||
margin-left: 18rpx;
|
||||
}
|
||||
|
||||
.product-window .textpic .iconfont {
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: -5rpx;
|
||||
font-size: 35rpx;
|
||||
color: #8a8a8a;
|
||||
}
|
||||
|
||||
.product-window .productWinList {
|
||||
max-height: 395rpx;
|
||||
overflow: auto;
|
||||
margin-top: 36rpx;
|
||||
}
|
||||
|
||||
.product-window .productWinList .item~.item {
|
||||
margin-top: 36rpx;
|
||||
}
|
||||
|
||||
.product-window .productWinList .item .title {
|
||||
font-size: 30rpx;
|
||||
color: #999;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.product-window .productWinList .item .listn {
|
||||
padding: 0 30rpx 0 16rpx;
|
||||
}
|
||||
|
||||
.product-window .productWinList .item .listn .itemn {
|
||||
border: 1px solid #bbb;
|
||||
font-size: 26rpx;
|
||||
color: #282828;
|
||||
padding: 7rpx 33rpx;
|
||||
border-radius: 6rpx;
|
||||
margin: 14rpx 0 0 14rpx;
|
||||
}
|
||||
|
||||
.product-window .productWinList .item .listn .itemn.on {
|
||||
color: #fff;
|
||||
background-color: #ff3700;
|
||||
border-color: #ff3700;
|
||||
}
|
||||
|
||||
.product-window .cart {
|
||||
margin-top: 36rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.product-window .cart .title {
|
||||
font-size: 30rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.product-window .cart .carnum {
|
||||
height: 54rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.product-window .cart .carnum view {
|
||||
border: 1px solid #a4a4a4;
|
||||
width: 84rpx;
|
||||
text-align: center;
|
||||
height: 100%;
|
||||
line-height: 54rpx;
|
||||
color: #a4a4a4;
|
||||
font-size: 45rpx;
|
||||
}
|
||||
|
||||
.product-window .cart .carnum .reduce {
|
||||
border-right: 0;
|
||||
border-radius: 6rpx 0 0 6rpx;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
|
||||
.product-window .cart .carnum .reduce.on {
|
||||
border-color: #e3e3e3;
|
||||
color: #dedede;
|
||||
}
|
||||
|
||||
.product-window .cart .carnum .plus {
|
||||
border-left: 0;
|
||||
border-radius: 0 6rpx 6rpx 0;
|
||||
line-height: 46rpx;
|
||||
}
|
||||
|
||||
.product-window .cart .carnum .plus.on {
|
||||
border-color: #e3e3e3;
|
||||
color: #dedede;
|
||||
}
|
||||
|
||||
.product-window .cart .carnum .num {
|
||||
color: #282828;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.product-window .joinBnt{font-size: 30rpx;width: 620rpx;height: 86rpx;border-radius: 50rpx;text-align: center;line-height: 86rpx;color: #fff;margin: 21rpx auto 0 auto;}
|
||||
.product-window .joinBnt.on{background-color:#bbb;color:#fff;}
|
||||
</style>
|
|
@ -0,0 +1,110 @@
|
|||
<template>
|
||||
<view class='promotionGood'>
|
||||
<block v-for="(item,index) in benefit" :key="index">
|
||||
<view class='item acea-row row-between-wrapper' @tap="goDetail(item)" hover-class="none">
|
||||
<view class='pictrue'>
|
||||
<image :src='item.image'></image>
|
||||
<span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '1'">秒杀</span>
|
||||
<span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '2'">砍价</span>
|
||||
<span class="pictrue_log pictrue_log_class" v-if="item.activity && item.activity.type === '3'">拼团</span>
|
||||
</view>
|
||||
<view class='text'>
|
||||
<view class='name line1'>{{item.store_name}}</view>
|
||||
<view class='sp-money acea-row'>
|
||||
<view class='moneyCon'>促销价: ¥<text class='num'>{{item.price}}</text></view>
|
||||
</view>
|
||||
<view class='acea-row row-between-wrapper'>
|
||||
<view class='money'>日常价:¥{{item.ot_price}}</view>
|
||||
<view>仅剩:{{item.stock}}{{item.unit_name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import { goShopDetail } from '@/libs/order.js'
|
||||
export default {
|
||||
computed: mapGetters(['uid']),
|
||||
props: {
|
||||
benefit: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
goDetail(item){
|
||||
goShopDetail(item,this.uid).then(res=>{
|
||||
uni.navigateTo({
|
||||
url:`/pages/goods_details/index?id=${item.id}`
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
.promotionGood {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.promotionGood .item {
|
||||
border-bottom: 1rpx solid #eee;
|
||||
height: 250rpx;
|
||||
}
|
||||
|
||||
.promotionGood .item .pictrue {
|
||||
position: relative;
|
||||
width: 188rpx;
|
||||
height: 188rpx;
|
||||
}
|
||||
|
||||
.promotionGood .item .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.promotionGood .item .text {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
width: 472rpx;
|
||||
}
|
||||
|
||||
.promotionGood .item .text .name {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.promotionGood .item .text .sp-money {
|
||||
margin: 34rpx 0 20rpx 0;
|
||||
}
|
||||
|
||||
.promotionGood .item .text .sp-money .moneyCon {
|
||||
padding: 0 18rpx;
|
||||
background-color: red;
|
||||
height: 46rpx;
|
||||
line-height: 46rpx;
|
||||
background-image: linear-gradient(to right, #ff6248 0%, #ff3e1e 100%);
|
||||
font-size: 20rpx;
|
||||
color: #fff;
|
||||
border-radius: 24rpx 3rpx 24rpx 3rpx;
|
||||
}
|
||||
|
||||
.promotionGood .item .text .sp-money .moneyCon .num {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.promotionGood .item .text .money {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,113 @@
|
|||
<template>
|
||||
<view class='recommend'>
|
||||
<view class='title acea-row row-center-wrapper'>
|
||||
<text class='iconfont icon-zhuangshixian'></text>
|
||||
<text class='name'>热门推荐</text>
|
||||
<text class='iconfont icon-zhuangshixian lefticon'></text>
|
||||
</view>
|
||||
<view class='recommendList acea-row row-between-wrapper'>
|
||||
<view class='item' v-for="(item,index) in hostProduct" :key="index" hover-class='none' @tap="goDetail(item)">
|
||||
<view class='pictrue'>
|
||||
<image :src='item.image'></image>
|
||||
<span class="pictrue_log_big pictrue_log_class" v-if="item.activity && item.activity.type === '1'">秒杀</span>
|
||||
<span class="pictrue_log_big pictrue_log_class" v-if="item.activity && item.activity.type === '2'">砍价</span>
|
||||
<span class="pictrue_log_big pictrue_log_class" v-if="item.activity && item.activity.type === '3'">拼团</span>
|
||||
</view>
|
||||
<view class='name line1'>{{item.storeName}}</view>
|
||||
<view class='money font-color'>¥<text class='num'>{{item.price}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import { goShopDetail } from '@/libs/order.js'
|
||||
export default {
|
||||
computed: mapGetters(['uid']),
|
||||
props: {
|
||||
hostProduct: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
goDetail(item){
|
||||
goShopDetail(item,this.uid).then(res=>{
|
||||
uni.navigateTo({
|
||||
url:`/pages/goods_details/index?id=${item.id}`
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.recommend {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.recommend .title {
|
||||
height: 135rpx;
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.recommend .title .name {
|
||||
margin: 0 28rpx;
|
||||
}
|
||||
|
||||
.recommend .title .iconfont {
|
||||
font-size: 170rpx;
|
||||
color: #454545;
|
||||
}
|
||||
|
||||
.recommend .title .iconfont.lefticon {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.recommend .recommendList {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.recommend .recommendList .item {
|
||||
width: 335rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.recommend .recommendList .item .pictrue {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 335rpx;
|
||||
}
|
||||
|
||||
.recommend .recommendList .item .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.recommend .recommendList .item .name {
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.recommend .recommendList .item .money {
|
||||
font-size: 20rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.recommend .recommendList .item .money .num {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,47 @@
|
|||
<template>
|
||||
<view v-if="shareInfoStatus" class="poster-first">
|
||||
<view class="mask-share">
|
||||
<image src="/static/images/share-info.png" @click="shareInfoClose" @touchmove.stop.prevent="false"></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props: {
|
||||
shareInfoStatus: {
|
||||
type: Boolean,
|
||||
default:false,
|
||||
}
|
||||
},
|
||||
data: function() {
|
||||
return {};
|
||||
},
|
||||
mounted: function() {},
|
||||
methods: {
|
||||
shareInfoClose: function() {
|
||||
this.$emit("setShareInfoStatus");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.poster-first {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
.mask-share {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 99;
|
||||
}
|
||||
.mask-share image {
|
||||
width: 100%;
|
||||
height:100%;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,57 @@
|
|||
<template>
|
||||
<view class='sharing-packets' :class='sharePacket.isState==true?"on":""'>
|
||||
<view class='iconfont icon-guanbi' @click="closeShare"></view>
|
||||
<view class='line'></view>
|
||||
<view class='sharing-con' @click='goShare'>
|
||||
<image src='../../static/images/red-packets.png'></image>
|
||||
<view class='text font-color'>
|
||||
<view>会员分享返</view>
|
||||
<view class='money'><text class='label'>¥</text>{{sharePacket.priceName}}</view>
|
||||
<view class='tip'>下单即返佣金</view>
|
||||
<view class='shareBut'>立即分享</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
props: {
|
||||
sharePacket: {
|
||||
type: Object,
|
||||
default: function(){
|
||||
return {isState: true,priceName:''}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
closeShare:function(){
|
||||
this.$emit('closeChange');
|
||||
},
|
||||
goShare:function(){
|
||||
this.$emit('listenerActionSheet');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.sharing-packets{position:fixed;left:30rpx;bottom:200rpx;z-index:5;transition:all 0.3s ease-in-out 0s;opacity:1;transform: scale(1);}
|
||||
.sharing-packets.on{transform: scale(0);opacity:0;}
|
||||
.sharing-packets .iconfont{width:44rpx;height:44rpx;border-radius:50%;text-align:center;line-height:44rpx;background-color:#999;font-size:20rpx;color:#fff;margin:0 auto;box-sizing:border-box;padding-left:1px;}
|
||||
.sharing-packets .line{width:2rpx;height:40rpx;background-color:#999;margin:0 auto;}
|
||||
.sharing-packets .sharing-con{width:187rpx;height:210rpx;position:relative;}
|
||||
.sharing-packets .sharing-con image{width:100%;height:100%;}
|
||||
.sharing-packets .sharing-con .text{position:absolute;top:30rpx;font-size:20rpx;width:100%;text-align:center;}
|
||||
.sharing-packets .sharing-con .text .money{font-size:32rpx;font-weight:bold;margin-top:5rpx;}
|
||||
.sharing-packets .sharing-con .text .money .label{font-size:20rpx;}
|
||||
.sharing-packets .sharing-con .text .tip{font-size:18rpx;color:#999;margin-top:5rpx;}
|
||||
.sharing-packets .sharing-con .text .shareBut{font-size:22rpx;color:#fff;margin-top:18rpx;height:50rpx;line-height:50rpx;}
|
||||
</style>
|
|
@ -0,0 +1,52 @@
|
|||
<template>
|
||||
<view class='swiper'>
|
||||
<swiper :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration" @change="swiperChange">
|
||||
<block v-for="(item,index) in imgUrls" :key="index">
|
||||
<swiper-item>
|
||||
<navigator :url="item.link" style='width:100%;height:100%;' hover-class='none'><image :src="item.img" class="slide-image"/></navigator>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<view class="dots acea-row">
|
||||
<view class="dot" :class="index == currentSwiper ? 'active' : ''" v-for="(item,index) in imgUrls" :key="index"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
props: {
|
||||
imgUrls: {
|
||||
type: Array,
|
||||
default: function(){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
circular: true,
|
||||
autoplay: true,
|
||||
interval: 3000,
|
||||
duration: 500,
|
||||
currentSwiper: 0
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
swiperChange: function (e) {
|
||||
this.currentSwiper = e.detail.current
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.swiper{width:100%;height:282rpx;position:relative;}
|
||||
.swiper swiper{width:100%;height:100%;position:relative;}
|
||||
.swiper swiper .slide-image{width:100%;height:100%;}
|
||||
.swiper .dots{position:absolute;right:40rpx;bottom:20rpx;}
|
||||
.swiper .dots .dot{width:12rpx;height:12rpx;border:2rpx solid #fff;border-radius:50%;margin-right:15rpx;}
|
||||
.swiper .dots .dot.active{border-color:#e93323;background-color:#e93323;}
|
||||
</style>
|
|
@ -0,0 +1,186 @@
|
|||
<template>
|
||||
<view class="navTabBox">
|
||||
<view class="longTab">
|
||||
<scroll-view scroll-x="true" style="white-space: nowrap; display: flex;" scroll-with-animation :scroll-left="tabLeft" show-scrollbar="true">
|
||||
<view class="longItem line1" :style='"width:"+isWidth+"px"' :data-index="index" :class="index===tabClick?'click':''" v-for="(item,index) in tabTitle" :key="index" :id="'id'+index" @click="longClick(index)">{{item.name}}</view>
|
||||
<view class="underlineBox" :style='"transform:translateX("+isLeft+"px);width:"+isWidth+"px"'>
|
||||
<view class="underline"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="child-box" v-if="tabClick>0 && tabTitle[tabClick].child?tabTitle[tabClick].child.length>0:0">
|
||||
<scroll-view scroll-x="true" style="white-space: nowrap; display: flex;align-items: center; height: 100%;" scroll-with-animation :scroll-left="tabLeft" show-scrollbar="false">
|
||||
<view class="wrapper">
|
||||
<view v-for="(item,index) in tabTitle[tabClick].child?tabTitle[tabClick].child:[]" class="child-item" :class="{on:index == childIndex}" @click="childTab(tabClick,index)">
|
||||
<image :src="item.url" mode=""></image>
|
||||
<view class="txt line1">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getProductslist,
|
||||
getProductHot
|
||||
} from '@/api/store.js';
|
||||
export default {
|
||||
name: 'navTab',
|
||||
props: {
|
||||
tabTitle: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabClick: 0, //导航栏被点击
|
||||
isLeft: 0, //导航栏下划线位置
|
||||
isWidth: 0, //每个导航栏占位
|
||||
tabLeft:0,
|
||||
swiperIndex:0,
|
||||
childIndex:0,
|
||||
childID:0
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
var that = this
|
||||
// 获取设备宽度
|
||||
uni.getSystemInfo({
|
||||
success(e) {
|
||||
that.isWidth = e.windowWidth / 5
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 导航栏点击
|
||||
longClick(index){
|
||||
this.childIndex = 0;
|
||||
if(this.tabTitle.length>5){
|
||||
var tempIndex = index - 2;
|
||||
tempIndex = tempIndex<=0 ? 0 : tempIndex;
|
||||
this.tabLeft = (index-2) * this.isWidth //设置下划线位置
|
||||
}
|
||||
this.tabClick = index //设置导航点击了哪一个
|
||||
this.isLeft = index * this.isWidth //设置下划线位置
|
||||
let obj = {
|
||||
type:'big', //大标题
|
||||
index:index
|
||||
}
|
||||
this.parentEmit(obj)
|
||||
// this.$parent.currentTab = index //设置swiper的第几页
|
||||
},
|
||||
// 导航子类点击
|
||||
childTab(tabClick,index){
|
||||
this.childIndex = index
|
||||
let obj = {
|
||||
parentIndex:tabClick,
|
||||
childIndex:index,
|
||||
type:'small' //小标题
|
||||
}
|
||||
this.parentEmit(obj)
|
||||
},
|
||||
parentEmit(data){
|
||||
this.$emit('changeTab', data);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.navTabBox {
|
||||
width: 100%;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
.click {
|
||||
color: white;
|
||||
}
|
||||
.longTab {
|
||||
width: 100%;
|
||||
/* #ifdef H5 */
|
||||
padding-bottom: 20rpx;
|
||||
/* #endif */
|
||||
/* #ifdef MP */
|
||||
padding-top: 12rpx;
|
||||
padding-bottom: 12rpx;
|
||||
/* #endif */
|
||||
.longItem{
|
||||
height: 50upx;
|
||||
display: inline-block;
|
||||
line-height: 50upx;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
&.click{
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.underlineBox {
|
||||
height: 3px;
|
||||
width: 20%;
|
||||
display: flex;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
transition: .5s;
|
||||
.underline {
|
||||
width: 33rpx;
|
||||
height: 4rpx;
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.child-box{
|
||||
width: 100%;
|
||||
position: relative;
|
||||
// height: 152rpx;
|
||||
background-color: #fff;
|
||||
/* #ifdef H5 */
|
||||
box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.02);
|
||||
/* #endif */
|
||||
/* #ifdef MP */
|
||||
box-shadow: 0 2rpx 3rpx 1rpx #f9f9f9;
|
||||
/* #endif */
|
||||
|
||||
.wrapper{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx 0;
|
||||
background: #fff;
|
||||
/* #ifdef H5 */
|
||||
//box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.06);
|
||||
/* #endif */
|
||||
}
|
||||
.child-item{
|
||||
flex-shrink: 0;
|
||||
width:140rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 10rpx;
|
||||
image{
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.txt{
|
||||
font-size: 24rpx;
|
||||
color: #282828;
|
||||
text-align: center;
|
||||
margin-top: 10rpx;
|
||||
width: 100%;
|
||||
}
|
||||
&.on{
|
||||
image{
|
||||
border: 1px solid $theme-color-opacity;
|
||||
}
|
||||
.txt{
|
||||
color: $theme-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,165 @@
|
|||
<template>
|
||||
<canvas v-if="canvasId" :id="canvasId" :canvasId="canvasId" :style="{'width':cWidth*pixelRatio+'px','height':cHeight*pixelRatio+'px', 'transform': 'scale('+(1/pixelRatio)+')','margin-left':-cWidth*(pixelRatio-1)/2+'px','margin-top':-cHeight*(pixelRatio-1)/2+'px'}"
|
||||
@touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd" @error="error">
|
||||
</canvas>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uCharts from './u-charts.js';
|
||||
var canvases = {};
|
||||
|
||||
export default {
|
||||
props: {
|
||||
chartType: {
|
||||
required: true,
|
||||
type: String,
|
||||
default: 'column'
|
||||
},
|
||||
opts: {
|
||||
required: true,
|
||||
type: Object,
|
||||
default () {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
canvasId: {
|
||||
type: String,
|
||||
default: 'u-canvas',
|
||||
},
|
||||
cWidth: {
|
||||
default: 375,
|
||||
},
|
||||
cHeight: {
|
||||
default: 250,
|
||||
},
|
||||
pixelRatio: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
switch (this.chartType) {
|
||||
case 'column':
|
||||
this.initColumnChart();
|
||||
break;
|
||||
case 'line':
|
||||
this.initLineChart();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
initColumnChart() {
|
||||
canvases[this.canvasId] = new uCharts({
|
||||
$this: this,
|
||||
canvasId: this.canvasId,
|
||||
type: 'column',
|
||||
legend: true,
|
||||
fontSize: 11,
|
||||
background: '#FFFFFF',
|
||||
pixelRatio: this.pixelRatio,
|
||||
animation: true,
|
||||
categories: this.opts.categories,
|
||||
series: this.opts.series,
|
||||
enableScroll: true,
|
||||
xAxis: {
|
||||
disableGrid: true,
|
||||
itemCount: 4,
|
||||
scrollShow: true
|
||||
},
|
||||
yAxis: {
|
||||
//disabled:true
|
||||
},
|
||||
dataLabel: true,
|
||||
width: this.cWidth * this.pixelRatio,
|
||||
height: this.cHeight * this.pixelRatio,
|
||||
extra: {
|
||||
column: {
|
||||
type: 'group',
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
initLineChart() {
|
||||
canvases[this.canvasId] = new uCharts({
|
||||
$this: this,
|
||||
canvasId: this.canvasId,
|
||||
type: 'line',
|
||||
fontSize: 11,
|
||||
legend: true,
|
||||
dataLabel: false,
|
||||
dataPointShape: true,
|
||||
background: '#FFFFFF',
|
||||
pixelRatio: this.pixelRatio,
|
||||
categories: this.opts.categories,
|
||||
series: this.opts.series,
|
||||
animation: true,
|
||||
enableScroll: true,
|
||||
xAxis: {
|
||||
type: 'grid',
|
||||
gridColor: '#CCCCCC',
|
||||
gridType: 'dash',
|
||||
dashLength: 8,
|
||||
itemCount: 4,
|
||||
scrollShow: true
|
||||
},
|
||||
yAxis: {
|
||||
gridType: 'dash',
|
||||
gridColor: '#CCCCCC',
|
||||
dashLength: 8,
|
||||
splitNumber: 5,
|
||||
min: 10,
|
||||
max: 180,
|
||||
format: (val) => {
|
||||
return val.toFixed(0) + '元'
|
||||
}
|
||||
},
|
||||
width: this.cWidth * this.pixelRatio,
|
||||
height: this.cHeight * this.pixelRatio,
|
||||
extra: {
|
||||
line: {
|
||||
type: 'straight'
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 这里仅作为示例传入两个参数,cid为canvas-id,newdata为更新的数据,需要更多参数请自行修改
|
||||
changeData(cid,newdata) {
|
||||
canvases[cid].updateData({
|
||||
series: newdata.series,
|
||||
categories: newdata.categories
|
||||
});
|
||||
},
|
||||
touchStart(e) {
|
||||
canvases[this.canvasId].showToolTip(e, {
|
||||
format: function(item, category) {
|
||||
return category + ' ' + item.name + ':' + item.data
|
||||
}
|
||||
});
|
||||
canvases[this.canvasId].scrollStart(e);
|
||||
},
|
||||
touchMove(e) {
|
||||
canvases[this.canvasId].scroll(e);
|
||||
},
|
||||
touchEnd(e) {
|
||||
canvases[this.canvasId].scrollEnd(e);
|
||||
},
|
||||
error(e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.charts {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,546 @@
|
|||
/**
|
||||
* @1900-2100区间内的公历、农历互转
|
||||
* @charset UTF-8
|
||||
* @github https://github.com/jjonline/calendar.js
|
||||
* @Author Jea杨(JJonline@JJonline.Cn)
|
||||
* @Time 2014-7-21
|
||||
* @Time 2016-8-13 Fixed 2033hex、Attribution Annals
|
||||
* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
|
||||
* @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year
|
||||
* @Version 1.0.3
|
||||
* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
|
||||
* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
|
||||
*/
|
||||
/* eslint-disable */
|
||||
var calendar = {
|
||||
|
||||
/**
|
||||
* 农历1900-2100的润大小信息表
|
||||
* @Array Of Property
|
||||
* @return Hex
|
||||
*/
|
||||
lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909
|
||||
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919
|
||||
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929
|
||||
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939
|
||||
0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949
|
||||
0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959
|
||||
0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969
|
||||
0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979
|
||||
0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989
|
||||
0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999
|
||||
0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009
|
||||
0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019
|
||||
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029
|
||||
0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039
|
||||
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049
|
||||
/** Add By JJonline@JJonline.Cn**/
|
||||
0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059
|
||||
0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069
|
||||
0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079
|
||||
0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089
|
||||
0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099
|
||||
0x0d520], // 2100
|
||||
|
||||
/**
|
||||
* 公历每个月份的天数普通表
|
||||
* @Array Of Property
|
||||
* @return Number
|
||||
*/
|
||||
solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
||||
|
||||
/**
|
||||
* 天干地支之天干速查表
|
||||
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'],
|
||||
|
||||
/**
|
||||
* 天干地支之地支速查表
|
||||
* @Array Of Property
|
||||
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'],
|
||||
|
||||
/**
|
||||
* 天干地支之地支速查表<=>生肖
|
||||
* @Array Of Property
|
||||
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
|
||||
* @return Cn string
|
||||
*/
|
||||
Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'],
|
||||
|
||||
/**
|
||||
* 24节气速查表
|
||||
* @Array Of Property
|
||||
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
|
||||
* @return Cn string
|
||||
*/
|
||||
solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'],
|
||||
|
||||
/**
|
||||
* 1900-2100各年的24节气日期速查表
|
||||
* @Array Of Property
|
||||
* @return 0x string For splice
|
||||
*/
|
||||
sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f',
|
||||
'97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f',
|
||||
'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f',
|
||||
'97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa',
|
||||
'97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2',
|
||||
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f',
|
||||
'97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722',
|
||||
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f',
|
||||
'97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722',
|
||||
'9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f',
|
||||
'97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
|
||||
'97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
|
||||
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722',
|
||||
'7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
|
||||
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
||||
'97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
|
||||
'9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722',
|
||||
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
|
||||
'97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
|
||||
'9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
|
||||
'7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
|
||||
'9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
||||
'97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
|
||||
'9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
|
||||
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721',
|
||||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2',
|
||||
'977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
|
||||
'7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd',
|
||||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
|
||||
'977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd',
|
||||
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
|
||||
'977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
|
||||
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721',
|
||||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5',
|
||||
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
|
||||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35',
|
||||
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
|
||||
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721',
|
||||
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd',
|
||||
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35',
|
||||
'7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
|
||||
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721',
|
||||
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5',
|
||||
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35',
|
||||
'665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
|
||||
'7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
|
||||
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35',
|
||||
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'],
|
||||
|
||||
/**
|
||||
* 数字转中文速查表
|
||||
* @Array Of Property
|
||||
* @trans ['日','一','二','三','四','五','六','七','八','九','十']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'],
|
||||
|
||||
/**
|
||||
* 日期转农历称呼速查表
|
||||
* @Array Of Property
|
||||
* @trans ['初','十','廿','卅']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'],
|
||||
|
||||
/**
|
||||
* 月份转农历称呼速查表
|
||||
* @Array Of Property
|
||||
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
|
||||
* @return Cn string
|
||||
*/
|
||||
nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'],
|
||||
|
||||
/**
|
||||
* 返回农历y年一整年的总天数
|
||||
* @param lunar Year
|
||||
* @return Number
|
||||
* @eg:var count = calendar.lYearDays(1987) ;//count=387
|
||||
*/
|
||||
lYearDays: function (y) {
|
||||
var i; var sum = 348
|
||||
for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 }
|
||||
return (sum + this.leapDays(y))
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
|
||||
* @param lunar Year
|
||||
* @return Number (0-12)
|
||||
* @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
|
||||
*/
|
||||
leapMonth: function (y) { // 闰字编码 \u95f0
|
||||
return (this.lunarInfo[y - 1900] & 0xf)
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回农历y年闰月的天数 若该年没有闰月则返回0
|
||||
* @param lunar Year
|
||||
* @return Number (0、29、30)
|
||||
* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
|
||||
*/
|
||||
leapDays: function (y) {
|
||||
if (this.leapMonth(y)) {
|
||||
return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29)
|
||||
}
|
||||
return (0)
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
|
||||
* @param lunar Year
|
||||
* @return Number (-1、29、30)
|
||||
* @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
|
||||
*/
|
||||
monthDays: function (y, m) {
|
||||
if (m > 12 || m < 1) { return -1 }// 月份参数从1至12,参数错误返回-1
|
||||
return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29)
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回公历(!)y年m月的天数
|
||||
* @param solar Year
|
||||
* @return Number (-1、28、29、30、31)
|
||||
* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
|
||||
*/
|
||||
solarDays: function (y, m) {
|
||||
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
|
||||
var ms = m - 1
|
||||
if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29
|
||||
return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28)
|
||||
} else {
|
||||
return (this.solarMonth[ms])
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 农历年份转换为干支纪年
|
||||
* @param lYear 农历年的年份数
|
||||
* @return Cn string
|
||||
*/
|
||||
toGanZhiYear: function (lYear) {
|
||||
var ganKey = (lYear - 3) % 10
|
||||
var zhiKey = (lYear - 3) % 12
|
||||
if (ganKey == 0) ganKey = 10// 如果余数为0则为最后一个天干
|
||||
if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支
|
||||
return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1]
|
||||
},
|
||||
|
||||
/**
|
||||
* 公历月、日判断所属星座
|
||||
* @param cMonth [description]
|
||||
* @param cDay [description]
|
||||
* @return Cn string
|
||||
*/
|
||||
toAstro: function (cMonth, cDay) {
|
||||
var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf'
|
||||
var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]
|
||||
return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 座
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入offset偏移量返回干支
|
||||
* @param offset 相对甲子的偏移量
|
||||
* @return Cn string
|
||||
*/
|
||||
toGanZhi: function (offset) {
|
||||
return this.Gan[offset % 10] + this.Zhi[offset % 12]
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入公历(!)y年获得该年第n个节气的公历日期
|
||||
* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
|
||||
* @return day Number
|
||||
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
|
||||
*/
|
||||
getTerm: function (y, n) {
|
||||
if (y < 1900 || y > 2100) { return -1 }
|
||||
if (n < 1 || n > 24) { return -1 }
|
||||
var _table = this.sTermInfo[y - 1900]
|
||||
var _info = [
|
||||
parseInt('0x' + _table.substr(0, 5)).toString(),
|
||||
parseInt('0x' + _table.substr(5, 5)).toString(),
|
||||
parseInt('0x' + _table.substr(10, 5)).toString(),
|
||||
parseInt('0x' + _table.substr(15, 5)).toString(),
|
||||
parseInt('0x' + _table.substr(20, 5)).toString(),
|
||||
parseInt('0x' + _table.substr(25, 5)).toString()
|
||||
]
|
||||
var _calday = [
|
||||
_info[0].substr(0, 1),
|
||||
_info[0].substr(1, 2),
|
||||
_info[0].substr(3, 1),
|
||||
_info[0].substr(4, 2),
|
||||
|
||||
_info[1].substr(0, 1),
|
||||
_info[1].substr(1, 2),
|
||||
_info[1].substr(3, 1),
|
||||
_info[1].substr(4, 2),
|
||||
|
||||
_info[2].substr(0, 1),
|
||||
_info[2].substr(1, 2),
|
||||
_info[2].substr(3, 1),
|
||||
_info[2].substr(4, 2),
|
||||
|
||||
_info[3].substr(0, 1),
|
||||
_info[3].substr(1, 2),
|
||||
_info[3].substr(3, 1),
|
||||
_info[3].substr(4, 2),
|
||||
|
||||
_info[4].substr(0, 1),
|
||||
_info[4].substr(1, 2),
|
||||
_info[4].substr(3, 1),
|
||||
_info[4].substr(4, 2),
|
||||
|
||||
_info[5].substr(0, 1),
|
||||
_info[5].substr(1, 2),
|
||||
_info[5].substr(3, 1),
|
||||
_info[5].substr(4, 2)
|
||||
]
|
||||
return parseInt(_calday[n - 1])
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入农历数字月份返回汉语通俗表示法
|
||||
* @param lunar month
|
||||
* @return Cn string
|
||||
* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
|
||||
*/
|
||||
toChinaMonth: function (m) { // 月 => \u6708
|
||||
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
|
||||
var s = this.nStr3[m - 1]
|
||||
s += '\u6708'// 加上月字
|
||||
return s
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入农历日期数字返回汉字表示法
|
||||
* @param lunar day
|
||||
* @return Cn string
|
||||
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
|
||||
*/
|
||||
toChinaDay: function (d) { // 日 => \u65e5
|
||||
var s
|
||||
switch (d) {
|
||||
case 10:
|
||||
s = '\u521d\u5341'; break
|
||||
case 20:
|
||||
s = '\u4e8c\u5341'; break
|
||||
break
|
||||
case 30:
|
||||
s = '\u4e09\u5341'; break
|
||||
break
|
||||
default :
|
||||
s = this.nStr2[Math.floor(d / 10)]
|
||||
s += this.nStr1[d % 10]
|
||||
}
|
||||
return (s)
|
||||
},
|
||||
|
||||
/**
|
||||
* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
|
||||
* @param y year
|
||||
* @return Cn string
|
||||
* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
|
||||
*/
|
||||
getAnimal: function (y) {
|
||||
return this.Animals[(y - 4) % 12]
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
|
||||
* @param y solar year
|
||||
* @param m solar month
|
||||
* @param d solar day
|
||||
* @return JSON object
|
||||
* @eg:console.log(calendar.solar2lunar(1987,11,01));
|
||||
*/
|
||||
solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31
|
||||
// 年份限定、上限
|
||||
if (y < 1900 || y > 2100) {
|
||||
return -1// undefined转换为数字变为NaN
|
||||
}
|
||||
// 公历传参最下限
|
||||
if (y == 1900 && m == 1 && d < 31) {
|
||||
return -1
|
||||
}
|
||||
// 未传参 获得当天
|
||||
if (!y) {
|
||||
var objDate = new Date()
|
||||
} else {
|
||||
var objDate = new Date(y, parseInt(m) - 1, d)
|
||||
}
|
||||
var i; var leap = 0; var temp = 0
|
||||
// 修正ymd参数
|
||||
var y = objDate.getFullYear()
|
||||
var m = objDate.getMonth() + 1
|
||||
var d = objDate.getDate()
|
||||
var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000
|
||||
for (i = 1900; i < 2101 && offset > 0; i++) {
|
||||
temp = this.lYearDays(i)
|
||||
offset -= temp
|
||||
}
|
||||
if (offset < 0) {
|
||||
offset += temp; i--
|
||||
}
|
||||
|
||||
// 是否今天
|
||||
var isTodayObj = new Date()
|
||||
var isToday = false
|
||||
if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) {
|
||||
isToday = true
|
||||
}
|
||||
// 星期几
|
||||
var nWeek = objDate.getDay()
|
||||
var cWeek = this.nStr1[nWeek]
|
||||
// 数字表示周几顺应天朝周一开始的惯例
|
||||
if (nWeek == 0) {
|
||||
nWeek = 7
|
||||
}
|
||||
// 农历年
|
||||
var year = i
|
||||
var leap = this.leapMonth(i) // 闰哪个月
|
||||
var isLeap = false
|
||||
|
||||
// 效验闰月
|
||||
for (i = 1; i < 13 && offset > 0; i++) {
|
||||
// 闰月
|
||||
if (leap > 0 && i == (leap + 1) && isLeap == false) {
|
||||
--i
|
||||
isLeap = true; temp = this.leapDays(year) // 计算农历闰月天数
|
||||
} else {
|
||||
temp = this.monthDays(year, i)// 计算农历普通月天数
|
||||
}
|
||||
// 解除闰月
|
||||
if (isLeap == true && i == (leap + 1)) { isLeap = false }
|
||||
offset -= temp
|
||||
}
|
||||
// 闰月导致数组下标重叠取反
|
||||
if (offset == 0 && leap > 0 && i == leap + 1) {
|
||||
if (isLeap) {
|
||||
isLeap = false
|
||||
} else {
|
||||
isLeap = true; --i
|
||||
}
|
||||
}
|
||||
if (offset < 0) {
|
||||
offset += temp; --i
|
||||
}
|
||||
// 农历月
|
||||
var month = i
|
||||
// 农历日
|
||||
var day = offset + 1
|
||||
// 天干地支处理
|
||||
var sm = m - 1
|
||||
var gzY = this.toGanZhiYear(year)
|
||||
|
||||
// 当月的两个节气
|
||||
// bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
|
||||
var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始
|
||||
var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始
|
||||
|
||||
// 依据12节气修正干支月
|
||||
var gzM = this.toGanZhi((y - 1900) * 12 + m + 11)
|
||||
if (d >= firstNode) {
|
||||
gzM = this.toGanZhi((y - 1900) * 12 + m + 12)
|
||||
}
|
||||
|
||||
// 传入的日期的节气与否
|
||||
var isTerm = false
|
||||
var Term = null
|
||||
if (firstNode == d) {
|
||||
isTerm = true
|
||||
Term = this.solarTerm[m * 2 - 2]
|
||||
}
|
||||
if (secondNode == d) {
|
||||
isTerm = true
|
||||
Term = this.solarTerm[m * 2 - 1]
|
||||
}
|
||||
// 日柱 当月一日与 1900/1/1 相差天数
|
||||
var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10
|
||||
var gzD = this.toGanZhi(dayCyclical + d - 1)
|
||||
// 该日期所属的星座
|
||||
var astro = this.toAstro(m, d)
|
||||
|
||||
return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro }
|
||||
},
|
||||
|
||||
/**
|
||||
* 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
|
||||
* @param y lunar year
|
||||
* @param m lunar month
|
||||
* @param d lunar day
|
||||
* @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
|
||||
* @return JSON object
|
||||
* @eg:console.log(calendar.lunar2solar(1987,9,10));
|
||||
*/
|
||||
lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1
|
||||
var isLeapMonth = !!isLeapMonth
|
||||
var leapOffset = 0
|
||||
var leapMonth = this.leapMonth(y)
|
||||
var leapDay = this.leapDays(y)
|
||||
if (isLeapMonth && (leapMonth != m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
|
||||
if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 超出了最大极限值
|
||||
var day = this.monthDays(y, m)
|
||||
var _day = day
|
||||
// bugFix 2016-9-25
|
||||
// if month is leap, _day use leapDays method
|
||||
if (isLeapMonth) {
|
||||
_day = this.leapDays(y, m)
|
||||
}
|
||||
if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验
|
||||
|
||||
// 计算农历的时间差
|
||||
var offset = 0
|
||||
for (var i = 1900; i < y; i++) {
|
||||
offset += this.lYearDays(i)
|
||||
}
|
||||
var leap = 0; var isAdd = false
|
||||
for (var i = 1; i < m; i++) {
|
||||
leap = this.leapMonth(y)
|
||||
if (!isAdd) { // 处理闰月
|
||||
if (leap <= i && leap > 0) {
|
||||
offset += this.leapDays(y); isAdd = true
|
||||
}
|
||||
}
|
||||
offset += this.monthDays(y, i)
|
||||
}
|
||||
// 转换闰月农历 需补充该年闰月的前一个月的时差
|
||||
if (isLeapMonth) { offset += day }
|
||||
// 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
|
||||
var stmap = Date.UTC(1900, 1, 30, 0, 0, 0)
|
||||
var calObj = new Date((offset + d - 31) * 86400000 + stmap)
|
||||
var cY = calObj.getUTCFullYear()
|
||||
var cM = calObj.getUTCMonth() + 1
|
||||
var cD = calObj.getUTCDate()
|
||||
|
||||
return this.solar2lunar(cY, cM, cD)
|
||||
}
|
||||
}
|
||||
|
||||
export default calendar
|
|
@ -0,0 +1,152 @@
|
|||
<template>
|
||||
<view class="uni-calendar-item__weeks-box" :class="{
|
||||
'uni-calendar-item--disable':weeks.disable,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) ,
|
||||
'uni-calendar-item--multiple': weeks.multiple
|
||||
}"
|
||||
@click="choiceDate(weeks)">
|
||||
<view class="uni-calendar-item__weeks-box-item">
|
||||
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
|
||||
<text class="uni-calendar-item__weeks-box-text" :class="{
|
||||
'uni-calendar-item--isDay-text': weeks.isDay,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
'uni-calendar-item--disable':weeks.disable,
|
||||
}">{{weeks.date}}</text>
|
||||
<text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
}">今天</text>
|
||||
<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
'uni-calendar-item--disable':weeks.disable,
|
||||
}">{{weeks.isDay?'今天': (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text>
|
||||
<text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||
'uni-calendar-item--extra':weeks.extraInfo.info,
|
||||
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||
'uni-calendar-item--multiple': weeks.multiple,
|
||||
'uni-calendar-item--disable':weeks.disable,
|
||||
}">{{weeks.extraInfo.info}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
weeks: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
calendar: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
selected: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
lunar: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
choiceDate(weeks) {
|
||||
this.$emit('change', weeks)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uni-calendar-item__weeks-box {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-box-text {
|
||||
font-size: $uni-font-size-base;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-lunar-text {
|
||||
font-size: $uni-font-size-sm;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-box-item {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-box-circle {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 8px;
|
||||
background-color: $uni-color-error;
|
||||
|
||||
}
|
||||
|
||||
.uni-calendar-item--disable {
|
||||
background-color: rgba(249, 249, 249, $uni-opacity-disabled);
|
||||
color: $uni-text-color-disable;
|
||||
}
|
||||
|
||||
.uni-calendar-item--isDay-text {
|
||||
color: $uni-color-primary;
|
||||
}
|
||||
|
||||
.uni-calendar-item--isDay {
|
||||
background-color: $uni-color-primary;
|
||||
opacity: 0.8;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.uni-calendar-item--extra {
|
||||
color: $uni-color-error;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.uni-calendar-item--checked {
|
||||
background-color: $uni-color-primary;
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.uni-calendar-item--multiple {
|
||||
background-color: $uni-color-primary;
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,434 @@
|
|||
<template>
|
||||
<view class="uni-calendar" @touchmove.stop.prevent="clean">
|
||||
<view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}" @click="clean"></view>
|
||||
<view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}">
|
||||
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
|
||||
<view class="uni-calendar__header-btn-box" @click="close">
|
||||
<text class="uni-calendar__header-text uni-calendar--fixed-width">取消</text>
|
||||
</view>
|
||||
<view class="uni-calendar__header-btn-box" @click="confirm">
|
||||
<text class="uni-calendar__header-text uni-calendar--fixed-width">确定</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-calendar__header">
|
||||
<view class="uni-calendar__header-btn-box" @click="pre">
|
||||
<view class="uni-calendar__header-btn uni-calendar--left"></view>
|
||||
</view>
|
||||
<text class="uni-calendar__header-text">{{ (nowDate.year||'') +'年'+( nowDate.month||'') +'月'}}</text>
|
||||
<view class="uni-calendar__header-btn-box" @click="next">
|
||||
<view class="uni-calendar__header-btn uni-calendar--right"></view>
|
||||
</view>
|
||||
<text class="uni-calendar__backtoday" @click="backtoday">回到今天</text>
|
||||
</view>
|
||||
<view class="uni-calendar__box">
|
||||
<view v-if="showMonth" class="uni-calendar__box-bg">
|
||||
<text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
|
||||
</view>
|
||||
<view class="uni-calendar__weeks">
|
||||
<view class="uni-calendar__weeks-day">
|
||||
<text class="uni-calendar__weeks-day-text">日</text>
|
||||
</view>
|
||||
<view class="uni-calendar__weeks-day">
|
||||
<text class="uni-calendar__weeks-day-text">一</text>
|
||||
</view>
|
||||
<view class="uni-calendar__weeks-day">
|
||||
<text class="uni-calendar__weeks-day-text">二</text>
|
||||
</view>
|
||||
<view class="uni-calendar__weeks-day">
|
||||
<text class="uni-calendar__weeks-day-text">三</text>
|
||||
</view>
|
||||
<view class="uni-calendar__weeks-day">
|
||||
<text class="uni-calendar__weeks-day-text">四</text>
|
||||
</view>
|
||||
<view class="uni-calendar__weeks-day">
|
||||
<text class="uni-calendar__weeks-day-text">五</text>
|
||||
</view>
|
||||
<view class="uni-calendar__weeks-day">
|
||||
<text class="uni-calendar__weeks-day-text">六</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
|
||||
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
|
||||
<uni-calendar-item :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></uni-calendar-item>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Calendar from './util.js';
|
||||
import uniCalendarItem from './uni-calendar-item.vue'
|
||||
export default {
|
||||
components: {
|
||||
uniCalendarItem
|
||||
},
|
||||
props: {
|
||||
/**
|
||||
* 当前日期
|
||||
*/
|
||||
date: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
/**
|
||||
* 打点日期
|
||||
*/
|
||||
selected: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 是否开启阴历日期
|
||||
*/
|
||||
lunar: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
startDate: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
endDate: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
/**
|
||||
* 范围
|
||||
*/
|
||||
range: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
/**
|
||||
* 插入
|
||||
*/
|
||||
insert: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
/**
|
||||
* 是否显示月份背景
|
||||
*/
|
||||
showMonth: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
weeks: [],
|
||||
calendar: {},
|
||||
nowDate: '',
|
||||
aniMaskShow: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
selected(newVal) {
|
||||
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
|
||||
this.weeks = this.cale.weeks
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 获取日历方法实例
|
||||
this.cale = new Calendar({
|
||||
date: this.date,
|
||||
selected: this.selected,
|
||||
startDate: this.startDate,
|
||||
endDate: this.endDate,
|
||||
range: this.range,
|
||||
})
|
||||
this.init(this.cale.date.fullDate)
|
||||
},
|
||||
methods: {
|
||||
// 取消穿透
|
||||
clean() {},
|
||||
init(date) {
|
||||
this.weeks = this.cale.weeks
|
||||
this.nowDate = this.calendar = this.cale.getInfo(date)
|
||||
},
|
||||
open() {
|
||||
this.show = true
|
||||
this.$nextTick(() => {
|
||||
setTimeout(()=>{
|
||||
this.aniMaskShow = true
|
||||
},50)
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.aniMaskShow = false
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.show = false
|
||||
}, 300)
|
||||
})
|
||||
},
|
||||
confirm() {
|
||||
this.setEmit('confirm')
|
||||
this.close()
|
||||
},
|
||||
change() {
|
||||
if (!this.insert) return
|
||||
this.setEmit('change')
|
||||
},
|
||||
monthSwitch() {
|
||||
let {
|
||||
year,
|
||||
month
|
||||
} = this.nowDate
|
||||
this.$emit('monthSwitch', {
|
||||
year,
|
||||
month: Number(month)
|
||||
})
|
||||
},
|
||||
setEmit(name) {
|
||||
let {
|
||||
year,
|
||||
month,
|
||||
date,
|
||||
fullDate,
|
||||
lunar,
|
||||
extraInfo
|
||||
} = this.calendar
|
||||
this.$emit(name, {
|
||||
range: this.cale.multipleStatus,
|
||||
year,
|
||||
month,
|
||||
date,
|
||||
fulldate: fullDate,
|
||||
lunar,
|
||||
extraInfo: extraInfo || {}
|
||||
})
|
||||
},
|
||||
choiceDate(weeks) {
|
||||
if (weeks.disable) return
|
||||
this.calendar = weeks
|
||||
// 设置多选
|
||||
this.cale.setMultiple(this.calendar.fullDate)
|
||||
this.weeks = this.cale.weeks
|
||||
this.change()
|
||||
},
|
||||
backtoday() {
|
||||
this.cale.setDate(this.date)
|
||||
this.weeks = this.cale.weeks
|
||||
this.nowDate = this.calendar = this.cale.getInfo(this.date)
|
||||
this.change()
|
||||
},
|
||||
pre() {
|
||||
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
|
||||
this.setDate(preDate)
|
||||
this.monthSwitch()
|
||||
|
||||
},
|
||||
next() {
|
||||
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
|
||||
this.setDate(nextDate)
|
||||
this.monthSwitch()
|
||||
},
|
||||
setDate(date) {
|
||||
this.cale.setDate(date)
|
||||
this.weeks = this.cale.weeks
|
||||
this.nowDate = this.cale.getInfo(date)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uni-calendar {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.uni-calendar__mask {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: $uni-bg-color-mask;
|
||||
transition-property: opacity;
|
||||
transition-duration: 0.3s;
|
||||
opacity: 0;
|
||||
/* #ifndef APP-NVUE */
|
||||
z-index: 99;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-calendar--mask-show {
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
.uni-calendar--fixed {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transition-property: transform;
|
||||
transition-duration: 0.3s;
|
||||
transform: translateY(460px);
|
||||
/* #ifndef APP-NVUE */
|
||||
z-index: 99;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-calendar--ani-show {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.uni-calendar__content {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.uni-calendar__header {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 50px;
|
||||
border-bottom-color: $uni-border-color;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
|
||||
.uni-calendar--fixed-top {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
border-top-color: $uni-border-color;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.uni-calendar--fixed-width {
|
||||
width: 50px;
|
||||
// padding: 0 15px;
|
||||
}
|
||||
|
||||
.uni-calendar__backtoday {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 25rpx;
|
||||
padding: 0 5px;
|
||||
padding-left: 10px;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
font-size: 12px;
|
||||
border-top-left-radius: 25px;
|
||||
border-bottom-left-radius: 25px;
|
||||
color: $uni-text-color;
|
||||
background-color: $uni-bg-color-hover;
|
||||
}
|
||||
|
||||
.uni-calendar__header-text {
|
||||
text-align: center;
|
||||
width: 100px;
|
||||
font-size: $uni-font-size-base;
|
||||
color: $uni-text-color;
|
||||
}
|
||||
|
||||
.uni-calendar__header-btn-box {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.uni-calendar__header-btn {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-left-color: $uni-text-color-placeholder;
|
||||
border-left-style: solid;
|
||||
border-left-width: 2px;
|
||||
border-top-color: $uni-color-subtitle;
|
||||
border-top-style: solid;
|
||||
border-top-width: 2px;
|
||||
}
|
||||
|
||||
.uni-calendar--left {
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
|
||||
.uni-calendar--right {
|
||||
transform: rotate(135deg);
|
||||
}
|
||||
|
||||
|
||||
.uni-calendar__weeks {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.uni-calendar__weeks-item {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.uni-calendar__weeks-day {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 45px;
|
||||
border-bottom-color: #F5F5F5;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
.uni-calendar__weeks-day-text {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.uni-calendar__box {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uni-calendar__box-bg {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.uni-calendar__box-bg-text {
|
||||
font-size: 200px;
|
||||
font-weight: bold;
|
||||
color: $uni-text-color-grey;
|
||||
opacity: 0.1;
|
||||
text-align: center;
|
||||
/* #ifndef APP-NVUE */
|
||||
line-height: 1;
|
||||
/* #endif */
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,327 @@
|
|||
import CALENDAR from './calendar.js'
|
||||
|
||||
class Calendar {
|
||||
constructor({
|
||||
date,
|
||||
selected,
|
||||
startDate,
|
||||
endDate,
|
||||
range
|
||||
} = {}) {
|
||||
// 当前日期
|
||||
this.date = this.getDate(date) // 当前初入日期
|
||||
// 打点信息
|
||||
this.selected = selected || [];
|
||||
// 范围开始
|
||||
this.startDate = startDate
|
||||
// 范围结束
|
||||
this.endDate = endDate
|
||||
this.range = range
|
||||
// 多选状态
|
||||
this.multipleStatus = {
|
||||
before: '',
|
||||
after: '',
|
||||
data: []
|
||||
}
|
||||
// 每周日期
|
||||
this.weeks = {}
|
||||
|
||||
this._getWeek(this.date.fullDate)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任意时间
|
||||
*/
|
||||
getDate(date, AddDayCount = 0, str = 'day') {
|
||||
if (!date) {
|
||||
date = new Date()
|
||||
}
|
||||
if (typeof date !== 'object') {
|
||||
date = date.replace(/-/g, '/')
|
||||
}
|
||||
const dd = new Date(date)
|
||||
switch (str) {
|
||||
case 'day':
|
||||
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
|
||||
break
|
||||
case 'month':
|
||||
if (dd.getDate() === 31) {
|
||||
dd.setDate(dd.getDate() + AddDayCount)
|
||||
} else {
|
||||
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期
|
||||
}
|
||||
break
|
||||
case 'year':
|
||||
dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
|
||||
break
|
||||
}
|
||||
const y = dd.getFullYear()
|
||||
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
|
||||
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
|
||||
return {
|
||||
fullDate: y + '-' + m + '-' + d,
|
||||
year: y,
|
||||
month: m,
|
||||
date: d,
|
||||
day: dd.getDay()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取上月剩余天数
|
||||
*/
|
||||
_getLastMonthDays(firstDay, full) {
|
||||
let dateArr = []
|
||||
for (let i = firstDay; i > 0; i--) {
|
||||
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate()
|
||||
dateArr.push({
|
||||
date: beforeDate,
|
||||
month: full.month - 1,
|
||||
lunar: this.getlunar(full.year, full.month - 1, beforeDate),
|
||||
disable: true
|
||||
})
|
||||
}
|
||||
return dateArr
|
||||
}
|
||||
/**
|
||||
* 获取本月天数
|
||||
*/
|
||||
_currentMonthDys(dateData, full) {
|
||||
let dateArr = []
|
||||
let fullDate = this.date.fullDate
|
||||
for (let i = 1; i <= dateData; i++) {
|
||||
let isinfo = false
|
||||
let nowDate = full.year + '-' + (full.month < 10 ?
|
||||
full.month : full.month) + '-' + (i < 10 ?
|
||||
'0' + i : i)
|
||||
// 是否今天
|
||||
let isDay = fullDate === nowDate
|
||||
// 获取打点信息
|
||||
let info = this.selected && this.selected.find((item) => {
|
||||
if (this.dateEqual(nowDate, item.date)) {
|
||||
return item
|
||||
}
|
||||
})
|
||||
|
||||
// 日期禁用
|
||||
let disableBefore = true
|
||||
let disableAfter = true
|
||||
if (this.startDate) {
|
||||
let dateCompBefore = this.dateCompare(this.startDate, fullDate)
|
||||
disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
|
||||
}
|
||||
|
||||
if (this.endDate) {
|
||||
let dateCompAfter = this.dateCompare(fullDate, this.endDate)
|
||||
disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
|
||||
}
|
||||
|
||||
let multiples = this.multipleStatus.data
|
||||
let checked = false
|
||||
let multiplesStatus = -1
|
||||
if (this.range) {
|
||||
if (multiples) {
|
||||
multiplesStatus = multiples.findIndex((item) => {
|
||||
return this.dateEqual(item, nowDate)
|
||||
})
|
||||
}
|
||||
if (multiplesStatus !== -1) {
|
||||
checked = true
|
||||
}
|
||||
}
|
||||
|
||||
let data = {
|
||||
fullDate: nowDate,
|
||||
year: full.year,
|
||||
date: i,
|
||||
multiple: this.range ? checked : false,
|
||||
month: full.month,
|
||||
lunar: this.getlunar(full.year, full.month, i),
|
||||
disable: !disableBefore || !disableAfter,
|
||||
isDay
|
||||
}
|
||||
if (info) {
|
||||
data.extraInfo = info
|
||||
}
|
||||
|
||||
dateArr.push(data)
|
||||
}
|
||||
return dateArr
|
||||
}
|
||||
/**
|
||||
* 获取下月天数
|
||||
*/
|
||||
_getNextMonthDays(surplus, full) {
|
||||
let dateArr = []
|
||||
for (let i = 1; i < surplus + 1; i++) {
|
||||
dateArr.push({
|
||||
date: i,
|
||||
month: Number(full.month) + 1,
|
||||
lunar: this.getlunar(full.year, Number(full.month) + 1, i),
|
||||
disable: true
|
||||
})
|
||||
}
|
||||
return dateArr
|
||||
}
|
||||
/**
|
||||
* 设置日期
|
||||
* @param {Object} date
|
||||
*/
|
||||
setDate(date) {
|
||||
this._getWeek(date)
|
||||
}
|
||||
/**
|
||||
* 获取当前日期详情
|
||||
* @param {Object} date
|
||||
*/
|
||||
getInfo(date) {
|
||||
if (!date) {
|
||||
date = new Date()
|
||||
}
|
||||
const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate)
|
||||
return dateInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较时间大小
|
||||
*/
|
||||
dateCompare(startDate, endDate) {
|
||||
// 计算截止时间
|
||||
startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
|
||||
// 计算详细项的截止时间
|
||||
endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
|
||||
if (startDate <= endDate) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较时间是否相等
|
||||
*/
|
||||
dateEqual(before, after) {
|
||||
// 计算截止时间
|
||||
before = new Date(before.replace('-', '/').replace('-', '/'))
|
||||
// 计算详细项的截止时间
|
||||
after = new Date(after.replace('-', '/').replace('-', '/'))
|
||||
if (before.getTime() - after.getTime() === 0) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取日期范围内所有日期
|
||||
* @param {Object} begin
|
||||
* @param {Object} end
|
||||
*/
|
||||
geDateAll(begin, end) {
|
||||
var arr = []
|
||||
var ab = begin.split('-')
|
||||
var ae = end.split('-')
|
||||
var db = new Date()
|
||||
db.setFullYear(ab[0], ab[1] - 1, ab[2])
|
||||
var de = new Date()
|
||||
de.setFullYear(ae[0], ae[1] - 1, ae[2])
|
||||
var unixDb = db.getTime() - 24 * 60 * 60 * 1000
|
||||
var unixDe = de.getTime() - 24 * 60 * 60 * 1000
|
||||
for (var k = unixDb; k <= unixDe;) {
|
||||
k = k + 24 * 60 * 60 * 1000
|
||||
arr.push(this.getDate(new Date(parseInt(k))).fullDate)
|
||||
}
|
||||
return arr
|
||||
}
|
||||
/**
|
||||
* 计算阴历日期显示
|
||||
*/
|
||||
getlunar(year, month, date) {
|
||||
return CALENDAR.solar2lunar(year, month, date)
|
||||
}
|
||||
/**
|
||||
* 设置打点
|
||||
*/
|
||||
setSelectInfo(data, value) {
|
||||
this.selected = value
|
||||
this._getWeek(data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多选状态
|
||||
*/
|
||||
setMultiple(fullDate) {
|
||||
let {
|
||||
before,
|
||||
after
|
||||
} = this.multipleStatus
|
||||
if (!this.range) return
|
||||
if (before && after) {
|
||||
this.multipleStatus.before = ''
|
||||
this.multipleStatus.after = ''
|
||||
this.multipleStatus.data = []
|
||||
this._getWeek(fullDate)
|
||||
} else {
|
||||
if (!before) {
|
||||
this.multipleStatus.before = fullDate
|
||||
} else {
|
||||
this.multipleStatus.after = fullDate
|
||||
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
||||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
||||
} else {
|
||||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
||||
}
|
||||
this._getWeek(fullDate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取每周数据
|
||||
* @param {Object} dateData
|
||||
*/
|
||||
_getWeek(dateData) {
|
||||
const {
|
||||
fullDate,
|
||||
year,
|
||||
month,
|
||||
date,
|
||||
day
|
||||
} = this.getDate(dateData)
|
||||
let firstDay = new Date(year, month - 1, 1).getDay()
|
||||
let currentDay = new Date(year, month, 0).getDate()
|
||||
let dates = {
|
||||
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天
|
||||
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数
|
||||
nextMonthDays: [], // 下个月开始几天
|
||||
weeks: []
|
||||
}
|
||||
let canlender = []
|
||||
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length)
|
||||
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData))
|
||||
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays)
|
||||
let weeks = {}
|
||||
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天
|
||||
for (let i = 0; i < canlender.length; i++) {
|
||||
if (i % 7 === 0) {
|
||||
weeks[parseInt(i / 7)] = new Array(7)
|
||||
}
|
||||
weeks[parseInt(i / 7)][i % 7] = canlender[i]
|
||||
}
|
||||
this.canlender = canlender
|
||||
this.weeks = weeks
|
||||
}
|
||||
|
||||
//静态方法
|
||||
// static init(date) {
|
||||
// if (!this.instance) {
|
||||
// this.instance = new Calendar(date);
|
||||
// }
|
||||
// return this.instance;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
export default Calendar
|
|
@ -0,0 +1,133 @@
|
|||
<template>
|
||||
<view class="evaluateWtapper">
|
||||
<view class="evaluateItem" v-for="(item, indexw) in reply" :key="indexw">
|
||||
<view class="pic-text acea-row row-middle">
|
||||
<view class="pictrue">
|
||||
<image :src="item.avatar"></image>
|
||||
</view>
|
||||
<view class="acea-row row-middle">
|
||||
<view class="name line1">{{ item.nickname }}</view>
|
||||
<view class="start" :class="'star' + Math.round((item.productScore+item.serviceScore)/2)"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="time">{{ item.createTime }} {{ item.suk }}</view>
|
||||
<view class="evaluate-infor">{{ item.comment }}</view>
|
||||
<view class="imgList acea-row">
|
||||
<view class="pictrue" v-for="(itemn, indexn) in item.pics" :key="indexn">
|
||||
<image :src="itemn" class="image" @click='getpreviewImage(indexw, indexn)'></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="reply" v-if="item.merchantReplyContent">
|
||||
<text class="font-color">店小二</text>:{{
|
||||
item.merchantReplyContent
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
reply: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data: function() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
getpreviewImage: function(indexw, indexn) {
|
||||
uni.previewImage({
|
||||
urls: this.reply[indexw].pics,
|
||||
current: this.reply[indexw].pics[indexn]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang='scss'>
|
||||
.evaluateWtapper .evaluateItem {
|
||||
background-color: #fff;
|
||||
padding-bottom: 25rpx;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem~.evaluateItem {
|
||||
border-top: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .pic-text {
|
||||
font-size: 26rpx;
|
||||
color: #282828;
|
||||
height: 95rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .pic-text .pictrue {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .pic-text .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .pic-text .name {
|
||||
max-width: 450rpx;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .time {
|
||||
font-size: 24rpx;
|
||||
color: #82848f;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .evaluate-infor {
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
margin-top: 19rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .imgList {
|
||||
padding: 0 30rpx 0 15rpx;
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .imgList .pictrue {
|
||||
width: 156rpx;
|
||||
height: 156rpx;
|
||||
margin: 0 0 15rpx 15rpx;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .imgList .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .reply {
|
||||
font-size: 26rpx;
|
||||
color: #454545;
|
||||
background-color: #f7f7f7;
|
||||
border-radius: 5rpx;
|
||||
margin: 20rpx 30rpx 0 30rpx;
|
||||
padding: 30rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .reply::before {
|
||||
content: "";
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 20rpx solid transparent;
|
||||
border-right: 20rpx solid transparent;
|
||||
border-bottom: 30rpx solid #f7f7f7;
|
||||
position: absolute;
|
||||
top: -30rpx;
|
||||
left: 40rpx;
|
||||
}
|
||||
</style>
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,139 @@
|
|||
/* eslint-disable */
|
||||
var provinceData = [{
|
||||
"label": "北京市",
|
||||
"value": "11"
|
||||
},
|
||||
{
|
||||
"label": "天津市",
|
||||
"value": "12"
|
||||
},
|
||||
{
|
||||
"label": "河北省",
|
||||
"value": "13"
|
||||
},
|
||||
{
|
||||
"label": "山西省",
|
||||
"value": "14"
|
||||
},
|
||||
{
|
||||
"label": "内蒙古自治区",
|
||||
"value": "15"
|
||||
},
|
||||
{
|
||||
"label": "辽宁省",
|
||||
"value": "21"
|
||||
},
|
||||
{
|
||||
"label": "吉林省",
|
||||
"value": "22"
|
||||
},
|
||||
{
|
||||
"label": "黑龙江省",
|
||||
"value": "23"
|
||||
},
|
||||
{
|
||||
"label": "上海市",
|
||||
"value": "31"
|
||||
},
|
||||
{
|
||||
"label": "江苏省",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"label": "浙江省",
|
||||
"value": "33"
|
||||
},
|
||||
{
|
||||
"label": "安徽省",
|
||||
"value": "34"
|
||||
},
|
||||
{
|
||||
"label": "福建省",
|
||||
"value": "35"
|
||||
},
|
||||
{
|
||||
"label": "江西省",
|
||||
"value": "36"
|
||||
},
|
||||
{
|
||||
"label": "山东省",
|
||||
"value": "37"
|
||||
},
|
||||
{
|
||||
"label": "河南省",
|
||||
"value": "41"
|
||||
},
|
||||
{
|
||||
"label": "湖北省",
|
||||
"value": "42"
|
||||
},
|
||||
{
|
||||
"label": "湖南省",
|
||||
"value": "43"
|
||||
},
|
||||
{
|
||||
"label": "广东省",
|
||||
"value": "44"
|
||||
},
|
||||
{
|
||||
"label": "广西壮族自治区",
|
||||
"value": "45"
|
||||
},
|
||||
{
|
||||
"label": "海南省",
|
||||
"value": "46"
|
||||
},
|
||||
{
|
||||
"label": "重庆市",
|
||||
"value": "50"
|
||||
},
|
||||
{
|
||||
"label": "四川省",
|
||||
"value": "51"
|
||||
},
|
||||
{
|
||||
"label": "贵州省",
|
||||
"value": "52"
|
||||
},
|
||||
{
|
||||
"label": "云南省",
|
||||
"value": "53"
|
||||
},
|
||||
{
|
||||
"label": "西藏自治区",
|
||||
"value": "54"
|
||||
},
|
||||
{
|
||||
"label": "陕西省",
|
||||
"value": "61"
|
||||
},
|
||||
{
|
||||
"label": "甘肃省",
|
||||
"value": "62"
|
||||
},
|
||||
{
|
||||
"label": "青海省",
|
||||
"value": "63"
|
||||
},
|
||||
{
|
||||
"label": "宁夏回族自治区",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"label": "新疆维吾尔自治区",
|
||||
"value": "65"
|
||||
},
|
||||
{
|
||||
"label": "台湾",
|
||||
"value": "66"
|
||||
},
|
||||
{
|
||||
"label": "香港",
|
||||
"value": "67"
|
||||
},
|
||||
{
|
||||
"label": "澳门",
|
||||
"value": "68"
|
||||
}
|
||||
]
|
||||
export default provinceData;
|
|
@ -0,0 +1,681 @@
|
|||
const forMatNum=(num)=>{
|
||||
return num<10?'0'+num:num+'';
|
||||
}
|
||||
const initPicker={
|
||||
//日期
|
||||
date:{
|
||||
init(start,end,mode="date",step,value,flag,disabled,hasSecond){
|
||||
let aToday=new Date();
|
||||
let tYear,tMonth,tDay,tHours,tMinutes,tSeconds,defaultVal=[];
|
||||
let initstartDate=new Date(start.toString());
|
||||
let endDate=new Date(end.toString());
|
||||
if(start>end){
|
||||
initstartDate=new Date(end.toString());
|
||||
endDate=new Date(start.toString());
|
||||
};
|
||||
let startYear=initstartDate.getFullYear();
|
||||
let startMonth=initstartDate.getMonth()+1;
|
||||
let endYear=endDate.getFullYear();
|
||||
let years=[],months=[],days=[],hours=[],minutes=[],seconds=[],areas=[],returnArr=[],dvalDate=[];
|
||||
switch(mode){
|
||||
case "half":
|
||||
dvalDate=flag?[...value.split(" ")[0].split("-"),...value.split(" ")[1].split(":")]:[...value.split(" ")[0].split("-"),value.split(" ")[1]];
|
||||
break;
|
||||
case "date":
|
||||
case "yearMonth":
|
||||
dvalDate=value.split("-");
|
||||
break;
|
||||
case "dateTime":
|
||||
dvalDate=[...value.split(" ")[0].split("-"),...value.split(" ")[1].split(":")];
|
||||
break;
|
||||
case "time":
|
||||
dvalDate=value.split(":");
|
||||
break;
|
||||
}
|
||||
let curMonth=flag?dvalDate[1]*1:(dvalDate[1]+1);
|
||||
let dYear=aToday.getFullYear();
|
||||
let dMonth=aToday.getMonth()+1;
|
||||
let dDate=aToday.getDate();
|
||||
let totalDays=new Date(startYear,curMonth,0).getDate();
|
||||
let dvalObj={};
|
||||
switch(mode){
|
||||
case "half":
|
||||
case "date":
|
||||
case "yearMonth":
|
||||
let curYear=dvalDate[0];
|
||||
let curMonth=dvalDate[1];
|
||||
if(disabled){
|
||||
for(let s=startYear;s<=dYear;s++){
|
||||
years.push(s+'');
|
||||
};
|
||||
if(curYear==dYear){
|
||||
for(let m=1;m<=dMonth;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
}else{
|
||||
for(let m=1;m<=12;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
}
|
||||
if(curMonth==dMonth){
|
||||
for(let d=1;d<=dDate;d++){
|
||||
days.push(forMatNum(d));
|
||||
}
|
||||
}else{
|
||||
for(let d=1;d<=totalDays;d++){
|
||||
days.push(forMatNum(d));
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
for(let s=startYear;s<=endYear;s++){
|
||||
years.push(s+'');
|
||||
};
|
||||
for(let m=1;m<=12;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
for(let d=1;d<=totalDays;d++){
|
||||
days.push(forMatNum(d));
|
||||
}
|
||||
};
|
||||
break;
|
||||
default:
|
||||
for(let s=startYear;s<=endYear;s++){
|
||||
years.push(s+'');
|
||||
};
|
||||
for(let m=1;m<=12;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
for(let d=1;d<=totalDays;d++){
|
||||
days.push(forMatNum(d));
|
||||
}
|
||||
break;
|
||||
}
|
||||
for(let h=0;h<24;h++){
|
||||
hours.push(forMatNum(h));
|
||||
}
|
||||
for(let m=0;m<60;m+=step*1){
|
||||
minutes.push(forMatNum(m));
|
||||
}
|
||||
for(let s=0;s<60;s++){
|
||||
seconds.push(forMatNum(s));
|
||||
}
|
||||
if(flag){
|
||||
returnArr=[
|
||||
years.indexOf(dvalDate[0]),
|
||||
months.indexOf(dvalDate[1]),
|
||||
days.indexOf(dvalDate[2]),
|
||||
hours.indexOf(dvalDate[3]),
|
||||
minutes.indexOf(dvalDate[4])==-1?0:minutes.indexOf(dvalDate[4]),
|
||||
seconds.indexOf(dvalDate[5])
|
||||
]
|
||||
}
|
||||
switch(mode){
|
||||
case "date":
|
||||
if(flag){
|
||||
defaultVal=[returnArr[0],returnArr[1],returnArr[2]];
|
||||
return {years,months,days,defaultVal}
|
||||
}else{
|
||||
defaultVal=[
|
||||
years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
|
||||
months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1]),
|
||||
days.indexOf(dvalDate[2])==-1?0:days.indexOf(dvalDate[2])
|
||||
];
|
||||
return {years,months,days,defaultVal}
|
||||
}
|
||||
break;
|
||||
case "half":
|
||||
areas=[{
|
||||
label:"上午",
|
||||
value:0
|
||||
},{
|
||||
label:"下午",
|
||||
value:1
|
||||
}];
|
||||
if(flag){
|
||||
defaultVal=[returnArr[0],returnArr[1],returnArr[2],returnArr[3]];
|
||||
return {years,months,days,areas,defaultVal}
|
||||
}else{
|
||||
let idx=0;
|
||||
areas.map((v,k)=>{
|
||||
if(v.label==dvalDate[3]){
|
||||
idx=v.value;
|
||||
}
|
||||
})
|
||||
defaultVal=[
|
||||
years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
|
||||
months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1]),
|
||||
days.indexOf(dvalDate[2])==-1?0:days.indexOf(dvalDate[2]),
|
||||
idx
|
||||
];
|
||||
return {years,months,days,areas,defaultVal}
|
||||
}
|
||||
break;
|
||||
case "yearMonth":
|
||||
if(flag){
|
||||
defaultVal=[returnArr[0],returnArr[1]];
|
||||
return {years,months,defaultVal}
|
||||
}else{
|
||||
defaultVal=[
|
||||
years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
|
||||
months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1])
|
||||
];
|
||||
return {years,months,defaultVal}
|
||||
}
|
||||
break;
|
||||
case "dateTime":
|
||||
if(flag){
|
||||
defaultVal=returnArr;
|
||||
}else{
|
||||
if(hasSecond){
|
||||
defaultVal=[
|
||||
years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
|
||||
months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1]),
|
||||
days.indexOf(dvalDate[2])==-1?0:days.indexOf(dvalDate[2]),
|
||||
hours.indexOf(dvalDate[3])==-1?0:hours.indexOf(dvalDate[3]),
|
||||
minutes.indexOf(dvalDate[4])==-1?0:minutes.indexOf(dvalDate[4]),
|
||||
seconds.indexOf(dvalDate[5])==-1?0:seconds.indexOf(dvalDate[5])
|
||||
];
|
||||
}else{
|
||||
defaultVal=[
|
||||
years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
|
||||
months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1]),
|
||||
days.indexOf(dvalDate[2])==-1?0:days.indexOf(dvalDate[2]),
|
||||
hours.indexOf(dvalDate[3])==-1?0:hours.indexOf(dvalDate[3]),
|
||||
minutes.indexOf(dvalDate[4])==-1?0:minutes.indexOf(dvalDate[4])
|
||||
];
|
||||
}
|
||||
}
|
||||
if(hasSecond){
|
||||
return {years,months,days,hours,minutes,seconds,defaultVal}
|
||||
}else{
|
||||
return {years,months,days,hours,minutes,defaultVal}
|
||||
}
|
||||
break;
|
||||
case "time":
|
||||
if(flag){
|
||||
defaultVal=[returnArr[3],returnArr[4],returnArr[5]];
|
||||
}else{
|
||||
if(hasSecond){
|
||||
defaultVal=[
|
||||
hours.indexOf(dvalDate[0])==-1?0:hours.indexOf(dvalDate[0]),
|
||||
minutes.indexOf(dvalDate[1])==-1?0:minutes.indexOf(dvalDate[1]),
|
||||
seconds.indexOf(dvalDate[2])==-1?0:seconds.indexOf(dvalDate[2])
|
||||
];
|
||||
}else{
|
||||
defaultVal=[
|
||||
hours.indexOf(dvalDate[0])==-1?0:hours.indexOf(dvalDate[0]),
|
||||
minutes.indexOf(dvalDate[1])==-1?0:minutes.indexOf(dvalDate[1])
|
||||
];
|
||||
}
|
||||
}
|
||||
return {hours,minutes,seconds,defaultVal}
|
||||
break;
|
||||
}
|
||||
},
|
||||
initMonths:(year,disabled)=>{
|
||||
let aDate=new Date();
|
||||
let dYear=aDate.getFullYear();
|
||||
let dMonth=aDate.getMonth()+1;
|
||||
let dDate=aDate.getDate();
|
||||
let flag=dYear==year?true:false;
|
||||
let months=[];
|
||||
if(disabled){
|
||||
if(flag){
|
||||
for(let m=1;m<=dMonth;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
}else{
|
||||
for(let m=1;m<=12;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
}
|
||||
}else{
|
||||
for(let m=1;m<=12;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
};
|
||||
return months;
|
||||
},
|
||||
initDays:(year,month,disabled)=>{
|
||||
let aDate=new Date();
|
||||
let dYear=aDate.getFullYear();
|
||||
let dMonth=aDate.getMonth()+1;
|
||||
let dDate=aDate.getDate();
|
||||
let flag=(dYear==year&&dMonth==month)?true:false;
|
||||
let totalDays=new Date(year,month,0).getDate();
|
||||
let dates=[];
|
||||
if(flag&&disabled){
|
||||
for(let d=1;d<=dDate;d++){
|
||||
dates.push(forMatNum(d));
|
||||
};
|
||||
}else{
|
||||
for(let d=1;d<=totalDays;d++){
|
||||
dates.push(forMatNum(d));
|
||||
};
|
||||
};
|
||||
return dates;
|
||||
},
|
||||
},
|
||||
//短期日期上下午
|
||||
limitHour:{
|
||||
init(dayStep=7,dVal){
|
||||
let startDate=new Date();
|
||||
let date=[],areas=[],hours=[];
|
||||
let hour=new Date().getHours();
|
||||
let weeks=["周日","周一","周二","周三","周四","周五","周六"];
|
||||
let arrs=[];
|
||||
let defaultVal=[];
|
||||
let d=0,a=0,h=0;
|
||||
for(let i=0;i<dayStep;i++){
|
||||
let year,month,day,weekday;
|
||||
year=startDate.getFullYear();
|
||||
month=forMatNum(startDate.getMonth()+1);
|
||||
day=forMatNum(startDate.getDate());
|
||||
weekday=weeks[startDate.getDay()];
|
||||
let label="";
|
||||
switch(i){
|
||||
case 0:
|
||||
label="今天";
|
||||
break;
|
||||
case 1:
|
||||
label="明天"
|
||||
break;
|
||||
case 2:
|
||||
label="后天"
|
||||
break;
|
||||
default:
|
||||
label=month+"月"+day+"日"+" "+weekday;
|
||||
break;
|
||||
}
|
||||
date.push({
|
||||
label:label,
|
||||
value:year+"-"+month+"-"+day,
|
||||
today:i==0?true:false
|
||||
})
|
||||
startDate.setDate(startDate.getDate()+1);
|
||||
}
|
||||
if(hour>12){
|
||||
areas=[{
|
||||
label:"下午",
|
||||
value:1
|
||||
}]
|
||||
}else{
|
||||
areas=[{
|
||||
label:"上午",
|
||||
value:0
|
||||
},{
|
||||
label:"下午",
|
||||
value:1
|
||||
}]
|
||||
};
|
||||
for(let k=hour>12?hour-12:hour;k<=12;k++){
|
||||
hours.push({
|
||||
label:forMatNum(k),
|
||||
value:forMatNum(hour>12?k+12:k)
|
||||
})
|
||||
};
|
||||
date.map((v,k)=>{
|
||||
if(v.label==dVal[0]){
|
||||
d=k
|
||||
}
|
||||
})
|
||||
if(d!=0){
|
||||
areas=this.initAreas(date[d]);
|
||||
hours=this.initHours(date[d],areas[a]);
|
||||
}
|
||||
areas.map((v,k)=>{
|
||||
if(v.label==dVal[1]){
|
||||
a=k
|
||||
}
|
||||
})
|
||||
hours.map((v,k)=>{
|
||||
if(v.label==dVal[2]){
|
||||
h=k
|
||||
}
|
||||
});
|
||||
defaultVal=[d,a,h]
|
||||
return {date,areas,hours,defaultVal};
|
||||
},
|
||||
initAreas(date){
|
||||
let areas=[];
|
||||
let hour=new Date().getHours();
|
||||
if(date.today){
|
||||
if(hour>12){
|
||||
areas=[{
|
||||
label:"下午",
|
||||
value:1
|
||||
}]
|
||||
}else{
|
||||
areas=[{
|
||||
label:"上午",
|
||||
value:0
|
||||
},{
|
||||
label:"下午",
|
||||
value:1
|
||||
}]
|
||||
};
|
||||
}else{
|
||||
areas=[{
|
||||
label:"上午",
|
||||
value:0
|
||||
},{
|
||||
label:"下午",
|
||||
value:1
|
||||
}]
|
||||
}
|
||||
return areas;
|
||||
},
|
||||
initHours(dateCol,hourCol){
|
||||
let hours=[];
|
||||
let hour=new Date().getHours();
|
||||
if(dateCol.today){
|
||||
if(hourCol.value==1&&hour<=12){
|
||||
for(let k=1;k<=12;k++){
|
||||
hours.push({
|
||||
label:forMatNum(k),
|
||||
value:forMatNum(hourCol.value==1?k+12:k)
|
||||
})
|
||||
};
|
||||
}else{
|
||||
for(let k=hour>12?hour-12:hour;k<=12;k++){
|
||||
hours.push({
|
||||
label:forMatNum(k),
|
||||
value:forMatNum(hourCol.value==1?k+12:k)
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
}else{
|
||||
for(let k=1;k<=12;k++){
|
||||
hours.push({
|
||||
label:forMatNum(k),
|
||||
value:forMatNum(hourCol.value==1?k+12:k)
|
||||
})
|
||||
};
|
||||
};
|
||||
return hours
|
||||
}
|
||||
},
|
||||
//短期日期时间初始化
|
||||
limit:{
|
||||
init(dayStep=7,startHour=8,endHour=20,minuteStep=1,afterStep=30,dVal){
|
||||
let startDate=new Date();
|
||||
let bsDate=new Date(new Date().getTime()+afterStep*60*1000);
|
||||
let date=[],hours=[],minutes=[];
|
||||
let hour=bsDate.getHours();
|
||||
let minute=Math.floor(bsDate.getMinutes()/minuteStep)*minuteStep;
|
||||
let weeks=["周日","周一","周二","周三","周四","周五","周六"];
|
||||
let d=0,h=0,m=0;
|
||||
let defaultVal=[];
|
||||
for(let i=0;i<dayStep;i++){
|
||||
let year,month,day,weekday;
|
||||
year=startDate.getFullYear();
|
||||
month=forMatNum(startDate.getMonth()+1);
|
||||
day=forMatNum(startDate.getDate());
|
||||
weekday=weeks[startDate.getDay()];
|
||||
let label="";
|
||||
switch(i){
|
||||
case 0:
|
||||
label="今天";
|
||||
break;
|
||||
case 1:
|
||||
label="明天"
|
||||
break;
|
||||
case 2:
|
||||
label="后天"
|
||||
break;
|
||||
default:
|
||||
label=month+"月"+day+"日"+" "+weekday;
|
||||
break;
|
||||
}
|
||||
date.push({
|
||||
label:label,
|
||||
value:year+"-"+month+"-"+day,
|
||||
flag:i==0?true:false
|
||||
})
|
||||
startDate.setDate(startDate.getDate()+1);
|
||||
}
|
||||
if(hour<startHour){
|
||||
hour=startHour;
|
||||
};
|
||||
if(hour>endHour){
|
||||
hour=endHour;
|
||||
};
|
||||
for(let k=hour*1;k<=endHour*1;k++){
|
||||
hours.push({
|
||||
label:forMatNum(k),
|
||||
value:forMatNum(k),
|
||||
flag:k==hour?true:false
|
||||
})
|
||||
};
|
||||
for(let j=minute;j<60;j+=minuteStep*1){
|
||||
minutes.push({
|
||||
label:forMatNum(j),
|
||||
value:forMatNum(j)
|
||||
});
|
||||
}
|
||||
date.map((v,k)=>{
|
||||
if(v.label==dVal[0]){
|
||||
d=k
|
||||
}
|
||||
})
|
||||
if(d!=0){
|
||||
hours=this.initHours(startHour=8,endHour=20,minuteStep=1,afterStep=30,date[d].value);
|
||||
}
|
||||
hours.map((v,k)=>{
|
||||
if(v.label==dVal[1]){
|
||||
h=k
|
||||
}
|
||||
})
|
||||
minutes.map((v,k)=>{
|
||||
if(v.label==dVal[2]){
|
||||
m=k
|
||||
}
|
||||
})
|
||||
defaultVal=[d,h,m];
|
||||
return {date,hours,minutes,defaultVal};
|
||||
},
|
||||
initHours(startHour=8,endHour=20,minuteStep=1,afterStep=30,date){
|
||||
let hours=[];
|
||||
let arr=date.split("-");
|
||||
let aDate=new Date();
|
||||
let dYear=aDate.getFullYear();
|
||||
let dMonth=aDate.getMonth()+1;
|
||||
let dDate=aDate.getDate();
|
||||
let bsDate=new Date(new Date().getTime()+afterStep*60*1000);
|
||||
let hour=bsDate.getHours();
|
||||
let flag=(dYear==arr[0]&&dMonth==arr[1]&&dDate==arr[2])?true:false;
|
||||
if(hour>endHour){
|
||||
hour=endHour;
|
||||
};
|
||||
if(flag){
|
||||
for(let k=hour*1;k<=endHour*1;k++){
|
||||
hours.push({
|
||||
label:forMatNum(k),
|
||||
value:forMatNum(k),
|
||||
flag:k==hour?true:false
|
||||
})
|
||||
};
|
||||
}else{
|
||||
for(let k=startHour*1;k<=endHour*1;k++){
|
||||
hours.push({
|
||||
label:forMatNum(k),
|
||||
value:forMatNum(k),
|
||||
flag:false
|
||||
})
|
||||
}
|
||||
};
|
||||
return hours;
|
||||
},
|
||||
initMinutes(startHour=8,endHour=20,minuteStep=1,afterStep=30,date,hour){
|
||||
let minutes=[];
|
||||
let bsDate=new Date(new Date().getTime()+afterStep*60*1000);
|
||||
let arr=date.split("-");
|
||||
let aDate=new Date();
|
||||
let dYear=aDate.getFullYear();
|
||||
let dMonth=aDate.getMonth()+1;
|
||||
let dDate=aDate.getDate();
|
||||
let dHour=bsDate.getHours();;
|
||||
let minute=Math.floor(bsDate.getMinutes()/minuteStep)*minuteStep;
|
||||
let flag=(dYear==arr[0]&&dMonth==arr[1]&&dDate==arr[2])?true:false;
|
||||
if(flag){
|
||||
if(hour==dHour){
|
||||
for(let j=minute;j<60;j+=minuteStep*1){
|
||||
minutes.push({
|
||||
label:forMatNum(j),
|
||||
value:forMatNum(j)
|
||||
});
|
||||
}
|
||||
}else{
|
||||
for(let j=0;j<60;j+=minuteStep*1){
|
||||
minutes.push({
|
||||
label:forMatNum(j),
|
||||
value:forMatNum(j)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
for(let j=0;j<60;j+=minuteStep*1){
|
||||
minutes.push({
|
||||
label:forMatNum(j),
|
||||
value:forMatNum(j)
|
||||
})
|
||||
}
|
||||
}
|
||||
return minutes;
|
||||
}
|
||||
},
|
||||
//选择区间初始化
|
||||
range:{
|
||||
init(start,end,value,flag){
|
||||
let aToday=new Date();
|
||||
let tYear,tMonth,tDay,tHours,tMinutes,tSeconds,defaultVal=[];
|
||||
let initstartDate=new Date(start.toString());
|
||||
let endDate=new Date(end.toString());
|
||||
if(start>end){
|
||||
initstartDate=new Date(end.toString());
|
||||
endDate=new Date(start.toString());
|
||||
};
|
||||
let startYear=initstartDate.getFullYear();
|
||||
let startMonth=initstartDate.getMonth()+1;
|
||||
let endYear=endDate.getFullYear();
|
||||
let fyears=[],fmonths=[],fdays=[],tyears=[],tmonths=[],tdays=[],returnArr=[],startDVal=[],endDVal=[];
|
||||
startDVal=value[0].split("-");
|
||||
endDVal=value[1].split("-");
|
||||
let curMonth=flag?startDVal[1]*1:(startDVal[1]+1);
|
||||
let totalDays=new Date(startYear,curMonth,0).getDate();
|
||||
for(let s=startYear;s<=endYear;s++){
|
||||
fyears.push(s+'');
|
||||
};
|
||||
for(let m=1;m<=12;m++){
|
||||
fmonths.push(forMatNum(m));
|
||||
};
|
||||
for(let d=1;d<=totalDays;d++){
|
||||
fdays.push(forMatNum(d));
|
||||
};
|
||||
for(let s=startDVal[0];s<=endYear;s++){
|
||||
tyears.push(s+'');
|
||||
};
|
||||
if(endDVal[0]>startDVal[0]){
|
||||
for(let m=1;m<=12;m++){
|
||||
tmonths.push(forMatNum(m));
|
||||
};
|
||||
for(let d=1;d<=totalDays;d++){
|
||||
tdays.push(forMatNum(d));
|
||||
};
|
||||
}else{
|
||||
for(let m=startDVal[1];m<=12;m++){
|
||||
tmonths.push(forMatNum(m));
|
||||
};
|
||||
for(let d=startDVal[2];d<=totalDays;d++){
|
||||
tdays.push(forMatNum(d));
|
||||
};
|
||||
};
|
||||
|
||||
defaultVal=[
|
||||
fyears.indexOf(startDVal[0])==-1?0:fyears.indexOf(startDVal[0]),
|
||||
fmonths.indexOf(startDVal[1])==-1?0:fmonths.indexOf(startDVal[1]),
|
||||
fdays.indexOf(startDVal[2])==-1?0:fdays.indexOf(startDVal[2]),
|
||||
0,
|
||||
tyears.indexOf(endDVal[0])==-1?0:tyears.indexOf(endDVal[0]),
|
||||
tmonths.indexOf(endDVal[1])==-1?0:tmonths.indexOf(endDVal[1]),
|
||||
tdays.indexOf(endDVal[2])==-1?0:tdays.indexOf(endDVal[2])
|
||||
];
|
||||
return {
|
||||
fyears,
|
||||
fmonths,
|
||||
fdays,
|
||||
tyears,
|
||||
tmonths,
|
||||
tdays,
|
||||
defaultVal
|
||||
}
|
||||
},
|
||||
initStartDays(year,month){
|
||||
let totalDays=new Date(year,month,0).getDate();
|
||||
let dates=[];
|
||||
for(let d=1;d<=totalDays;d++){
|
||||
dates.push(forMatNum(d));
|
||||
};
|
||||
return dates;
|
||||
},
|
||||
initEndYears(curYear,startYear,endYear){
|
||||
let years=[];
|
||||
for(let y=curYear;y<=endYear;y++){
|
||||
years.push(forMatNum(y));
|
||||
};
|
||||
return years;
|
||||
},
|
||||
initEndMonths(curMonth){
|
||||
let months=[];
|
||||
for(let m=curMonth*1;m<=12;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
return months;
|
||||
},
|
||||
initEndDays(curYear,curMonth,curDate,tYear,tMonth){
|
||||
let totalDays=new Date(curYear,curMonth,0).getDate();
|
||||
let days=[];
|
||||
for(let d=curDate*1;d<=totalDays;d++){
|
||||
days.push(forMatNum(d));
|
||||
};
|
||||
return days;
|
||||
},
|
||||
initToMonths(curYear,curMonth,curDate,tYear){
|
||||
let aDate=new Date(curYear,curMonth,curDate).getTime();
|
||||
let bDate=new Date(tYear,curMonth,curDate).getTime();
|
||||
let months=[];
|
||||
if(bDate-aDate>0){
|
||||
console.log(1)
|
||||
for(let m=1;m<=12;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
}else{
|
||||
for(let m=curMonth*1;m<=12;m++){
|
||||
months.push(forMatNum(m));
|
||||
};
|
||||
}
|
||||
return months;
|
||||
},
|
||||
initToDays(curYear,curMonth,curDate,tYear,tMonth){
|
||||
let aDate=new Date(curYear,curMonth,curDate).getTime();
|
||||
let bDate=new Date(tYear,tMonth,curDate).getTime();
|
||||
let totalDays=new Date(tYear,tMonth,0).getDate();
|
||||
let days=[];
|
||||
if(bDate-aDate>0){
|
||||
for(let d=1;d<=totalDays;d++){
|
||||
days.push(forMatNum(d));
|
||||
};
|
||||
}else{
|
||||
for(let d=curDate*1;d<=totalDays;d++){
|
||||
days.push(forMatNum(d));
|
||||
};
|
||||
}
|
||||
return days;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default initPicker
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,29 @@
|
|||
|
||||
var josn=require('../../domain.json')
|
||||
let domain = josn.domain
|
||||
|
||||
module.exports = {
|
||||
// 请求域名 格式: https://您的域名
|
||||
// #ifdef MP
|
||||
// HTTP_REQUEST_URL:'',
|
||||
HTTP_REQUEST_URL:domain,
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
//H5接口是浏览器地址
|
||||
// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
|
||||
// http://api.java.crmeb.net:20001
|
||||
HTTP_REQUEST_URL:domain,
|
||||
// #endif
|
||||
|
||||
HEADER:{
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
HEADERPARAMS:{
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
// 回话密钥名称 请勿修改此配置
|
||||
TOKENNAME: 'Authori-zation',
|
||||
// 缓存时间 0 永久
|
||||
EXPIRE:0,
|
||||
};
|
|
@ -0,0 +1,32 @@
|
|||
module.exports = {
|
||||
//token
|
||||
LOGIN_STATUS: 'LOGIN_STATUS_TOKEN',
|
||||
// uid
|
||||
UID:'UID',
|
||||
//<2F>û<EFBFBD>
|
||||
USER_INFO: 'USER_INFO',
|
||||
//token<65><6E><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
EXPIRES_TIME: 'EXPIRES_TIME',
|
||||
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ȩ
|
||||
WX_AUTH: 'WX_AUTH',
|
||||
//<2F><><EFBFBD>ں<EFBFBD><DABA><EFBFBD>Ȩcode
|
||||
STATE_KEY: 'wx_authorize_state',
|
||||
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
LOGINTYPE: 'loginType',
|
||||
//<2F><><EFBFBD>ں<EFBFBD><DABA><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
||||
BACK_URL: 'login_back_url',
|
||||
// С<><D0A1><EFBFBD><EFBFBD>code
|
||||
STATE_R_KEY: 'roution_authorize_state',
|
||||
//<2F><>ȨlogoС<6F><D0A1><EFBFBD><EFBFBD>
|
||||
LOGO_URL: 'LOGO_URL',
|
||||
//模板缓存
|
||||
SUBSCRIBE_MESSAGE: 'SUBSCRIBE_MESSAGE',
|
||||
|
||||
TIPS_KEY: 'TIPS_KEY',
|
||||
|
||||
SPREAD: 'spread',
|
||||
//缓存经度
|
||||
CACHE_LONGITUDE: 'LONGITUDE',
|
||||
//缓存纬度
|
||||
CACHE_LATITUDE: 'LATITUDE',
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
// Socket链接 暂不做配置
|
||||
WSS_SERVER_URL:'',
|
||||
// Socket调试模式
|
||||
SERVER_DEBUG:true,
|
||||
// 心跳间隔
|
||||
PINGINTERVAL:3000
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,62 @@
|
|||
import $store from "@/store";
|
||||
import { VUE_APP_WS_URL } from "@/utils/index.js";
|
||||
|
||||
const Socket = function() {
|
||||
this.ws = new WebSocket(wss(VUE_APP_WS_URL));
|
||||
this.ws.onopen = this.onOpen.bind(this);
|
||||
this.ws.onerror = this.onError.bind(this);
|
||||
this.ws.onmessage = this.onMessage.bind(this);
|
||||
this.ws.onclose = this.onClose.bind(this);
|
||||
};
|
||||
|
||||
function wss(wsSocketUrl) {
|
||||
let ishttps = document.location.protocol == 'https:';
|
||||
if (ishttps) {
|
||||
return wsSocketUrl.replace('ws:', 'wss:');
|
||||
} else {
|
||||
return wsSocketUrl.replace('wss:', 'ws:');
|
||||
}
|
||||
}
|
||||
|
||||
Socket.prototype = {
|
||||
vm(vm) {
|
||||
this.vm = vm;
|
||||
},
|
||||
close() {
|
||||
clearInterval(this.timer);
|
||||
this.ws.close();
|
||||
},
|
||||
onOpen: function() {
|
||||
console.log("ws open");
|
||||
this.init();
|
||||
this.send({
|
||||
type: "login",
|
||||
data: $store.state.app.token
|
||||
});
|
||||
this.vm.$emit("socket_open");
|
||||
},
|
||||
init: function() {
|
||||
var that = this;
|
||||
this.timer = setInterval(function() {
|
||||
that.send({ type: "ping" });
|
||||
}, 10000);
|
||||
},
|
||||
send: function(data) {
|
||||
return this.ws.send(JSON.stringify(data));
|
||||
},
|
||||
onMessage: function(res) {
|
||||
const { type, data = {} } = JSON.parse(res.data);
|
||||
this.vm.$emit(type, data);
|
||||
},
|
||||
onClose: function() {
|
||||
clearInterval(this.timer);
|
||||
},
|
||||
onError: function(e) {
|
||||
console.log(e);
|
||||
this.vm.$emit("socket_error", e);
|
||||
}
|
||||
};
|
||||
|
||||
Socket.prototype.constructor = Socket;
|
||||
|
||||
export default Socket;
|
|
@ -0,0 +1,61 @@
|
|||
import store from "../store";
|
||||
import Cache from '../utils/cache';
|
||||
// #ifdef H5 || APP-PLUS
|
||||
import { isWeixin } from "../utils";
|
||||
import auth from './wechat';
|
||||
// #endif
|
||||
|
||||
import { LOGIN_STATUS, USER_INFO, EXPIRES_TIME, STATE_R_KEY} from './../config/cache';
|
||||
|
||||
function prePage(){
|
||||
let pages = getCurrentPages();
|
||||
let prePage = pages[pages.length - 1];
|
||||
return prePage.route;
|
||||
}
|
||||
|
||||
export function toLogin(push, pathLogin) {
|
||||
store.commit("LOGOUT");
|
||||
let path = prePage();
|
||||
// #ifdef H5
|
||||
path = location.href;
|
||||
// #endif
|
||||
if(!pathLogin)
|
||||
pathLogin = '/page/users/login/index'
|
||||
Cache.set('login_back_url',path);
|
||||
// #ifdef H5 || APP-PLUS
|
||||
if (isWeixin()) {
|
||||
auth.oAuth();
|
||||
} else {
|
||||
if (path !== pathLogin) {
|
||||
push ? uni.navigateTo({
|
||||
url:'/pages/users/login/index'
|
||||
}) : uni.reLaunch({
|
||||
url: '/pages/users/login/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
|
||||
export function checkLogin()
|
||||
{
|
||||
let token = Cache.get(LOGIN_STATUS);
|
||||
let expiresTime = Cache.get(EXPIRES_TIME);
|
||||
let newTime = Math.round(new Date() / 1000);
|
||||
if (expiresTime < newTime || !token){
|
||||
Cache.clear(LOGIN_STATUS);
|
||||
Cache.clear(EXPIRES_TIME);
|
||||
Cache.clear(USER_INFO);
|
||||
Cache.clear(STATE_R_KEY);
|
||||
return false;
|
||||
}else{
|
||||
store.commit('UPDATE_LOGIN',token);
|
||||
let userInfo = Cache.get(USER_INFO,true);
|
||||
if(userInfo){
|
||||
store.commit('UPDATE_USERINFO',userInfo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
export function goShopDetail(item,uid) {
|
||||
return new Promise(resolve => {
|
||||
if (item.activity && item.activity.type === "1") {
|
||||
uni.navigateTo({
|
||||
url: `/pages/activity/goods_seckill_details/index?id=${item.activity.id}&time=${item.activity.time}&status=1`
|
||||
})
|
||||
} else if (item.activity && item.activity.type === "2") {
|
||||
uni.navigateTo({
|
||||
url: `/pages/activity/goods_bargain_details/index?id=${item.activity.id}&bargain=${uid}`
|
||||
})
|
||||
} else if (item.activity && item.activity.type === "3") {
|
||||
uni.navigateTo({
|
||||
url: `/pages/activity/goods_combination_details/index?id=${item.activity.id}`
|
||||
})
|
||||
} else {
|
||||
resolve(item);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
import store from '../store';
|
||||
import { checkLogin } from './login';
|
||||
import { login } from '../api/public';
|
||||
import Cache from '../utils/cache';
|
||||
import { STATE_R_KEY, USER_INFO, EXPIRES_TIME, LOGIN_STATUS} from './../config/cache';
|
||||
|
||||
class Routine
|
||||
{
|
||||
|
||||
constructor()
|
||||
{
|
||||
this.scopeUserInfo = 'scope.userInfo';
|
||||
}
|
||||
|
||||
async getUserCode(){
|
||||
let isAuth = await this.isAuth(), code = '' ;
|
||||
if(isAuth)
|
||||
code = await this.getCode();
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
getUserInfo(){
|
||||
let that = this , code = this.getUserCode();
|
||||
return new Promise( (resolve,reject) => {
|
||||
uni.getUserInfo({
|
||||
lang: 'zh_CN',
|
||||
success(user) {
|
||||
if(code) user.code = code;
|
||||
resolve({userInfo:user,islogin:false});
|
||||
},
|
||||
fail(res){
|
||||
reject(res);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
authorize()
|
||||
{
|
||||
let that = this;
|
||||
return new Promise((resolve,reject)=>{
|
||||
if(checkLogin())
|
||||
return resolve({
|
||||
userInfo:Cache.get(USER_INFO,true),
|
||||
islogin:true,
|
||||
});
|
||||
uni.authorize({
|
||||
scope: that.scopeUserInfo,
|
||||
success() {
|
||||
resolve({islogin:false});
|
||||
},
|
||||
fail(res){
|
||||
reject(res);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async getCode(){
|
||||
let provider = await this.getProvider();
|
||||
return new Promise((resolve,reject)=>{
|
||||
if(Cache.has(STATE_R_KEY)){
|
||||
return resolve(Cache.get(STATE_R_KEY));
|
||||
}
|
||||
uni.login({
|
||||
provider:provider,
|
||||
success(res) {
|
||||
if (res.code) Cache.set(STATE_R_KEY, res.code ,10800);
|
||||
return resolve(res.code);
|
||||
},
|
||||
fail(){
|
||||
return reject(null);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务供应商
|
||||
*/
|
||||
getProvider()
|
||||
{
|
||||
return new Promise((resolve,reject)=>{
|
||||
uni.getProvider({
|
||||
service:'oauth',
|
||||
success(res) {
|
||||
resolve(res.provider);
|
||||
},
|
||||
fail() {
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否授权
|
||||
*/
|
||||
isAuth(){
|
||||
let that = this;
|
||||
return new Promise((resolve,reject)=>{
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting[that.scopeUserInfo]) {
|
||||
resolve(true)
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
},
|
||||
fail(){
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
authUserInfo(code,data)
|
||||
{
|
||||
return new Promise((resolve, reject)=>{
|
||||
login(code,data).then(res=>{
|
||||
// let time = res.data.expiresTime - Cache.time();
|
||||
store.commit('UPDATE_USERINFO', res.data.user);
|
||||
store.commit('LOGIN', {token:res.data.token});
|
||||
store.commit('SETUID', res.data.user.uid);
|
||||
// Cache.set(EXPIRES_TIME,res.data.expiresTime,time);
|
||||
Cache.set(USER_INFO,res.data.user);
|
||||
return resolve(res);
|
||||
}).catch(res=>{
|
||||
return reject(res);
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default new Routine();
|
|
@ -0,0 +1,268 @@
|
|||
// #ifdef H5
|
||||
import WechatJSSDK from "@/plugin/jweixin-module/index.js";
|
||||
|
||||
|
||||
import {
|
||||
getWechatConfig,
|
||||
wechatAuth
|
||||
} from "@/api/public";
|
||||
import {
|
||||
WX_AUTH,
|
||||
STATE_KEY,
|
||||
LOGINTYPE,
|
||||
BACK_URL
|
||||
} from '@/config/cache';
|
||||
import {
|
||||
parseQuery
|
||||
} from '@/utils';
|
||||
import store from '@/store';
|
||||
import Cache from '@/utils/cache';
|
||||
|
||||
class AuthWechat {
|
||||
|
||||
constructor() {
|
||||
//微信实例化对象
|
||||
this.instance = WechatJSSDK;
|
||||
//是否实例化
|
||||
this.status = false;
|
||||
|
||||
this.initConfig = {};
|
||||
|
||||
}
|
||||
|
||||
isAndroid(){
|
||||
let u = navigator.userAgent;
|
||||
return u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
|
||||
}
|
||||
|
||||
signLink() {
|
||||
if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
|
||||
window.entryUrl = document.location.href
|
||||
}
|
||||
return /(Android)/i.test(navigator.userAgent) ? document.location.href : window.entryUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化wechat(分享配置)
|
||||
*/
|
||||
wechat() {
|
||||
return new Promise((resolve, reject) => {
|
||||
// if (this.status && !this.isAndroid()) return resolve(this.instance);
|
||||
getWechatConfig()
|
||||
.then(res => {
|
||||
let data = res.data;
|
||||
// delete data.jsApiTicket;
|
||||
this.instance.config(data);
|
||||
this.initConfig = data;
|
||||
this.status = true;
|
||||
this.instance.ready(() => {
|
||||
resolve(this.instance);
|
||||
})
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
this.status = false;
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证是否初始化
|
||||
*/
|
||||
verifyInstance() {
|
||||
let that = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
if (that.instance === null && !that.status) {
|
||||
that.wechat().then(res => {
|
||||
resolve(that.instance);
|
||||
}).catch(() => {
|
||||
return reject();
|
||||
})
|
||||
} else {
|
||||
return resolve(that.instance);
|
||||
}
|
||||
})
|
||||
}
|
||||
// 微信公众号的共享地址
|
||||
openAddress() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.wechat().then(wx => {
|
||||
this.toPromise(wx.openAddress).then(res => {
|
||||
resolve(res);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
* @param {Object} config
|
||||
*/
|
||||
pay(config) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.wechat().then((wx) => {
|
||||
this.toPromise(wx.chooseWXPay, config).then(res => {
|
||||
resolve(res);
|
||||
}).catch(res => {
|
||||
reject(res);
|
||||
});
|
||||
}).catch(res => {
|
||||
reject(res);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
toPromise(fn, config = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fn({
|
||||
...config,
|
||||
success(res) {
|
||||
resolve(res);
|
||||
},
|
||||
fail(err) {
|
||||
reject(err);
|
||||
},
|
||||
complete(err) {
|
||||
reject(err);
|
||||
},
|
||||
cancel(err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动去授权
|
||||
*/
|
||||
oAuth() {
|
||||
if (uni.getStorageSync(WX_AUTH) && store.state.app.token) return;
|
||||
const {
|
||||
code
|
||||
} = parseQuery();
|
||||
if (!code) return this.toAuth();
|
||||
}
|
||||
|
||||
clearAuthStatus() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权登陆获取token
|
||||
* @param {Object} code
|
||||
*/
|
||||
auth(code) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let loginType = Cache.get(LOGINTYPE);
|
||||
wechatAuth(code, parseInt(Cache.get("spread")), loginType)
|
||||
.then(({
|
||||
data
|
||||
}) => {
|
||||
// let expires_time = data.expires_time.substring(0, 19);
|
||||
// expires_time = expires_time.replace(/-/g, '/');
|
||||
// expires_time = new Date(expires_time).getTime();
|
||||
// let newTime = Math.round(new Date() / 1000);
|
||||
store.commit("LOGIN", {
|
||||
token: data.token
|
||||
// time: expires_time - newTime
|
||||
});
|
||||
Cache.set(WX_AUTH, code);
|
||||
Cache.clear(STATE_KEY);
|
||||
loginType && Cache.clear(LOGINTYPE);
|
||||
resolve();
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取跳转授权后的地址
|
||||
* @param {Object} appId
|
||||
*/
|
||||
getAuthUrl(appId) {
|
||||
const redirect_uri = encodeURIComponent(
|
||||
`${location.origin}/pages/auth/index?back_url=` +
|
||||
encodeURIComponent(
|
||||
encodeURIComponent(
|
||||
uni.getStorageSync(BACK_URL) ?
|
||||
uni.getStorageSync(BACK_URL) :
|
||||
location.pathname + location.search
|
||||
)
|
||||
)
|
||||
);
|
||||
uni.removeStorageSync(BACK_URL);
|
||||
const state = encodeURIComponent(
|
||||
("" + Math.random()).split(".")[1] + "authorizestate"
|
||||
);
|
||||
uni.setStorageSync(STATE_KEY, state);
|
||||
return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转自动登陆
|
||||
*/
|
||||
toAuth() {
|
||||
let that = this;
|
||||
this.wechat().then(wx => {
|
||||
location.href = this.getAuthUrl(that.initConfig.appId);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定事件
|
||||
* @param {Object} name 事件名
|
||||
* @param {Object} config 参数
|
||||
*/
|
||||
wechatEvevt(name, config) {
|
||||
let that = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
let configDefault = {
|
||||
fail(res) {
|
||||
console.log('前解放后的金凤凰3');
|
||||
console.log(res);
|
||||
console.log(that.instance);
|
||||
console.log('前解放后的金凤凰2');
|
||||
if (that.instance) return reject({
|
||||
is_ready: true,
|
||||
wx: that.instance
|
||||
});
|
||||
that.verifyInstance().then(wx => {
|
||||
return reject({
|
||||
is_ready: true,
|
||||
wx: wx
|
||||
});
|
||||
console.log('么么么么1');
|
||||
console.log(wx);
|
||||
console.log('么么么么2');
|
||||
})
|
||||
},
|
||||
success(res) {
|
||||
console.log(res);
|
||||
return resolve(res,2222);
|
||||
}
|
||||
};
|
||||
Object.assign(configDefault, config);
|
||||
that.wechat().then(wx => {
|
||||
if (typeof name === 'object') {
|
||||
name.forEach(item => {
|
||||
wx[item] && wx[item](configDefault)
|
||||
})
|
||||
} else {
|
||||
wx[name] && wx[name](configDefault)
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
isWeixin() {
|
||||
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default new AuthWechat();
|
||||
// #endif
|
|
@ -0,0 +1,58 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
import store from './store'
|
||||
import Cache from './utils/cache'
|
||||
import util from 'utils/util'
|
||||
|
||||
Vue.prototype.$util = util;
|
||||
Vue.prototype.$Cache = Cache;
|
||||
Vue.prototype.$eventHub = new Vue();
|
||||
Vue.config.productionTip = false
|
||||
|
||||
// #ifdef H5
|
||||
import { parseQuery } from "./utils";
|
||||
import Auth from './libs/wechat';
|
||||
import { SPREAD } from './config/cache';
|
||||
Vue.prototype.$wechat = Auth;
|
||||
let cookieName = "VCONSOLE",
|
||||
query = parseQuery(),
|
||||
urlSpread = query["spread"],
|
||||
vconsole = query[cookieName.toLowerCase()],
|
||||
md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
|
||||
md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
|
||||
|
||||
if (urlSpread !== undefined) {
|
||||
var spread = Cache.get(SPREAD);
|
||||
urlSpread = parseInt(urlSpread);
|
||||
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
|
||||
Cache.set("spread", urlSpread || 0);
|
||||
} else if (spread === 0 || typeof spread !== "number") {
|
||||
Cache.set("spread", urlSpread || 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (vconsole !== undefined) {
|
||||
if (vconsole === md5UnCrmeb && Cache.has(cookieName))
|
||||
Cache.clear(cookieName);
|
||||
} else vconsole = Cache.get(cookieName);
|
||||
|
||||
import VConsole from './components/vconsole.min.js'
|
||||
|
||||
if (vconsole !== undefined && vconsole === md5Crmeb) {
|
||||
Cache.set(cookieName, md5Crmeb, 3600);
|
||||
let vConsole = new VConsole();
|
||||
}
|
||||
|
||||
Auth.isWeixin() && Auth.oAuth();
|
||||
|
||||
// #endif
|
||||
|
||||
App.mpType = 'app'
|
||||
|
||||
|
||||
const app = new Vue({
|
||||
...App,
|
||||
store,
|
||||
Cache
|
||||
})
|
||||
app.$mount();
|
|
@ -0,0 +1,100 @@
|
|||
{
|
||||
"name" : "crmeb",
|
||||
"appid" : "__UNI__06E0263",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueCompiler" : "uni-app",
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wxcda5a2b1b98b6a95",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"minified" : true,
|
||||
"postcss" : true,
|
||||
"es6" : true
|
||||
},
|
||||
"permission" : {
|
||||
"scope.userLocation" : {
|
||||
"desc" : "你的位置信息将用于和门店的距离长度"
|
||||
}
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"h5" : {
|
||||
"devServer" : {
|
||||
"https" : false
|
||||
},
|
||||
"router" : {
|
||||
"mode" : "history",
|
||||
"base" : ""
|
||||
},
|
||||
"domain" : "",
|
||||
"sdkConfigs" : {
|
||||
"maps" : {
|
||||
"qqmap" : {
|
||||
"key" : "NO7BZ-APDKP-UCBD7-VT7CX-R5UZK-JBF2W"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title" : "CRMEB"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
disabled: false,
|
||||
text: "获取验证码"
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
sendCode() {
|
||||
if (this.disabled) return;
|
||||
this.disabled = true;
|
||||
let n = 60;
|
||||
this.text = "剩余 " + n + "s";
|
||||
const run = setInterval(() => {
|
||||
n = n - 1;
|
||||
if (n < 0) {
|
||||
clearInterval(run);
|
||||
}
|
||||
this.text = "剩余 " + n + "s";
|
||||
if (this.text < "剩余 " + 0 + "s") {
|
||||
this.disabled = false;
|
||||
this.text = "重新获取";
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,447 @@
|
|||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
|
||||
},
|
||||
"babel-code-frame": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
|
||||
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
|
||||
"requires": {
|
||||
"chalk": "^1.1.3",
|
||||
"esutils": "^2.0.2",
|
||||
"js-tokens": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"babel-core": {
|
||||
"version": "6.26.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz",
|
||||
"integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==",
|
||||
"requires": {
|
||||
"babel-code-frame": "^6.26.0",
|
||||
"babel-generator": "^6.26.0",
|
||||
"babel-helpers": "^6.24.1",
|
||||
"babel-messages": "^6.23.0",
|
||||
"babel-register": "^6.26.0",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"babel-template": "^6.26.0",
|
||||
"babel-traverse": "^6.26.0",
|
||||
"babel-types": "^6.26.0",
|
||||
"babylon": "^6.18.0",
|
||||
"convert-source-map": "^1.5.1",
|
||||
"debug": "^2.6.9",
|
||||
"json5": "^0.5.1",
|
||||
"lodash": "^4.17.4",
|
||||
"minimatch": "^3.0.4",
|
||||
"path-is-absolute": "^1.0.1",
|
||||
"private": "^0.1.8",
|
||||
"slash": "^1.0.0",
|
||||
"source-map": "^0.5.7"
|
||||
}
|
||||
},
|
||||
"babel-generator": {
|
||||
"version": "6.26.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
|
||||
"integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
|
||||
"requires": {
|
||||
"babel-messages": "^6.23.0",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"babel-types": "^6.26.0",
|
||||
"detect-indent": "^4.0.0",
|
||||
"jsesc": "^1.3.0",
|
||||
"lodash": "^4.17.4",
|
||||
"source-map": "^0.5.7",
|
||||
"trim-right": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"babel-helpers": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz",
|
||||
"integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=",
|
||||
"requires": {
|
||||
"babel-runtime": "^6.22.0",
|
||||
"babel-template": "^6.24.1"
|
||||
}
|
||||
},
|
||||
"babel-messages": {
|
||||
"version": "6.23.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
|
||||
"integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=",
|
||||
"requires": {
|
||||
"babel-runtime": "^6.22.0"
|
||||
}
|
||||
},
|
||||
"babel-register": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
|
||||
"integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=",
|
||||
"requires": {
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"core-js": "^2.5.0",
|
||||
"home-or-tmp": "^2.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"source-map-support": "^0.4.15"
|
||||
}
|
||||
},
|
||||
"babel-runtime": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
|
||||
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
|
||||
"requires": {
|
||||
"core-js": "^2.4.0",
|
||||
"regenerator-runtime": "^0.11.0"
|
||||
}
|
||||
},
|
||||
"babel-template": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz",
|
||||
"integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=",
|
||||
"requires": {
|
||||
"babel-runtime": "^6.26.0",
|
||||
"babel-traverse": "^6.26.0",
|
||||
"babel-types": "^6.26.0",
|
||||
"babylon": "^6.18.0",
|
||||
"lodash": "^4.17.4"
|
||||
}
|
||||
},
|
||||
"babel-traverse": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz",
|
||||
"integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=",
|
||||
"requires": {
|
||||
"babel-code-frame": "^6.26.0",
|
||||
"babel-messages": "^6.23.0",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"babel-types": "^6.26.0",
|
||||
"babylon": "^6.18.0",
|
||||
"debug": "^2.6.8",
|
||||
"globals": "^9.18.0",
|
||||
"invariant": "^2.2.2",
|
||||
"lodash": "^4.17.4"
|
||||
}
|
||||
},
|
||||
"babel-types": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz",
|
||||
"integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=",
|
||||
"requires": {
|
||||
"babel-runtime": "^6.26.0",
|
||||
"esutils": "^2.0.2",
|
||||
"lodash": "^4.17.4",
|
||||
"to-fast-properties": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"babylon": {
|
||||
"version": "6.18.0",
|
||||
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
|
||||
"integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ=="
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
|
||||
"requires": {
|
||||
"ansi-styles": "^2.2.1",
|
||||
"escape-string-regexp": "^1.0.2",
|
||||
"has-ansi": "^2.0.0",
|
||||
"strip-ansi": "^3.0.0",
|
||||
"supports-color": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
},
|
||||
"convert-source-map": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
|
||||
"integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.1"
|
||||
}
|
||||
},
|
||||
"core-image-xhr": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/core-image-xhr/-/core-image-xhr-1.0.3.tgz",
|
||||
"integrity": "sha1-khHXtcQSGa9atpuThMoqR9VytHY="
|
||||
},
|
||||
"core-js": {
|
||||
"version": "2.6.11",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
|
||||
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg=="
|
||||
},
|
||||
"daycaca": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/daycaca/-/daycaca-1.0.11.tgz",
|
||||
"integrity": "sha512-2SJTpnpmxUGVWbFPTRhaZLvisCD7bYjvuFpLAhjfAAvtnBb26dAqIqaZ9Jq8yvSlugpEGY+v/YXHXGP3paVV9A=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"detect-indent": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz",
|
||||
"integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=",
|
||||
"requires": {
|
||||
"repeating": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"dom7": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/dom7/-/dom7-2.1.3.tgz",
|
||||
"integrity": "sha512-QTxHHDox+M6ZFz1zHPAHZKI3JOHY5iY4i9BK2uctlggxKQwRhO3q3HHFq1BKsT25Bm/ySSj70K6Wk/G4bs9rMQ==",
|
||||
"requires": {
|
||||
"ssr-window": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"emoji-awesome": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/emoji-awesome/-/emoji-awesome-0.0.2.tgz",
|
||||
"integrity": "sha512-ggortYTr4+f4Jqp/R3vV9FAec+wRkIyRM458LUrv81mKQSKIJW9+xDlbqHsUpMeNKCLG45RsbbCyprrOoGZ6UQ=="
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
|
||||
},
|
||||
"globals": {
|
||||
"version": "9.18.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
|
||||
"integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ=="
|
||||
},
|
||||
"has-ansi": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
|
||||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"home-or-tmp": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz",
|
||||
"integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=",
|
||||
"requires": {
|
||||
"os-homedir": "^1.0.0",
|
||||
"os-tmpdir": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"invariant": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
|
||||
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
|
||||
"requires": {
|
||||
"loose-envify": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-finite": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz",
|
||||
"integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w=="
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
||||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
|
||||
},
|
||||
"jsesc": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz",
|
||||
"integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s="
|
||||
},
|
||||
"json5": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
|
||||
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE="
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
|
||||
},
|
||||
"loose-envify": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
|
||||
"requires": {
|
||||
"js-tokens": "^3.0.0 || ^4.0.0"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
|
||||
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
|
||||
"requires": {
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"os-homedir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||
},
|
||||
"private": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
|
||||
"integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg=="
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.11.1",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
|
||||
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
|
||||
},
|
||||
"repeating": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz",
|
||||
"integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=",
|
||||
"requires": {
|
||||
"is-finite": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"slash": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
|
||||
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU="
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.5.7",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.4.18",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
|
||||
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
|
||||
"requires": {
|
||||
"source-map": "^0.5.6"
|
||||
}
|
||||
},
|
||||
"ssr-window": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-1.0.1.tgz",
|
||||
"integrity": "sha512-dgFqB+f00LJTEgb6UXhx0h+SrG50LJvti2yMKMqAgzfUmUXZrLSv2fjULF7AWGwK25EXu8+smLR3jYsJQChPsg=="
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
||||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
|
||||
},
|
||||
"swiper": {
|
||||
"version": "5.3.8",
|
||||
"resolved": "https://registry.npmjs.org/swiper/-/swiper-5.3.8.tgz",
|
||||
"integrity": "sha512-bCxrayTgzC2bZBRuFwAx7T4exWeHqMADBpcuTQ7PNCOIIzJRPqNh4ySIvW06LEEU3Q0KncaNre4hrn+jXcWivQ==",
|
||||
"requires": {
|
||||
"dom7": "^2.1.3",
|
||||
"ssr-window": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"to-fast-properties": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
|
||||
"integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc="
|
||||
},
|
||||
"trim-right": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
|
||||
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM="
|
||||
},
|
||||
"vue": {
|
||||
"version": "2.6.11",
|
||||
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.11.tgz",
|
||||
"integrity": "sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ=="
|
||||
},
|
||||
"vue-awesome-swiper": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/vue-awesome-swiper/-/vue-awesome-swiper-4.1.1.tgz",
|
||||
"integrity": "sha512-50um10t6N+lJaORkpwSi1wWuMmBI1sgFc9Znsi5oUykw2cO5DzLaBHcO2JNX21R+Ue4TGoIJDhhxjBHtkFrTEQ=="
|
||||
},
|
||||
"vue-core-image-upload": {
|
||||
"version": "2.4.11",
|
||||
"resolved": "https://registry.npmjs.org/vue-core-image-upload/-/vue-core-image-upload-2.4.11.tgz",
|
||||
"integrity": "sha512-He0OcNqUaL2yHQebFwk4IxLr1Q8m1S7u8zTUek7pMaOUHW76MXOOn6sHoJMruURNvsv3SyeqFEt4N7JQBnMviA==",
|
||||
"requires": {
|
||||
"babel-core": "^6.26.0",
|
||||
"core-image-xhr": "^1.0.3",
|
||||
"daycaca": "^1.0.6",
|
||||
"vue": "^2.5.13"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,544 @@
|
|||
{
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页",
|
||||
"navigationStyle": "custom",
|
||||
"app-plus": {
|
||||
"scrollIndicator": false //禁用原生导航栏
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/order_addcart/order_addcart",
|
||||
"style": {
|
||||
"navigationBarTitleText": "购物车"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "个人中心",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/goods_details/index",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/goods_cate/goods_cate",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品分类"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/retrieve_password/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "找回密码"
|
||||
}
|
||||
},
|
||||
// #ifdef H5
|
||||
{
|
||||
"path": "pages/customer_list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客服列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/customer_list/chat",
|
||||
"style": {
|
||||
"navigationBarTitleText": "客服聊天"
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
{
|
||||
"path": "pages/goods_list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/news_list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "资讯"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/news_details/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "资讯详情"
|
||||
}
|
||||
},
|
||||
//#ifdef H5
|
||||
{
|
||||
"path": "pages/auth/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "CRMEB"
|
||||
}
|
||||
},
|
||||
//#endif
|
||||
{
|
||||
"path": "pages/goods_search/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "搜索商品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/order_pay_status/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "支付成功"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/order_details/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pages/users",
|
||||
"name": "users",
|
||||
"pages": [
|
||||
{
|
||||
"path": "retrievePassword/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "忘记密码"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_info/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "个人资料"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_get_coupon/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "领取优惠券"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_goods_collection/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "收藏商品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_sgin/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "签到"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_sgin_list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "签到记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_money/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的账户"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_bill/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "账单明细"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_integral/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_coupon/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的优惠券"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_spread_user/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的推广",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_spread_code/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分销海报"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_spread_money/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "佣金记录",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_cash/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "提现",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_vip/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "会员中心",
|
||||
"navigationBarBackgroundColor": "#232323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_address_list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "地址管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_address/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加地址"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_phone/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "绑定手机",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_payment/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "余额充值"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_pwd_edit/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "修改密码",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "order_confirm/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "提交订单"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_details_store/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "门店列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "promoter-list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "推广人列表",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "promoter-order/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "推广人订单",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "promoter_rank/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "推广人排行",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "commission_rank/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "佣金排行",
|
||||
"navigationBarBackgroundColor": "#e93323"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "order_list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的订单"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_logistics/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "物流信息"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "user_return_list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "退货列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_return/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "申请退货"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "login/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_comment_list/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品评分"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_comment_con/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品评价"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/activity",
|
||||
"name": "activity",
|
||||
"pages":[{
|
||||
"path": "goods_bargain/index",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_bargain_details/index",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_combination/index",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_combination_details/index",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_combination_status/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "拼团"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_seckill/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "限时秒杀"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
,"navigationBarBackgroundColor":"#e93323"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "goods_seckill_details/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "秒杀详情"
|
||||
// #ifdef MP
|
||||
,"navigationStyle": "custom"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "poster-poster/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "砍价海报"
|
||||
// #ifdef MP
|
||||
,"navigationBarTextStyle": "#fff"
|
||||
,"navigationBarBackgroundColor":"#e93323"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "bargain/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "砍价记录"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/admin",
|
||||
"name": "adminOrder",
|
||||
"pages":[
|
||||
{
|
||||
"path": "order/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单首页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "orderList/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "orderDetail/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "delivery/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单发货"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "statistics/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单数据统计"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "order_cancellation/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单核销"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/columnGoods",
|
||||
"name": "columnGoods",
|
||||
"pages":[
|
||||
{
|
||||
"path": "HotNewGoods/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "精品推荐"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "crmeb",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"backgroundColor": "#F8F8F8",
|
||||
"titleNView": false
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#282828",
|
||||
"selectedColor": "#fc4141",
|
||||
"borderStyle": "white",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "static/images/1-001.png",
|
||||
"selectedIconPath": "static/images/1-002.png",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/goods_cate/goods_cate",
|
||||
"iconPath": "static/images/2-001.png",
|
||||
"selectedIconPath": "static/images/2-002.png",
|
||||
"text": "分类"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/order_addcart/order_addcart",
|
||||
"iconPath": "static/images/3-001.png",
|
||||
"selectedIconPath": "static/images/3-002.png",
|
||||
"text": "购物车"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/user/index",
|
||||
"iconPath": "static/images/4-001.png",
|
||||
"selectedIconPath": "static/images/4-002.png",
|
||||
"text": "我的"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condition" : { //模式配置,仅开发期间生效
|
||||
"current": 0, //当前激活的模式(list 的索引项)
|
||||
"list": [
|
||||
{
|
||||
"name": "", //模式名称
|
||||
"path": "", //启动页面,必选
|
||||
"query": "" //启动参数,在页面的onLoad函数里面得到
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,255 @@
|
|||
<template>
|
||||
<view>
|
||||
<block v-if="bargain.length>0">
|
||||
<div class="bargain-record" ref="container">
|
||||
<div class="item" v-for="(item, index) in bargain" :key="index">
|
||||
<div class="picTxt acea-row row-between-wrapper">
|
||||
<div class="pictrue">
|
||||
<image :src="item.image" />
|
||||
</div>
|
||||
<div class="text acea-row row-column-around">
|
||||
<div class="line1" style="width: 100%;">{{ item.title }}</div>
|
||||
<count-down :justify-left="'justify-content:left'" :is-day="true" :tip-text="'倒计时 '" :day-text="' 天 '" :hour-text="' 时 '" :minute-text="' 分 '"
|
||||
:second-text="' 秒'" :datatime="item.datatime" v-if="item.status === 1"></count-down>
|
||||
<div class="successTxt font-color-red" v-else-if="item.status === 3">砍价成功</div>
|
||||
<div class="endTxt" v-else>活动已结束</div>
|
||||
<div class="money font-color-red">
|
||||
已砍至<span class="symbol">¥</span><span class="num">{{ item.residue_price }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom acea-row row-between-wrapper">
|
||||
<div class="purple" v-if="item.status === 1">活动进行中</div>
|
||||
<div class="success" v-else-if="item.status === 3">砍价成功</div>
|
||||
<div class="end" v-else>活动已结束</div>
|
||||
<div class="acea-row row-middle row-right">
|
||||
<div class="bnt cancel" v-if="item.status === 1" @click="getBargainUserCancel(item.bargain_id)">
|
||||
取消活动
|
||||
</div>
|
||||
<div class="bnt bg-color-red" v-if="item.status === 1" @click="goDetail(item.bargain_id)">
|
||||
继续砍价
|
||||
</div>
|
||||
<!-- <div class="bnt bg-color-red" v-else @click="goList">重开一个</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Loading :loaded="status" :loading="loadingList"></Loading>
|
||||
</div>
|
||||
</block>
|
||||
<block v-if="bargain.length == 0">
|
||||
<emptyPage title="暂无砍价记录~"></emptyPage>
|
||||
</block>
|
||||
<home></home>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import CountDown from "@/components/countDown";
|
||||
import emptyPage from '@/components/emptyPage.vue'
|
||||
import {
|
||||
getBargainUserList,
|
||||
getBargainUserCancel
|
||||
} from "@/api/activity";
|
||||
import {
|
||||
getUserInfo
|
||||
} from '@/api/user.js';
|
||||
import Loading from "@/components/Loading";
|
||||
import home from '@/components/home';
|
||||
export default {
|
||||
name: "BargainRecord",
|
||||
components: {
|
||||
CountDown,
|
||||
Loading,
|
||||
emptyPage,
|
||||
home
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
bargain: [],
|
||||
status: false, //砍价列表是否获取完成 false 未完成 true 完成
|
||||
loadingList: false, //当前接口是否请求完成 false 完成 true 未完成
|
||||
page: 1, //页码
|
||||
limit: 20, //数量
|
||||
userInfo: {}
|
||||
};
|
||||
},
|
||||
onLoad: function() {
|
||||
this.getBargainUserList();
|
||||
this.getUserInfo();
|
||||
// this.$scroll(this.$refs.container, () => {
|
||||
// !this.loadingList && this.getBargainUserList();
|
||||
// });
|
||||
},
|
||||
methods: {
|
||||
goDetail: function(id) {
|
||||
// this.$router.push({
|
||||
// path: "/activity/dargain_detail/" + id +'&bargain='+ userInfo.uid
|
||||
// });
|
||||
uni.navigateTo({
|
||||
url: `/pages/activity/goods_bargain_details/index?id=${id}&bargain=${this.userInfo.uid}`
|
||||
})
|
||||
},
|
||||
// 砍价列表
|
||||
goList: function() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/activity/goods_bargain/index'
|
||||
})
|
||||
},
|
||||
getBargainUserList: function() {
|
||||
var that = this;
|
||||
if (that.loadingList) return;
|
||||
if (that.status) return;
|
||||
getBargainUserList({
|
||||
page: that.page,
|
||||
limit: that.limit
|
||||
})
|
||||
.then(res => {
|
||||
that.status = res.data.length < that.limit;
|
||||
that.bargain.push.apply(that.bargain, res.data);
|
||||
that.page++;
|
||||
that.loadingList = false;
|
||||
})
|
||||
.catch(res => {
|
||||
that.$dialog.error(res.msg);
|
||||
});
|
||||
},
|
||||
getBargainUserCancel: function(bargainId) {
|
||||
var that = this;
|
||||
getBargainUserCancel({
|
||||
bargainId: bargainId
|
||||
})
|
||||
.then(res => {
|
||||
that.status = false;
|
||||
that.loadingList = false;
|
||||
that.page = 1;
|
||||
that.bargain = [];
|
||||
that.getBargainUserList();
|
||||
that.$util.Tips({
|
||||
title: res.msg
|
||||
})
|
||||
})
|
||||
.catch(res => {
|
||||
that.$util.Tips({
|
||||
title: res
|
||||
})
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取个人用户信息
|
||||
*/
|
||||
getUserInfo: function() {
|
||||
let that = this;
|
||||
getUserInfo().then(res => {
|
||||
that.userInfo = res.data;
|
||||
});
|
||||
},
|
||||
},
|
||||
onReachBottom() {
|
||||
this.getBargainUserList();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/*砍价记录*/
|
||||
.bargain-record .item .picTxt .text .time .styleAll {
|
||||
color: #fc4141;
|
||||
font-size:24rpx;
|
||||
}
|
||||
.bargain-record .item .picTxt .text .time .red {
|
||||
color: #999;
|
||||
font-size:24rpx;
|
||||
}
|
||||
.bargain-record .item {
|
||||
background-color: #fff;
|
||||
margin-bottom: 12upx;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt {
|
||||
height: 210upx;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
padding: 0 30upx;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt .pictrue {
|
||||
width: 150upx;
|
||||
height: 150upx;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6upx;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt .text {
|
||||
width: 515upx;
|
||||
font-size: 30upx;
|
||||
color: #282828;
|
||||
height: 150upx;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt .text .time {
|
||||
font-size: 24upx;
|
||||
color: #868686;
|
||||
justify-content: left !important;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt .text .successTxt{
|
||||
font-size:24rpx;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt .text .endTxt{
|
||||
font-size:24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.bargain-record .item .picTxt .text .money {
|
||||
font-size: 24upx;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt .text .money .num {
|
||||
font-size: 32upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.bargain-record .item .picTxt .text .money .symbol {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.bargain-record .item .bottom {
|
||||
height: 100upx;
|
||||
padding: 0 30upx;
|
||||
font-size: 27upx;
|
||||
}
|
||||
|
||||
.bargain-record .item .bottom .purple {
|
||||
color: #f78513;
|
||||
}
|
||||
|
||||
.bargain-record .item .bottom .end {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.bargain-record .item .bottom .success {
|
||||
color: #e93323;
|
||||
}
|
||||
|
||||
.bargain-record .item .bottom .bnt {
|
||||
font-size: 27upx;
|
||||
color: #fff;
|
||||
width: 176upx;
|
||||
height: 60upx;
|
||||
border-radius: 32upx;
|
||||
text-align: center;
|
||||
line-height: 60upx;
|
||||
}
|
||||
|
||||
.bargain-record .item .bottom .bnt.cancel {
|
||||
color: #aaa;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.bargain-record .item .bottom .bnt~.bnt {
|
||||
margin-left: 18upx;
|
||||
}
|
||||
</style>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,875 @@
|
|||
<template>
|
||||
<div class="group-con">
|
||||
<div class="header acea-row row-between-wrapper">
|
||||
<div class="pictrue">
|
||||
<img :src="storeCombination.image" />
|
||||
</div>
|
||||
<div class="text">
|
||||
<div class="line1" v-text="storeCombination.title"></div>
|
||||
<div class="money">
|
||||
¥
|
||||
<span class="num" v-text="storeCombination.price"></span>
|
||||
<span class="team cart-color" v-text="storeCombination.people + '人拼'"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="pinkBool === -1" class="iconfont icon-pintuanshibai"></div>
|
||||
<div v-else-if="pinkBool === 1" class="iconfont icon-pintuanchenggong font-color-red"></div>
|
||||
</div>
|
||||
<div class="wrapper">
|
||||
<div class="title acea-row row-center-wrapper" v-if="pinkBool === 0">
|
||||
<div class="line"></div>
|
||||
<div class="name acea-row row-center-wrapper">
|
||||
剩余
|
||||
<CountDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '" :minute-text="' : '" :second-text="' '"
|
||||
:datatime="pinkT.stop_time"></CountDown>结束
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<div class="tips font-color-red" v-if="pinkBool === 1">
|
||||
恭喜您拼团成功
|
||||
</div>
|
||||
<div class="tips" v-else-if="pinkBool === -1">
|
||||
还差{{ count }}人,拼团失败
|
||||
</div>
|
||||
<div class="tips font-color-red" v-else-if="pinkBool === 0">
|
||||
拼团中,还差{{ count }}人拼团成功
|
||||
</div>
|
||||
<div class="list acea-row row-middle" :class="[
|
||||
pinkBool === 1 || pinkBool === -1 ? 'result' : '',
|
||||
iShidden ? 'on' : ''
|
||||
]">
|
||||
<div class="pictrue">
|
||||
<img :src="pinkT.avatar" />
|
||||
</div>
|
||||
<div class="acea-row row-middle" v-if="pinkAll.length > 0">
|
||||
<div class="pictrue" v-for="(item, index) in pinkAll" :key="index">
|
||||
<img :src="item.avatar" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="pictrue" v-for="index in count" :key="index">
|
||||
<img class="img-none" src="/static/images/vacancy.png" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="(pinkBool === 1 || pinkBool === -1) && count > 9" class="lookAll acea-row row-center-wrapper" @click="lookAll">
|
||||
{{ iShidden ? "收起" : "查看全部" }}
|
||||
<span class="iconfont" :class="iShidden ? 'icon-xiangshang' : 'icon-xiangxia'"></span>
|
||||
</div>
|
||||
<!-- #ifdef H5 -->
|
||||
<div v-if="userBool === 1 && isOk == 0 && pinkBool === 0">
|
||||
<div class="teamBnt bg-color-red" v-if="$wechat.isWeixin()" @click="H5ShareBox = true">邀请好友参团</div>
|
||||
<div class="teamBnt bg-color-red" v-else @click="goPoster">邀请好友参团</div>
|
||||
</div>
|
||||
<!-- <div class="teamBnt bg-color-red" v-if="userBool === 1 && isOk == 0 && pinkBool === 0" @click="goPoster">
|
||||
邀请好友参团
|
||||
</div> -->
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<button open-type='share' class="teamBnt bg-color-red" v-if="userBool === 1 && isOk == 0 && pinkBool === 0">邀请好友参团</button>
|
||||
<!-- #endif -->
|
||||
<div class="teamBnt bg-color-red" v-else-if="userBool === 0 && pinkBool === 0 && count > 0" @click="pay">
|
||||
我要参团
|
||||
</div>
|
||||
<div class="teamBnt bg-color-red" v-if="pinkBool === 1 || pinkBool === -1" @click="goDetail(storeCombination.id)">
|
||||
再次开团
|
||||
</div>
|
||||
<div class="cancel" @click="getCombinationRemove" v-if="pinkBool === 0 && userBool === 1">
|
||||
<span class="iconfont icon-guanbi3"></span>取消开团
|
||||
</div>
|
||||
<div class="lookOrder" v-if="pinkBool === 1" @click="goOrder">
|
||||
查看订单信息
|
||||
<span class="iconfont icon-xiangyou"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group-recommend">
|
||||
<div class="title acea-row row-between-wrapper">
|
||||
<div>大家都在拼</div>
|
||||
<div class="more" @click="goList">
|
||||
更多拼团
|
||||
<span class="iconfont icon-jiantou"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list acea-row row-middle">
|
||||
<div class="item" v-for="(item, index) in storeCombinationHost" :key="index" @click="goDetail(item.id)">
|
||||
<div class="pictrue">
|
||||
<img :src="item.image" />
|
||||
<div class="team" v-text="item.people + '人团'"></div>
|
||||
</div>
|
||||
<div class="name line1" v-text="item.title"></div>
|
||||
<div class="money font-color-red" v-text="'¥' + item.price"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<product-window :attr='attr' :limitNum='1' :iSbnt='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNum" @iptCartNum="iptCartNum"
|
||||
@attrVal="attrVal" @goCat="goPay"></product-window>
|
||||
<!-- 发送给朋友图片 -->
|
||||
<view class="share-box" v-if="H5ShareBox">
|
||||
<image src="/static/images/share-info.png" @click="H5ShareBox = false"></image>
|
||||
</view>
|
||||
<!-- #ifdef MP -->
|
||||
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
|
||||
<!-- #endif -->
|
||||
<!-- <Product-window v-on:changeFun="changeFun" :attr="attr" :limitNum='1' :iSbnt='1'></Product-window> -->
|
||||
<home></home>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import CountDown from "@/components/countDown";
|
||||
import ProductWindow from "@/components/productWindow";
|
||||
import {
|
||||
toLogin
|
||||
} from '@/libs/login.js';
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import {
|
||||
getCombinationPink,
|
||||
postCombinationRemove
|
||||
} from "@/api/activity";
|
||||
import {
|
||||
postCartAdd
|
||||
} from "@/api/store";
|
||||
// #ifdef MP
|
||||
import authorize from '@/components/Authorize';
|
||||
// #endif
|
||||
import home from '@/components/home';
|
||||
const NAME = "GroupRule";
|
||||
const app = getApp();
|
||||
export default {
|
||||
name: NAME,
|
||||
components: {
|
||||
CountDown,
|
||||
ProductWindow,
|
||||
home,
|
||||
// #ifdef MP
|
||||
authorize
|
||||
// #endif
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
currentPinkOrder: "", //当前拼团订单
|
||||
isOk: 0, //判断拼团是否完成
|
||||
pinkBool: 0, //判断拼团是否成功|0=失败,1=成功
|
||||
userBool: 0, //判断当前用户是否在团内|0=未在,1=在
|
||||
pinkAll: [], //团员
|
||||
pinkT: [], //团长信息
|
||||
storeCombination: [], //拼团产品
|
||||
storeCombinationHost: [], //拼团推荐
|
||||
pinkId: 0,
|
||||
count: 0, //拼团剩余人数
|
||||
iShidden: false,
|
||||
isOpen: false, //是否打开属性组件
|
||||
attr: {
|
||||
cartAttr: false,
|
||||
productSelect: {
|
||||
image: "",
|
||||
store_name: "",
|
||||
price: "",
|
||||
quota: 0,
|
||||
unique: "",
|
||||
cart_num: 1,
|
||||
quota_show: 0,
|
||||
product_stock: 0
|
||||
},
|
||||
attrValue: "",
|
||||
productAttr: []
|
||||
},
|
||||
cart_num:'',
|
||||
userInfo:{},
|
||||
H5ShareBox: false, //公众号分享图片
|
||||
isAuto: false, //没有授权的不会自动授权
|
||||
isShowAuth: false //是否隐藏授权
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin']),
|
||||
onLoad(options) {
|
||||
var that = this;
|
||||
that.pinkId = options.id;
|
||||
if (that.isLogin == false) {
|
||||
// #ifdef H5 || APP-PLUS
|
||||
toLogin();
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
that.isAuto = true;
|
||||
that.$set(that, 'isShowAuth', true);
|
||||
// #endif
|
||||
}else{
|
||||
// #ifdef H5
|
||||
this.getCombinationPink();
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.getCombinationPink();
|
||||
},
|
||||
//#ifdef MP
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
let that = this;
|
||||
that.close();
|
||||
that.addShareBargain();
|
||||
return {
|
||||
title: '您的好友' + that.userInfo.nickname + '邀请您参团' + that.storeCombination.title,
|
||||
path: app.globalData.openPages,
|
||||
imageUrl: that.storeCombination.image,
|
||||
}
|
||||
},
|
||||
//#endif
|
||||
methods: {
|
||||
// 授权关闭
|
||||
authColse: function(e) {
|
||||
this.isShowAuth = e;
|
||||
},
|
||||
// 授权后回调
|
||||
onLoadFun: function(e) {
|
||||
this.userInfo = e
|
||||
app.globalData.openPages = '/pages/activity/goods_combination_status/index?id=' + this.pinkId;
|
||||
this.getCombinationPink();
|
||||
},
|
||||
/**
|
||||
* 购物车手动填写
|
||||
*
|
||||
*/
|
||||
iptCartNum: function (e) {
|
||||
this.$set(this.attr.productSelect,'cart_num',e);
|
||||
this.$set(this, "cart_num", e);
|
||||
},
|
||||
attrVal(val) {
|
||||
this.attr.productAttr[val.indexw].index = this.attr.productAttr[val.indexw].attr_values[val.indexn];
|
||||
},
|
||||
onMyEvent: function() {
|
||||
this.$set(this.attr, 'cartAttr', false);
|
||||
this.$set(this, 'isOpen', false);
|
||||
},
|
||||
//将父级向子集多次传送的函数合二为一;
|
||||
// changeFun: function(opt) {
|
||||
// if (typeof opt !== "object") opt = {};
|
||||
// let action = opt.action || "";
|
||||
// let value = opt.value === undefined ? "" : opt.value;
|
||||
// this[action] && this[action](value);
|
||||
// },
|
||||
// changeattr: function(res) {
|
||||
// var that = this;
|
||||
// that.attr.cartAttr = res;
|
||||
// },
|
||||
//选择属性;
|
||||
ChangeAttr: function(res) {
|
||||
this.$set(this,'cart_num',1);
|
||||
let productSelect = this.productValue[res];
|
||||
if (productSelect) {
|
||||
this.$set(this.attr.productSelect, "image", productSelect.image);
|
||||
this.$set(this.attr.productSelect, "price", productSelect.price);
|
||||
this.$set(this.attr.productSelect, "quota", productSelect.quota);
|
||||
this.$set(this.attr.productSelect, "unique", productSelect.unique);
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"product_stock",
|
||||
productSelect.product_stock
|
||||
);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"quota_show",
|
||||
productSelect.quota_show
|
||||
);
|
||||
this.$set(this, "attrValue", res);
|
||||
this.$set(this, "attrTxt", "已选择");
|
||||
} else {
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"image",
|
||||
this.storeCombination.image
|
||||
);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"price",
|
||||
this.storeCombination.price
|
||||
);
|
||||
this.$set(this.attr.productSelect, "quota", 0);
|
||||
this.$set(this.attr.productSelect, "unique", "");
|
||||
this.$set(this.attr.productSelect, "cart_num", 0);
|
||||
this.$set(this.attr.productSelect, "quota_show", 0);
|
||||
this.$set(this.attr.productSelect, "product_stock", 0);
|
||||
this.$set(this, "attrValue", "");
|
||||
this.$set(this, "attrTxt", "请选择");
|
||||
}
|
||||
},
|
||||
ChangeCartNum: function(res) {
|
||||
//changeValue:是否 加|减
|
||||
//获取当前变动属性
|
||||
let productSelect = this.productValue[this.attrValue];
|
||||
if (this.cart_num) {
|
||||
productSelect.cart_num = this.cart_num;
|
||||
this.attr.productSelect.cart_num = this.cart_num;
|
||||
}
|
||||
//如果没有属性,赋值给商品默认库存
|
||||
if (productSelect === undefined && !this.attr.productAttr.length)
|
||||
productSelect = this.attr.productSelect;
|
||||
if (productSelect === undefined) return;
|
||||
let stock = productSelect.stock || 0;
|
||||
let quotaShow = productSelect.quota_show || 0;
|
||||
let productStock = productSelect.product_stock || 0;
|
||||
let num = this.attr.productSelect;
|
||||
//设置默认数据
|
||||
if (productSelect.cart_num == undefined) productSelect.cart_num = 1;
|
||||
if (res) {
|
||||
num.cart_num ++;
|
||||
if(quotaShow >= productStock){
|
||||
if (num.cart_num > productStock) {
|
||||
this.$set(this.attr.productSelect, "cart_num", productStock);
|
||||
this.$set(this, "cart_num", productStock);
|
||||
}
|
||||
}else{
|
||||
if (num.cart_num > quotaShow) {
|
||||
this.$set(this.attr.productSelect, "cart_num", quotaShow);
|
||||
this.$set(this, "cart_num", quotaShow);
|
||||
}
|
||||
}
|
||||
this.$set(this, "cart_num", num.cart_num);
|
||||
this.$set(this.attr.productSelect, "cart_num", num.cart_num);
|
||||
|
||||
} else {
|
||||
num.cart_num--;
|
||||
if (num.cart_num < 1) {
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this, "cart_num", 1);
|
||||
}
|
||||
this.$set(this, "cart_num", num.cart_num);
|
||||
this.$set(this.attr.productSelect, "cart_num", num.cart_num);
|
||||
}
|
||||
// if (res) {
|
||||
// num.cart_num++;
|
||||
// if (num.cart_num > quota) {
|
||||
// this.$set(this.attr.productSelect, "cart_num", quota);
|
||||
// this.$set(this, "cart_num", quota);
|
||||
// }
|
||||
// } else {
|
||||
// num.cart_num--;
|
||||
// if (num.cart_num < 1) {
|
||||
// this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
// this.$set(this, "cart_num", 1);
|
||||
// }
|
||||
// }
|
||||
},
|
||||
//默认选中属性;
|
||||
DefaultSelect() {
|
||||
let productAttr = this.attr.productAttr,
|
||||
value = [];
|
||||
for (var key in this.productValue) {
|
||||
if (this.productValue[key].quota > 0) {
|
||||
value = this.attr.productAttr.length ? key.split(",") : [];
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < productAttr.length; i++) {
|
||||
this.$set(productAttr[i], "index", value[i]);
|
||||
}
|
||||
//sort();排序函数:数字-英文-汉字;
|
||||
let productSelect = this.productValue[value.sort().join(",")];
|
||||
if (productSelect && productAttr.length) {
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"store_name",
|
||||
this.storeCombination.title
|
||||
);
|
||||
this.$set(this.attr.productSelect, "image", productSelect.image);
|
||||
this.$set(this.attr.productSelect, "price", productSelect.price);
|
||||
this.$set(this.attr.productSelect, "quota", productSelect.quota);
|
||||
this.$set(this.attr.productSelect, "unique", productSelect.unique);
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"product_stock",
|
||||
productSelect.product_stock
|
||||
);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"quota_show",
|
||||
productSelect.quota_show
|
||||
);
|
||||
this.$set(this, "attrValue", value.sort().join(","));
|
||||
this.attrValue = value.sort().join(",");
|
||||
this.$set(this, "attrTxt", "已选择");
|
||||
} else if (!productSelect && productAttr.length) {
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"store_name",
|
||||
this.storeCombination.title
|
||||
);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"image",
|
||||
this.storeCombination.image
|
||||
);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"price",
|
||||
this.storeCombination.price
|
||||
);
|
||||
this.$set(this.attr.productSelect, "quota", 0);
|
||||
this.$set(this.attr.productSelect, "unique", "");
|
||||
this.$set(this.attr.productSelect, "cart_num", 0);
|
||||
this.$set(this.attr.productSelect, "product_stock", 0);
|
||||
this.$set(this.attr.productSelect, "quota_show", 0);
|
||||
this.$set(this, "attrValue", "");
|
||||
this.$set(this, "attrTxt", "请选择");
|
||||
} else if (!productSelect && !productAttr.length) {
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"store_name",
|
||||
this.storeCombination.title
|
||||
);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"image",
|
||||
this.storeCombination.image
|
||||
);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"price",
|
||||
this.storeCombination.price
|
||||
);
|
||||
this.$set(this.attr.productSelect, "quota", 0);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"unique",
|
||||
this.storeCombination.unique || ""
|
||||
);
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this.attr.productSelect, "quota_show", 0);
|
||||
this.$set(this.attr.productSelect, "product_stock", 0);
|
||||
this.$set(this, "attrValue", "");
|
||||
this.$set(this, "attrTxt", "请选择");
|
||||
}
|
||||
},
|
||||
setProductSelect: function() {
|
||||
var that = this;
|
||||
var attr = that.attr;
|
||||
attr.productSelect.image = that.storeCombination.image;
|
||||
attr.productSelect.store_name = that.storeCombination.title;
|
||||
attr.productSelect.price = that.storeCombination.price;
|
||||
attr.productSelect.quota = 0;
|
||||
attr.productSelect.quota_show = 0;
|
||||
attr.productSelect.product_stock = 0;
|
||||
attr.cartAttr = false;
|
||||
that.$set(that, "attr", attr);
|
||||
},
|
||||
pay: function() {
|
||||
var that = this;
|
||||
that.attr.cartAttr = true;
|
||||
that.isOpen = true;
|
||||
},
|
||||
goPay() {
|
||||
var that = this;
|
||||
var data = {};
|
||||
// that.attr.cartAttr = res;
|
||||
data.productId = that.storeCombination.product_id;
|
||||
data.cartNum = that.attr.productSelect.cart_num;
|
||||
data.uniqueId = that.attr.productSelect.unique;
|
||||
data.combinationId = that.storeCombination.id;
|
||||
data.new = 1;
|
||||
console.log(that.pinkId);
|
||||
postCartAdd(data)
|
||||
.then(res => {
|
||||
uni.navigateTo({
|
||||
url:'/pages/users/order_confirm/index?cartId=' +res.data.cartId +'&pinkid='+that.pinkId
|
||||
})
|
||||
})
|
||||
.catch(res => {
|
||||
that.$util.Tips({
|
||||
title:res
|
||||
})
|
||||
});
|
||||
},
|
||||
goPoster: function() {
|
||||
var that = this;
|
||||
// this.$router.push({
|
||||
// path: "/activity/poster/" + that.pinkId + "/1"
|
||||
// });
|
||||
uni.navigateTo({
|
||||
url:'/pages/activity/poster-poster/index?type=2&id='+that.pinkId
|
||||
})
|
||||
},
|
||||
goOrder: function() {
|
||||
var that = this;
|
||||
uni.navigateTo({
|
||||
url:"/pages/order_details/index?order_id=" + that.currentPinkOrder
|
||||
})
|
||||
},
|
||||
//拼团列表
|
||||
goList: function() {
|
||||
uni.navigateTo({
|
||||
url:'/pages/activity/goods_combination/index'
|
||||
})
|
||||
},
|
||||
//拼团详情
|
||||
goDetail: function(id) {
|
||||
this.pinkId = id
|
||||
// this.getCombinationPink();
|
||||
uni.navigateTo({
|
||||
url:'/pages/activity/goods_combination_details/index?id='+id
|
||||
})
|
||||
// this.$router.push({
|
||||
// path: "/activity/group_detail/" + id
|
||||
// });
|
||||
},
|
||||
//拼团信息
|
||||
getCombinationPink: function() {
|
||||
var that = this;
|
||||
getCombinationPink(that.pinkId).then(res => {
|
||||
that.$set(
|
||||
that,
|
||||
"storeCombinationHost",
|
||||
res.data.store_combination_host
|
||||
);
|
||||
res.data.pinkT.stop_time = parseInt(res.data.pinkT.stop_time)
|
||||
that.$set(that, "storeCombination", res.data.store_combination);
|
||||
that.$set(that, "pinkT", res.data.pinkT);
|
||||
that.$set(that, "pinkAll", res.data.pinkAll);
|
||||
that.$set(that, "count", res.data.count);
|
||||
that.$set(that, "userBool", res.data.userBool);
|
||||
that.$set(that, "pinkBool", res.data.pinkBool);
|
||||
that.$set(that, "isOk", res.data.is_ok);
|
||||
that.$set(that, "currentPinkOrder", res.data.current_pink_order);
|
||||
that.$set(that, "userInfo", res.data.userInfo);
|
||||
that.attr.productAttr = res.data.store_combination.productAttr;
|
||||
that.productValue = res.data.store_combination.productValue;
|
||||
//#ifdef H5
|
||||
that.setOpenShare();
|
||||
//#endif
|
||||
that.setProductSelect();
|
||||
if (that.attr.productAttr != 0) that.DefaultSelect();
|
||||
});
|
||||
},
|
||||
//#ifdef H5
|
||||
setOpenShare() {
|
||||
let that = this;
|
||||
let configTimeline = {
|
||||
title:
|
||||
"您的好友" +
|
||||
that.userInfo.nickname +
|
||||
"邀请您参团" +
|
||||
that.storeCombination.title,
|
||||
desc: that.storeCombination.title,
|
||||
link:
|
||||
window.location.protocol +
|
||||
"//" +
|
||||
window.location.host +
|
||||
"/pages/activity/goods_combination_status/index?id=" +
|
||||
that.pinkId,
|
||||
imgUrl: that.storeCombination.image
|
||||
};
|
||||
if (this.$wechat.isWeixin()) {
|
||||
this.$wechat.wechatEvevt([
|
||||
"updateAppMessageShareData",
|
||||
"updateTimelineShareData",
|
||||
"onMenuShareAppMessage",
|
||||
"onMenuShareTimeline"
|
||||
],
|
||||
configTimeline
|
||||
)
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
})
|
||||
.catch(res => {
|
||||
if (res.is_ready) {
|
||||
res.wx.updateAppMessageShareData(configTimeline);
|
||||
res.wx.updateTimelineShareData(configTimeline);
|
||||
res.wx.onMenuShareAppMessage(configTimeline);
|
||||
res.wx.onMenuShareTimeline(configTimeline);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
//#endif
|
||||
//拼团取消
|
||||
getCombinationRemove: function() {
|
||||
var that = this;
|
||||
postCombinationRemove({
|
||||
id: that.pinkId,
|
||||
cid: that.storeCombination.id
|
||||
})
|
||||
.then(res => {
|
||||
that.$util.Tips({
|
||||
title:res.msg
|
||||
},{
|
||||
tab: 3,
|
||||
})
|
||||
})
|
||||
.catch(res => {
|
||||
that.$util.Tips({
|
||||
title:res
|
||||
})
|
||||
});
|
||||
},
|
||||
lookAll: function() {
|
||||
this.iShidden = !this.iShidden;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/*开团*/
|
||||
.group-con .header {
|
||||
width: 100%;
|
||||
height: 186rpx;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #f5f5f5;
|
||||
padding: 0 30rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.group-con .header .iconfont {
|
||||
font-size: 100rpx;
|
||||
position: absolute;
|
||||
color: #ccc;
|
||||
right: 33rpx;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
|
||||
.group-con .header .pictrue {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.group-con .header .pictrue img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.group-con .header .text {
|
||||
width: 540rpx;
|
||||
font-size: 30rpx;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.group-con .header .text .money {
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.group-con .header .text .money .num {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.group-con .header .text .money .team {
|
||||
padding: 1rpx 10rpx;
|
||||
font-weight: normal;
|
||||
border-radius: 50rpx;
|
||||
font-size: 20rpx;
|
||||
vertical-align: 4rpx;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper {
|
||||
background-color: #fff;
|
||||
margin-top: 20rpx;
|
||||
padding: 2rpx 0 35rpx 0;
|
||||
}
|
||||
|
||||
.group-con .wrapper .title {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .title .line {
|
||||
width: 136rpx;
|
||||
height: 1px;
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.group-con .wrapper .title .name {
|
||||
margin: 0 45rpx;
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.group-con .wrapper .title .name .time {
|
||||
margin: 0 14rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .title .name .timeTxt {
|
||||
color: #fc4141;
|
||||
}
|
||||
|
||||
.group-con .wrapper .title .name .time .styleAll {
|
||||
background-color: #ffcfcb;
|
||||
text-align: center;
|
||||
border-radius: 3rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
color: #fc4141;
|
||||
padding: 2rpx 5rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .tips {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin-top: 30rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.group-con .wrapper .list {
|
||||
padding: 0 30rpx;
|
||||
margin-top: 45rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .list.result {
|
||||
max-height: 240rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.group-con .wrapper .list.result.on {
|
||||
max-height: 2000rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .list .pictrue {
|
||||
width: 94rpx;
|
||||
height: 94rpx;
|
||||
margin: 0 0 29rpx 35rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .list .pictrue img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 2rpx solid #e93323;
|
||||
}
|
||||
|
||||
.group-con .wrapper .list .pictrue img.img-none {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.group-con .wrapper .lookAll {
|
||||
font-size: 24rpx;
|
||||
color: #282828;
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .lookAll .iconfont {
|
||||
font-size: 25rpx;
|
||||
margin: 2rpx 0 0 10rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .teamBnt {
|
||||
font-size: 30rpx;
|
||||
width: 620rpx;
|
||||
height: 86rpx;
|
||||
border-radius: 50rpx;
|
||||
text-align: center;
|
||||
line-height: 86rpx;
|
||||
color: #fff;
|
||||
margin: 21rpx auto 0 auto;
|
||||
}
|
||||
|
||||
.group-con .wrapper .cancel,
|
||||
.group-con .wrapper .lookOrder {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #282828;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .cancel .iconfont {
|
||||
font-size: 35rpx;
|
||||
color: #2c2c2c;
|
||||
vertical-align: -4rpx;
|
||||
margin-right: 9rpx;
|
||||
}
|
||||
|
||||
.group-con .wrapper .lookOrder .iconfont {
|
||||
font-size: 25rpx;
|
||||
color: #2c2c2c;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.group-con .group-recommend {
|
||||
background-color: #fff;
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .title {
|
||||
padding-right: 30rpx;
|
||||
margin-left: 30rpx;
|
||||
height: 85rpx;
|
||||
border-bottom: 1px solid #eee;
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .title .more {
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .title .more .iconfont {
|
||||
margin-left: 13rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .list {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .list .item {
|
||||
width: 210rpx;
|
||||
margin: 0 0 25rpx 30rpx;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .list .item .pictrue {
|
||||
width: 100%;
|
||||
height: 210rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .list .item .pictrue img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .list .item .pictrue .team {
|
||||
position: absolute;
|
||||
top: 28rpx;
|
||||
left: -5rpx;
|
||||
min-width: 100rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
border-radius: 0 18rpx 18rpx 0;
|
||||
font-size: 20rpx;
|
||||
color: #fff;
|
||||
background-image: linear-gradient(to right, #fb5445 0%, #e93323 100%);
|
||||
background-image: -webkit-linear-gradient(to right, #fb5445 0%, #e93323 100%);
|
||||
background-image: -moz-linear-gradient(to right, #fb5445 0%, #e93323 100%);
|
||||
}
|
||||
|
||||
.group-con .group-recommend .list .item .name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-top: 0.18rem;
|
||||
}
|
||||
|
||||
.group-con .group-recommend .list .item .money {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.share-box {
|
||||
z-index: 1000;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,358 @@
|
|||
<template>
|
||||
<div>
|
||||
<view class='flash-sale'>
|
||||
<view class="saleBox"></view>
|
||||
<view class='header' v-if="timeList.length>0">
|
||||
<image :src='timeList[active].slide'></image>
|
||||
</view>
|
||||
<view class="seckillList acea-row row-between-wrapper">
|
||||
<view class="priceTag">
|
||||
<image src="/static/images/priceTag.png"></image>
|
||||
</view>
|
||||
<view class='timeLsit'>
|
||||
<scroll-view class="scroll-view_x" scroll-x scroll-with-animation :scroll-left="scrollLeft" style="width:auto;overflow:hidden;height:106rpx;">
|
||||
<block v-for="(item,index) in timeList" :key='index'>
|
||||
<view @tap='settimeList(item,index)' class='item' :class="active == index?'on':''">
|
||||
<view class='time'>{{item.time}}</view>
|
||||
<view class="state">{{item.state}}</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='list'>
|
||||
<block v-for="(item,index) in seckillList" :key='index'>
|
||||
<view class='item acea-row row-between-wrapper' @tap='goDetails(item)'>
|
||||
<view class='pictrue'>
|
||||
<image :src='item.image'></image>
|
||||
</view>
|
||||
<view class='text acea-row row-column-around'>
|
||||
<view class='name line1'>{{item.title}}</view>
|
||||
<view class='money'>¥
|
||||
<text class='num font-color'>{{item.price}}</text>
|
||||
<text class="y_money">¥{{item.ot_price}}</text>
|
||||
</view>
|
||||
<view class="limit">限量 <text class="limitPrice">{{item.quota}}件</text></view>
|
||||
<view class="progress">
|
||||
<view class='bg-reds' :style="'width:'+item.percent+'%;'"></view>
|
||||
<view class='piece'>已抢{{item.percent}}%</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='grab bg-color' v-if="status == 1">马上抢</view>
|
||||
<view class='grab bg-color' v-else-if="status == 2">未开始</view>
|
||||
<view class='grab bg-color-hui' v-else>已结束</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class='noCommodity' v-if="seckillList.length == 0 && (page != 1 || active== 0)">
|
||||
<view class='pictrue'>
|
||||
<image src='/static/images/noShopper.png'></image>
|
||||
</view>
|
||||
</view>
|
||||
<home></home>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getSeckillIndexTime,
|
||||
getSeckillList
|
||||
} from '../../../api/activity.js';
|
||||
import home from '@/components/home/index.vue'
|
||||
export default {
|
||||
components: {
|
||||
home
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
topImage: '',
|
||||
seckillList: [],
|
||||
timeList: [],
|
||||
active: 5,
|
||||
scrollLeft: 0,
|
||||
interval: 0,
|
||||
status: 1,
|
||||
countDownHour: "00",
|
||||
countDownMinute: "00",
|
||||
countDownSecond: "00",
|
||||
page: 1,
|
||||
limit: 4,
|
||||
loading: false,
|
||||
loadend: false,
|
||||
pageloading: false,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getSeckillConfig();
|
||||
},
|
||||
methods: {
|
||||
getSeckillConfig: function() {
|
||||
let that = this;
|
||||
getSeckillIndexTime().then(res => {
|
||||
that.topImage = res.data.lovely;
|
||||
that.timeList = res.data.seckillTime;
|
||||
that.active = res.data.seckillTimeIndex;
|
||||
if (that.timeList.length) {
|
||||
// wxh.time(that.data.timeList[that.data.active].stop, that);
|
||||
that.scrollLeft = (that.active - 1.37) * 100
|
||||
setTimeout(function() {
|
||||
that.loading = true
|
||||
}, 2000);
|
||||
that.seckillList = [],
|
||||
that.page = 1
|
||||
that.status = that.timeList[that.active].status
|
||||
that.getSeckillList();
|
||||
}
|
||||
});
|
||||
},
|
||||
getSeckillList: function() {
|
||||
var that = this;
|
||||
var data = {
|
||||
page: that.page,
|
||||
limit: that.limit
|
||||
};
|
||||
if (that.loadend) return;
|
||||
if (that.pageloading) return;
|
||||
this.pageloading = true
|
||||
getSeckillList(that.timeList[that.active].id, data).then(res => {
|
||||
var seckillList = res.data;
|
||||
var loadend = seckillList.length < that.limit;
|
||||
that.page++;
|
||||
that.seckillList = that.seckillList.concat(seckillList),
|
||||
that.page = that.page;
|
||||
that.pageloading = false;
|
||||
that.loadend = loadend;
|
||||
}).catch(err => {
|
||||
that.pageloading = false
|
||||
});
|
||||
},
|
||||
settimeList: function(item, index) {
|
||||
var that = this;
|
||||
this.active = index
|
||||
if (that.interval) {
|
||||
clearInterval(that.interval);
|
||||
that.interval = null
|
||||
}
|
||||
that.interval = 0,
|
||||
that.countDownHour = "00";
|
||||
that.countDownMinute = "00";
|
||||
that.countDownSecond = "00";
|
||||
that.status = that.timeList[that.active].status;
|
||||
that.loadend = false;
|
||||
that.page = 1;
|
||||
that.seckillList = [];
|
||||
// wxh.time(e.currentTarget.dataset.stop, that);
|
||||
that.getSeckillList();
|
||||
},
|
||||
goDetails(item){
|
||||
uni.navigateTo({
|
||||
url: '/pages/activity/goods_seckill_details/index?id=' + item.id + '&time=' + this.timeList[this.active].stop + '&status=' + this.status
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
this.getSeckillList();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #F5F5F5 !important;
|
||||
}
|
||||
|
||||
.flash-sale .header {
|
||||
width: 710rpx;
|
||||
height: 300rpx;
|
||||
margin: -215rpx auto 0 auto;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.flash-sale .header image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.flash-sale .seckillList {
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.flash-sale .seckillList .priceTag {
|
||||
width: 75rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.flash-sale .seckillList .priceTag image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.flash-sale .timeLsit {
|
||||
width: 610rpx;
|
||||
white-space: nowrap;
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
|
||||
.flash-sale .timeLsit .item {
|
||||
display: inline-block;
|
||||
font-size: 20rpx;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
padding: 11rpx 0;
|
||||
box-sizing: border-box;
|
||||
height: 96rpx;
|
||||
margin-right: 35rpx;
|
||||
}
|
||||
|
||||
.flash-sale .timeLsit .item .time {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.flash-sale .timeLsit .item.on .time {
|
||||
color: #E93323;
|
||||
}
|
||||
|
||||
.flash-sale .timeLsit .item.on .state {
|
||||
width: 90rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 15rpx;
|
||||
background: linear-gradient(90deg, rgba(252, 25, 75, 1) 0%, rgba(252, 60, 32, 1) 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.flash-sale .countDown {
|
||||
height: 92rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
margin-top: -14rpx;
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.flash-sale .countDown .num {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
background-color: #ffcfcb;
|
||||
padding: 4rpx 7rpx;
|
||||
border-radius: 3rpx;
|
||||
}
|
||||
|
||||
.flash-sale .countDown .text {
|
||||
font-size: 28rpx;
|
||||
color: #282828;
|
||||
margin-right: 13rpx;
|
||||
}
|
||||
|
||||
.flash-sale .list .item {
|
||||
height: 230rpx;
|
||||
position: relative;
|
||||
width: 710rpx;
|
||||
margin: 0 auto 20rpx auto;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 0 25rpx;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .pictrue {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text {
|
||||
width: 460rpx;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
height: 166rpx;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .name {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .money {
|
||||
font-size: 30rpx;
|
||||
color: #E93323;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .money .num {
|
||||
font-size: 40rpx;
|
||||
font-weight: 500;
|
||||
font-family: 'Guildford Pro';
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .money .y_money {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
text-decoration-line: line-through;
|
||||
margin-left: 15rpx;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .limit {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .limit .limitPrice {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .progress {
|
||||
overflow: hidden;
|
||||
background-color: #FFEFEF;
|
||||
width: 260rpx;
|
||||
border-radius: 18rpx;
|
||||
height: 18rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .progress .bg-reds {
|
||||
width: 0;
|
||||
height: 100%;
|
||||
transition: width 0.6s ease;
|
||||
background: linear-gradient(90deg, rgba(233, 51, 35, 1) 0%, rgba(255, 137, 51, 1) 100%);
|
||||
}
|
||||
|
||||
.flash-sale .list .item .text .progress .piece {
|
||||
position: absolute;
|
||||
left: 8%;
|
||||
transform: translate(0%, -50%);
|
||||
top: 49%;
|
||||
font-size: 16rpx;
|
||||
color: #FFB9B9;
|
||||
}
|
||||
|
||||
.flash-sale .list .item .grab {
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
width: 150rpx;
|
||||
height: 54rpx;
|
||||
border-radius: 27rpx;
|
||||
text-align: center;
|
||||
line-height: 54rpx;
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
bottom: 30rpx;
|
||||
background: #bbbbbb;
|
||||
}
|
||||
|
||||
.flash-sale .saleBox {
|
||||
width: 100%;
|
||||
height: 230rpx;
|
||||
background: rgba(233, 51, 35, 1);
|
||||
border-radius: 0 0 50rpx 50rpx;
|
||||
}
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,136 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class='poster-poster'>
|
||||
<view class='tip'><text class='iconfont icon-shuoming'></text>提示:点击图片即可保存至手机相册 </view>
|
||||
<view class='pictrue'>
|
||||
<image :src='image' mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getBargainPoster, getCombinationPoster } from '../../../api/activity.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
parameter: {
|
||||
'navbar': '1',
|
||||
'return': '1',
|
||||
'title': '拼团海报',
|
||||
'color': true,
|
||||
'class': '0'
|
||||
},
|
||||
type: 0,
|
||||
id: 0,
|
||||
image: '',
|
||||
from:''
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// #ifdef MP
|
||||
this.from = 'routine'
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
this.from = 'wechat'
|
||||
// #endif
|
||||
var that = this;
|
||||
if (options.hasOwnProperty('type') && options.hasOwnProperty('id')) {
|
||||
this.type = options.type
|
||||
this.id = options.id
|
||||
if (options.type == 1) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '砍价海报'
|
||||
})
|
||||
} else {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '拼团海报'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return app.Tips({
|
||||
title: '参数错误',
|
||||
icon: 'none'
|
||||
}, {
|
||||
tab: 3,
|
||||
url: 1
|
||||
});
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getPosterInfo();
|
||||
},
|
||||
methods: {
|
||||
getPosterInfo: function() {
|
||||
var that = this,url = '';
|
||||
let data = {
|
||||
id: that.id,
|
||||
'from': that.from
|
||||
};
|
||||
if (that.type == 1) {
|
||||
getBargainPoster({
|
||||
bargainId: that.id,
|
||||
'from': that.from
|
||||
}).then(res => {
|
||||
that.image = res.data.url
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
} else {
|
||||
getCombinationPoster(data).then(res => {
|
||||
that.image = res.data.url
|
||||
}).catch(err => {
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
showImage: function() {
|
||||
var that = this;
|
||||
let imgArr = this.image.split(',')
|
||||
uni.previewImage({
|
||||
urls: imgArr,
|
||||
longPressActions: {
|
||||
itemList: ['发送给朋友', '保存图片', '收藏'],
|
||||
success: function(data) {
|
||||
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
||||
},
|
||||
fail: function(err) {
|
||||
console.log(err.errMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #d22516 !important;
|
||||
}
|
||||
|
||||
.poster-poster .tip {
|
||||
height: 80rpx;
|
||||
font-size: 26rpx;
|
||||
color: #e8c787;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
.poster-poster .tip .iconfont {
|
||||
font-size: 36rpx;
|
||||
vertical-align: -4rpx;
|
||||
margin-right: 18rpx;
|
||||
}
|
||||
|
||||
.poster-poster .pictrue {
|
||||
width: 690rpx;
|
||||
height: 100%;
|
||||
margin: 0 auto 50rpx auto;
|
||||
}
|
||||
|
||||
.poster-poster .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,360 @@
|
|||
<template>
|
||||
<view class="deliver-goods">
|
||||
<header>
|
||||
<view class="order-num acea-row row-between-wrapper">
|
||||
<view class="num line1">订单号:{{ order_id }}</view>
|
||||
<view class="name line1">
|
||||
<span class="iconfont icon-yonghu2"></span>{{ delivery.nickname }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="address">
|
||||
<view class="name">
|
||||
{{ delivery.real_name
|
||||
}}<span class="phone">{{ delivery.user_phone }}</span>
|
||||
</view>
|
||||
<view>{{ delivery.user_address }}</view>
|
||||
</view>
|
||||
<view class="line"><image src="@/static/images/line.jpg" /></view>
|
||||
</header>
|
||||
<view class="wrapper">
|
||||
<view class="item acea-row row-between-wrapper">
|
||||
<view>发货方式</view>
|
||||
<view class="mode acea-row row-middle row-right">
|
||||
<view class="goods" :class="active === index ? 'on' : ''" v-for="(item, index) in types" :key="index" @click="changeType(item, index)">
|
||||
{{ item.title }}<span class="iconfont icon-xuanzhong2"></span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="logistics.length>0">
|
||||
<view class="list" v-show="active === 0">
|
||||
<view class="item acea-row row-between-wrapper">
|
||||
<view>发货方式</view>
|
||||
<view class="select-box">
|
||||
<picker class="pickerBox" @change="bindPickerChange" :value="seIndex" :range="logistics" range-key="name">
|
||||
<!-- <view></view> -->
|
||||
<view class="uni-input">{{logistics[seIndex].name}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between-wrapper">
|
||||
<view>快递单号</view>
|
||||
<input type="text" placeholder="填写快递单号" v-model="delivery_id" class="mode" />
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="list" v-show="active === 1">
|
||||
<view class="item acea-row row-between-wrapper">
|
||||
<view>送货人</view>
|
||||
<input type="text" placeholder="填写送货人" v-model="delivery_name" class="mode" />
|
||||
</view>
|
||||
<view class="item acea-row row-between-wrapper">
|
||||
<view>送货电话</view>
|
||||
<input type="text" placeholder="填写送货电话" v-model="delivery_id" class="mode" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height:1.2rem;"></view>
|
||||
<view class="confirm" @click="saveInfo">确认提交</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getAdminOrderDelivery,
|
||||
setAdminOrderDelivery,
|
||||
getLogistics
|
||||
} from "@/api/admin";
|
||||
import { checkPhone } from '@/utils/validate.js'
|
||||
export default {
|
||||
name: "GoodsDeliver",
|
||||
components: {},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
types: [{
|
||||
type: "express",
|
||||
title: "发货"
|
||||
},
|
||||
{
|
||||
type: "send",
|
||||
title: "送货"
|
||||
},
|
||||
{
|
||||
type: "fictitious",
|
||||
title: "无需发货"
|
||||
}
|
||||
],
|
||||
active: 0,
|
||||
order_id: "",
|
||||
delivery: [],
|
||||
logistics: [],
|
||||
delivery_type: "express",
|
||||
delivery_name: "",
|
||||
delivery_id: "",
|
||||
seIndex:0,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"$route.params.oid": function(newVal) {
|
||||
let that = this;
|
||||
if (newVal != undefined) {
|
||||
that.order_id = newVal;
|
||||
that.getIndex();
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad: function(option) {
|
||||
this.order_id = option.id;
|
||||
this.getIndex();
|
||||
this.getLogistics();
|
||||
},
|
||||
methods: {
|
||||
changeType: function(item, index) {
|
||||
this.active = index;
|
||||
this.delivery_type = item.type;
|
||||
this.delivery_name = "";
|
||||
this.delivery_id = "";
|
||||
},
|
||||
getIndex: function() {
|
||||
let that = this;
|
||||
getAdminOrderDelivery(that.order_id).then(
|
||||
res => {
|
||||
that.delivery = res.data;
|
||||
},
|
||||
error => {
|
||||
that.$dialog.error(error.msg);
|
||||
}
|
||||
);
|
||||
},
|
||||
getLogistics: function() {
|
||||
let that = this;
|
||||
getLogistics().then(
|
||||
res => {
|
||||
that.logistics = res.data;
|
||||
},
|
||||
error => {
|
||||
that.$dialog.error(error.msg);
|
||||
}
|
||||
);
|
||||
},
|
||||
async saveInfo() {
|
||||
let that = this,
|
||||
delivery_type = that.delivery_type,
|
||||
delivery_name = that.logistics[that.seIndex].name,
|
||||
delivery_id = that.delivery_id,
|
||||
userName = that.delivery_name,
|
||||
save = {};
|
||||
save.order_id = that.order_id;
|
||||
save.delivery_type = that.delivery_type;
|
||||
switch (delivery_type) {
|
||||
case "send":
|
||||
if(!userName){
|
||||
return that.$util.Tips({
|
||||
title:'请填写送货人姓名'
|
||||
})
|
||||
}
|
||||
if(!delivery_id || !checkPhone(delivery_id)){
|
||||
return that.$util.Tips({
|
||||
title:'请填写正确的手机号码'
|
||||
})
|
||||
}
|
||||
save.delivery_name = userName;
|
||||
save.delivery_id = delivery_id;
|
||||
that.setInfo(save);
|
||||
break;
|
||||
case "express":
|
||||
if(!delivery_id){
|
||||
return this.$util.Tips({
|
||||
title:'请填写快递单号'
|
||||
})
|
||||
}
|
||||
save.delivery_name = delivery_name;
|
||||
save.delivery_id = delivery_id;
|
||||
that.setInfo(save);
|
||||
break;
|
||||
case "fictitious":
|
||||
that.setInfo(save);
|
||||
break;
|
||||
}
|
||||
},
|
||||
setInfo: function(item) {
|
||||
let that = this;
|
||||
console.log(item);
|
||||
setAdminOrderDelivery(item).then(
|
||||
res => {
|
||||
that.$util.Tips({
|
||||
title:res.msg,
|
||||
icon:'success',
|
||||
mask:true
|
||||
})
|
||||
setTimeout(res=>{
|
||||
uni.navigateBack();
|
||||
},2000)
|
||||
},
|
||||
error => {
|
||||
that.$dialog.error(error.msg);
|
||||
}
|
||||
);
|
||||
},
|
||||
bindPickerChange(e){
|
||||
console.log(e,'tar')
|
||||
this.seIndex = e.detail.value
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/*发货*/
|
||||
.deliver-goods header {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
margin-top: 10upx;
|
||||
}
|
||||
|
||||
.deliver-goods header .order-num {
|
||||
padding: 0 30upx;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
height: 67upx;
|
||||
}
|
||||
|
||||
.deliver-goods header .order-num .num {
|
||||
width: 430upx;
|
||||
font-size: 26upx;
|
||||
color: #282828;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.deliver-goods header .order-num .num:after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
width: 1px;
|
||||
height: 30upx;
|
||||
background-color: #ddd;
|
||||
top: 50%;
|
||||
margin-top: -15upx;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.deliver-goods header .order-num .name {
|
||||
width: 260upx;
|
||||
font-size: 26upx;
|
||||
color: #282828;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.deliver-goods header .order-num .name .iconfont {
|
||||
font-size: 35upx;
|
||||
color: #477ef3;
|
||||
vertical-align: middle;
|
||||
margin-right: 10upx;
|
||||
}
|
||||
|
||||
.deliver-goods header .address {
|
||||
font-size: 26upx;
|
||||
color: #868686;
|
||||
background-color: #fff;
|
||||
padding: 30upx;
|
||||
}
|
||||
|
||||
.deliver-goods header .address .name {
|
||||
font-size: 34upx;
|
||||
color: #282828;
|
||||
margin-bottom: 10upx;
|
||||
}
|
||||
|
||||
.deliver-goods header .address .name .phone {
|
||||
margin-left: 40upx;
|
||||
}
|
||||
|
||||
.deliver-goods header .line {
|
||||
width: 100%;
|
||||
height: 3upx;
|
||||
}
|
||||
|
||||
.deliver-goods header .line image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item {
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
padding: 0 30upx;
|
||||
height: 96upx;
|
||||
font-size: 32upx;
|
||||
color: #282828;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item .mode {
|
||||
width: 460upx;
|
||||
height: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item .mode .iconfont {
|
||||
font-size: 30upx;
|
||||
margin-left: 13upx;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item .mode .goods~.goods {
|
||||
margin-left: 30upx;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item .mode .goods {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item .mode .goods.on {
|
||||
color: #477ef3;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item .icon-up {
|
||||
position: absolute;
|
||||
font-size: 35upx;
|
||||
color: #2c2c2c;
|
||||
right: 30upx;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item select {
|
||||
direction: rtl;
|
||||
padding-right: 60upx;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.deliver-goods .wrapper .item input::placeholder {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.deliver-goods .confirm {
|
||||
font-size: 32upx;
|
||||
color: #fff;
|
||||
width: 100%;
|
||||
height: 100upx;
|
||||
background-color: #477ef3;
|
||||
text-align: center;
|
||||
line-height: 100upx;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
}
|
||||
.select-box{
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
|
||||
.pickerBox{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,776 @@
|
|||
<template>
|
||||
<view class="order-details pos-order-details">
|
||||
<view class="header acea-row row-middle">
|
||||
<view class="state">{{ title }}</view>
|
||||
<view class="data">
|
||||
<view class="order-num">订单:{{ orderInfo.order_id }}</view>
|
||||
<view>
|
||||
<span class="time">{{ orderInfo.add_time }}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="remarks acea-row row-between-wrapper" v-if="goname != 'looks'">
|
||||
<span class="iconfont icon-zhinengkefu-"></span>
|
||||
<input type="button" class="line1" style="text-align: left;" :value="
|
||||
orderInfo.remark ? orderInfo.remark : '订单未备注,点击添加备注信息'
|
||||
"
|
||||
@click="modify('1')" />
|
||||
</view>
|
||||
<view class="orderingUser acea-row row-middle">
|
||||
<span class="iconfont icon-yonghu2"></span>{{ orderInfo.nickname }}
|
||||
</view>
|
||||
<view class="address">
|
||||
<view class="name">
|
||||
{{ orderInfo.real_name
|
||||
}}<span class="phone">{{ orderInfo.user_phone }}</span>
|
||||
</view>
|
||||
<view>{{ orderInfo.user_address }}</view>
|
||||
</view>
|
||||
<view class="line">
|
||||
<image src="/static/images/line.jpg" />
|
||||
</view>
|
||||
<view class="pos-order-goods">
|
||||
<navigator :url="`/pages/goods_details/index?id=${item.cart_info.productInfo.product_id}`" hover-class="none" class="goods acea-row row-between-wrapper" v-for="(item, index) in orderInfo._info" :key="index">
|
||||
<view class="picTxt acea-row row-between-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="item.cart_info.productInfo.image" />
|
||||
</view>
|
||||
<view class="text acea-row row-between row-column">
|
||||
<view class="info line2">
|
||||
{{ item.cart_info.productInfo.store_name }}
|
||||
</view>
|
||||
<view class="attr">{{ item.cart_info.productInfo.suk }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="money">
|
||||
<view class="x-money">¥{{ item.cart_info.productInfo.price }}</view>
|
||||
<view class="num">x{{ item.cart_info.cart_num }}</view>
|
||||
<view class="y-money">¥{{ item.cart_info.productInfo.ot_price }}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="public-total">
|
||||
共{{ orderInfo.total_num }}件商品,应支付
|
||||
<span class="money">¥{{ orderInfo.pay_price }}</span> ( 邮费 ¥{{
|
||||
orderInfo.pay_postage
|
||||
}}
|
||||
)
|
||||
</view>
|
||||
<view class="wrapper">
|
||||
<view class="item acea-row row-between">
|
||||
<view>订单编号:</view>
|
||||
<view class="conter acea-row row-middle row-right">
|
||||
{{ orderInfo.order_id
|
||||
}}
|
||||
<!-- #ifdef H5 -->
|
||||
<span class="copy copy-data" :data-clipboard-text="orderInfo.order_id">复制</span>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<span class="copy copy-data" @click="copyNum(orderInfo.order_id)">复制</span>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between">
|
||||
<view>下单时间:</view>
|
||||
<view class="conter">{{ orderInfo.add_time }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between">
|
||||
<view>支付状态:</view>
|
||||
<view class="conter">
|
||||
{{ orderInfo.paid == 1 ? "已支付" : "未支付" }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between">
|
||||
<view>支付方式:</view>
|
||||
<view class="conter">{{ payType }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between">
|
||||
<view>买家留言:</view>
|
||||
<view class="conter">{{ orderInfo.mark }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper">
|
||||
<view class="item acea-row row-between">
|
||||
<view>支付金额:</view>
|
||||
<view class="conter">¥{{ orderInfo.total_price }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between">
|
||||
<view>优惠券抵扣:</view>
|
||||
<view class="conter">-¥{{ orderInfo.coupon_price }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between">
|
||||
<view>运费:</view>
|
||||
<view class="conter">¥{{ orderInfo.freight_price }}</view>
|
||||
</view>
|
||||
<view class="actualPay acea-row row-right">
|
||||
实付款:<span class="money font-color-red">¥{{ orderInfo.pay_price }}</span>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper" v-if="
|
||||
orderInfo.delivery_type != 'fictitious' && orderInfo._status._type === 2
|
||||
">
|
||||
<view class="item acea-row row-between">
|
||||
<view>配送方式:</view>
|
||||
<view class="conter" v-if="orderInfo.delivery_type === 'express'">
|
||||
快递
|
||||
</view>
|
||||
<view class="conter" v-if="orderInfo.delivery_type === 'send'">送货</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between">
|
||||
<view v-if="orderInfo.delivery_type === 'express'">快递公司:</view>
|
||||
<view v-if="orderInfo.delivery_type === 'send'">送货人:</view>
|
||||
<view class="conter">{{ orderInfo.delivery_name }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between">
|
||||
<view v-if="orderInfo.delivery_type === 'express'">快递单号:</view>
|
||||
<view v-if="orderInfo.delivery_type === 'send'">送货人电话:</view>
|
||||
<view class="conter">
|
||||
{{ orderInfo.delivery_id
|
||||
}}<span class="copy copy-data" :data-clipboard-text="orderInfo.delivery_id">复制</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height:120upx;"></view>
|
||||
<view class="footer acea-row row-right row-middle" v-if="goname != 'looks'">
|
||||
<view class="more"></view>
|
||||
<view class="bnt cancel" @click="modify('0')" v-if="types == 0">
|
||||
一键改价
|
||||
</view>
|
||||
<view class="bnt cancel" @click="modify('0')" v-if="types == -1">
|
||||
立即退款
|
||||
</view>
|
||||
<view class="bnt cancel" @click="modify('1')">订单备注</view>
|
||||
<view class="bnt cancel" v-if="orderInfo.pay_type === 'offline' && orderInfo.paid === 0" @click="offlinePay">
|
||||
确认付款
|
||||
</view>
|
||||
<navigator class="bnt delivery" v-if="types == 1" :url="'/pages/admin/delivery/index?id='+orderInfo.order_id">去发货</navigator>
|
||||
</view>
|
||||
<PriceChange :change="change" :orderInfo="orderInfo" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice"
|
||||
:status="status"></PriceChange>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import PriceChange from "@/components/PriceChange";
|
||||
// #ifdef H5
|
||||
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
|
||||
// #endif
|
||||
import {
|
||||
getAdminOrderDetail,
|
||||
setAdminOrderPrice,
|
||||
setAdminOrderRemark,
|
||||
setOfflinePay,
|
||||
setOrderRefund
|
||||
} from "@/api/admin";
|
||||
// import { required, num } from "@utils/validate";
|
||||
// import { validatorDefaultCatch } from "@utils/dialog";
|
||||
import {
|
||||
isMoney
|
||||
} from '@/utils/validate.js'
|
||||
|
||||
export default {
|
||||
name: "AdminOrder",
|
||||
components: {
|
||||
PriceChange
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
order: false,
|
||||
change: false,
|
||||
order_id: "",
|
||||
orderInfo: {
|
||||
_status: {}
|
||||
},
|
||||
status: "",
|
||||
title: "",
|
||||
payType: "",
|
||||
types: "",
|
||||
clickNum: 1,
|
||||
goname:''
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"$route.params.oid": function(newVal) {
|
||||
let that = this;
|
||||
if (newVal != undefined) {
|
||||
that.order_id = newVal;
|
||||
that.getIndex();
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad: function(option) {
|
||||
let self = this
|
||||
this.order_id = option.id;
|
||||
this.goname = option.goname
|
||||
this.getIndex();
|
||||
// #ifdef H5
|
||||
this.$nextTick(function() {
|
||||
var clipboard = new ClipboardJS('.copy-data');
|
||||
// var copybtn = document.getElementsByClassName("copy-data");
|
||||
// var clipboard = new Clipboard(copybtn);
|
||||
clipboard.on('success', function(e) {
|
||||
self.$util.Tips({
|
||||
title:'复制成功'
|
||||
})
|
||||
});
|
||||
clipboard.on('error', function(e) {
|
||||
self.$util.Tips({
|
||||
title:'复制失败'
|
||||
})
|
||||
});
|
||||
});
|
||||
// #endif
|
||||
|
||||
},
|
||||
methods: {
|
||||
more: function() {
|
||||
this.order = !this.order;
|
||||
},
|
||||
modify: function(status) {
|
||||
this.change = true;
|
||||
this.status = status;
|
||||
},
|
||||
changeclose: function(msg) {
|
||||
this.change = msg;
|
||||
},
|
||||
getIndex: function() {
|
||||
let that = this;
|
||||
getAdminOrderDetail(that.order_id).then(
|
||||
res => {
|
||||
that.orderInfo = res.data;
|
||||
that.types = res.data._status._type;
|
||||
that.title = res.data._status._title;
|
||||
that.payType = res.data._status._payType;
|
||||
},
|
||||
err => {
|
||||
that.$util.Tips({
|
||||
title: err
|
||||
}, {
|
||||
tab: 3,
|
||||
url: 1
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
async savePrice(opt) {
|
||||
let that = this,
|
||||
data = {},
|
||||
price = opt.price,
|
||||
refund_price = opt.refund_price,
|
||||
refund_status = that.orderInfo.refund_status,
|
||||
remark = opt.remark;
|
||||
data.order_id = that.orderInfo.order_id;
|
||||
if (that.status == 0 && refund_status === 0) {
|
||||
if (!isMoney(price)) {
|
||||
return that.$util.Tips({
|
||||
title: '请输入正确的金额'
|
||||
});
|
||||
}
|
||||
data.price = price;
|
||||
setAdminOrderPrice(data).then(
|
||||
function() {
|
||||
that.change = false;
|
||||
that.$util.Tips({
|
||||
title: '改价成功',
|
||||
icon: 'success'
|
||||
})
|
||||
that.getIndex();
|
||||
},
|
||||
function() {
|
||||
that.change = false;
|
||||
that.$util.Tips({
|
||||
title: '改价失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
);
|
||||
} else if (that.status == 0 && refund_status === 1) {
|
||||
if (!isMoney(refund_price)) {
|
||||
return that.$util.Tips({
|
||||
title: '请输入正确的金额'
|
||||
});
|
||||
}
|
||||
data.price = refund_price;
|
||||
data.type = opt.type;
|
||||
setOrderRefund(data).then(
|
||||
res => {
|
||||
that.change = false;
|
||||
that.$util.Tips({
|
||||
title: res.msg
|
||||
});
|
||||
that.getIndex();
|
||||
},
|
||||
err => {
|
||||
console.log(err, 'err')
|
||||
that.change = false;
|
||||
that.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (!remark) {
|
||||
return this.$util.Tips({
|
||||
title: '请输入备注'
|
||||
})
|
||||
}
|
||||
data.remark = remark;
|
||||
setAdminOrderRemark(data).then(
|
||||
res => {
|
||||
that.change = false;
|
||||
this.$util.Tips({
|
||||
title: res.msg,
|
||||
icon: 'success'
|
||||
})
|
||||
that.getIndex();
|
||||
},
|
||||
err => {
|
||||
that.change = false;
|
||||
that.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
offlinePay: function() {
|
||||
setOfflinePay({
|
||||
order_id: this.orderInfo.order_id
|
||||
}).then(
|
||||
res => {
|
||||
this.$util.Tips({
|
||||
title: res.msg,
|
||||
icon: 'success'
|
||||
});
|
||||
this.getIndex();
|
||||
},
|
||||
err => {
|
||||
this.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
// #ifdef MP
|
||||
copyNum(id) {
|
||||
|
||||
uni.setClipboardData({
|
||||
data: id,
|
||||
success: function() {
|
||||
console.log('success');
|
||||
}
|
||||
});
|
||||
},
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
webCopy(item, index) {
|
||||
console.log('yunxingle')
|
||||
let items = item
|
||||
let indexs = index
|
||||
let self = this
|
||||
|
||||
if (self.clickNum == 1) {
|
||||
console.log('22')
|
||||
self.clickNum += 1
|
||||
self.webCopy(items, indexs)
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/*商户管理订单详情*/
|
||||
.pos-order-details .header {
|
||||
background: linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||
background: -webkit-linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||
background: -moz-linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||
}
|
||||
|
||||
.pos-order-details .header .state {
|
||||
font-size: 36upx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.pos-order-details .header .data {
|
||||
margin-left: 35upx;
|
||||
font-size: 28upx;
|
||||
}
|
||||
|
||||
.pos-order-details .header .data .order-num {
|
||||
font-size: 30upx;
|
||||
margin-bottom: 8upx;
|
||||
}
|
||||
|
||||
.pos-order-details .remarks {
|
||||
width: 100%;
|
||||
height: 86upx;
|
||||
background-color: #fff;
|
||||
padding: 0 30upx;
|
||||
}
|
||||
|
||||
.pos-order-details .remarks .iconfont {
|
||||
font-size: 40upx;
|
||||
color: #2a7efb;
|
||||
}
|
||||
|
||||
.pos-order-details .remarks input {
|
||||
width: 630upx;
|
||||
height: 100%;
|
||||
font-size: 30upx;
|
||||
}
|
||||
|
||||
.pos-order-details .remarks input::placeholder {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.pos-order-details .orderingUser {
|
||||
font-size: 26upx;
|
||||
color: #282828;
|
||||
padding: 0 30upx;
|
||||
height: 67upx;
|
||||
background-color: #fff;
|
||||
margin-top: 16upx;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
.pos-order-details .orderingUser .iconfont {
|
||||
font-size: 40upx;
|
||||
color: #2a7efb;
|
||||
margin-right: 15upx;
|
||||
}
|
||||
|
||||
.pos-order-details .address {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.pos-order-details .pos-order-goods {
|
||||
margin-top: 17upx;
|
||||
}
|
||||
|
||||
.pos-order-details .footer .more {
|
||||
font-size: 27upx;
|
||||
color: #aaa;
|
||||
width: 100upx;
|
||||
height: 64upx;
|
||||
text-align: center;
|
||||
line-height: 64upx;
|
||||
margin-right: 25upx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pos-order-details .footer .delivery {
|
||||
background: linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||
background: -webkit-linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||
background: -moz-linear-gradient(to right, #2291f8 0%, #1cd1dc 100%);
|
||||
}
|
||||
|
||||
.pos-order-details .footer .more .order .arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 11upx solid transparent;
|
||||
border-right: 11upx solid transparent;
|
||||
border-top: 20upx solid #e5e5e5;
|
||||
position: absolute;
|
||||
left: 15upx;
|
||||
bottom: -18upx;
|
||||
}
|
||||
|
||||
.pos-order-details .footer .more .order .arrow:before {
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 9upx solid transparent;
|
||||
border-right: 9upx solid transparent;
|
||||
border-top: 19upx solid #fff;
|
||||
position: absolute;
|
||||
left: -10upx;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.pos-order-details .footer .more .order {
|
||||
width: 200upx;
|
||||
background-color: #fff;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 10upx;
|
||||
position: absolute;
|
||||
top: -200upx;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.pos-order-details .footer .more .order .item {
|
||||
height: 77upx;
|
||||
line-height: 77upx;
|
||||
}
|
||||
|
||||
.pos-order-details .footer .more .order .item~.item {
|
||||
border-top: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
.pos-order-details .footer .more .moreName {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/*订单详情*/
|
||||
.order-details .header {
|
||||
padding: 0 30upx;
|
||||
height: 150upx;
|
||||
}
|
||||
|
||||
.order-details .header.on {
|
||||
background-color: #666 !important;
|
||||
}
|
||||
|
||||
.order-details .header .pictrue {
|
||||
width: 110upx;
|
||||
height: 110upx;
|
||||
}
|
||||
|
||||
.order-details .header .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.order-details .header .data {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
font-size: 24upx;
|
||||
margin-left: 27upx;
|
||||
}
|
||||
|
||||
.order-details .header.on .data {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.order-details .header .data .state {
|
||||
font-size: 30upx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
margin-bottom: 7upx;
|
||||
}
|
||||
|
||||
/* .order-details .header .data .time{margin-left:20upx;} */
|
||||
.order-details .nav {
|
||||
background-color: #fff;
|
||||
font-size: 26upx;
|
||||
color: #282828;
|
||||
padding: 25upx 0;
|
||||
}
|
||||
|
||||
.order-details .nav .navCon {
|
||||
padding: 0 40upx;
|
||||
}
|
||||
|
||||
.order-details .nav .navCon .on {
|
||||
font-weight: bold;
|
||||
color: #e93323;
|
||||
}
|
||||
|
||||
.order-details .nav .progress {
|
||||
padding: 0 65upx;
|
||||
margin-top: 10upx;
|
||||
}
|
||||
|
||||
.order-details .nav .progress .line {
|
||||
width: 100upx;
|
||||
height: 2upx;
|
||||
background-color: #939390;
|
||||
}
|
||||
|
||||
.order-details .nav .progress .iconfont {
|
||||
font-size: 25upx;
|
||||
color: #939390;
|
||||
margin-top: -2upx;
|
||||
width: 30upx;
|
||||
height: 30upx;
|
||||
line-height: 33upx;
|
||||
text-align: center;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.order-details .address {
|
||||
font-size: 26upx;
|
||||
color: #868686;
|
||||
background-color: #fff;
|
||||
padding: 25upx 30upx 30upx 30upx;
|
||||
}
|
||||
|
||||
.order-details .address .name {
|
||||
font-size: 30upx;
|
||||
color: #282828;
|
||||
margin-bottom: 0.1rem;
|
||||
}
|
||||
|
||||
.order-details .address .name .phone {
|
||||
margin-left: 40upx;
|
||||
}
|
||||
|
||||
.order-details .line {
|
||||
width: 100%;
|
||||
height: 3upx;
|
||||
}
|
||||
|
||||
.order-details .line image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.order-details .wrapper {
|
||||
background-color: #fff;
|
||||
margin-top: 12upx;
|
||||
padding: 30upx;
|
||||
}
|
||||
|
||||
.order-details .wrapper .item {
|
||||
font-size: 28upx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.order-details .wrapper .item~.item {
|
||||
margin-top: 20upx;
|
||||
}
|
||||
|
||||
.order-details .wrapper .item .conter {
|
||||
color: #868686;
|
||||
width: 500upx;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.order-details .wrapper .item .conter .copy {
|
||||
font-size: 20rpx;
|
||||
color: #333;
|
||||
border-radius: 3rpx;
|
||||
border: 1px solid #666;
|
||||
padding: 0rpx 15rpx;
|
||||
margin-left: 24rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.order-details .wrapper .actualPay {
|
||||
border-top: 1upx solid #eee;
|
||||
margin-top: 30upx;
|
||||
padding-top: 30upx;
|
||||
}
|
||||
|
||||
.order-details .wrapper .actualPay .money {
|
||||
font-weight: bold;
|
||||
font-size: 30upx;
|
||||
}
|
||||
|
||||
.order-details .footer {
|
||||
width: 100%;
|
||||
height: 100upx;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
padding: 0 30upx;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
|
||||
.order-details .footer .bnt {
|
||||
width: auto;
|
||||
height: 60upx;
|
||||
line-height: 60upx;
|
||||
text-align: center;
|
||||
line-height: upx;
|
||||
border-radius: 50upx;
|
||||
color: #fff;
|
||||
font-size: 27upx;
|
||||
padding: 0 3%;
|
||||
}
|
||||
|
||||
.order-details .footer .bnt.cancel {
|
||||
color: #aaa;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.order-details .footer .bnt.default {
|
||||
color: #444;
|
||||
border: 1px solid #444;
|
||||
}
|
||||
|
||||
.order-details .footer .bnt~.bnt {
|
||||
margin-left: 18upx;
|
||||
}
|
||||
|
||||
.pos-order-goods {
|
||||
padding: 0 30upx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods {
|
||||
height: 185upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods~.goods {
|
||||
border-top: 1px dashed #e5e5e5;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt {
|
||||
width: 515upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .pictrue {
|
||||
width: 130upx;
|
||||
height: 130upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .text {
|
||||
width: 365upx;
|
||||
height: 130upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .text .info {
|
||||
font-size: 28upx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .text .attr {
|
||||
font-size: 24upx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .money {
|
||||
width: 164upx;
|
||||
text-align: right;
|
||||
font-size: 28upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .money .x-money {
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .money .num {
|
||||
color: #ff9600;
|
||||
margin: 5upx 0;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .money .y-money {
|
||||
color: #999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.public-total {
|
||||
font-size: 28upx;
|
||||
color: #282828;
|
||||
border-top: 1px solid #eee;
|
||||
height: 92upx;
|
||||
line-height: 92upx;
|
||||
text-align: right;
|
||||
padding: 0 30upx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.public-total .money {
|
||||
color: #ff4c3c;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,467 @@
|
|||
<template>
|
||||
<view class="pos-order-list" ref="container">
|
||||
<view class="nav acea-row row-around row-middle">
|
||||
<view class="item" :class="where.status == 0 ? 'on' : ''" @click="changeStatus(0)">
|
||||
待付款
|
||||
</view>
|
||||
<view class="item" :class="where.status == 1 ? 'on' : ''" @click="changeStatus(1)">
|
||||
待发货
|
||||
</view>
|
||||
<view class="item" :class="where.status == 2 ? 'on' : ''" @click="changeStatus(2)">
|
||||
待收货
|
||||
</view>
|
||||
<view class="item" :class="where.status == 3 ? 'on' : ''" @click="changeStatus(3)">
|
||||
待评价
|
||||
</view>
|
||||
<view class="item" :class="where.status == 4 ? 'on' : ''" @click="changeStatus(4)">
|
||||
已完成
|
||||
</view>
|
||||
<view class="item" :class="where.status == -3 ? 'on' : ''" @click="changeStatus(-3)">
|
||||
退款
|
||||
</view>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view class="item" v-for="(item, index) in list" :key="index">
|
||||
<view class="order-num acea-row row-middle" @click="toDetail(item)">
|
||||
订单号:{{ item.order_id }}
|
||||
<span class="time">下单时间:{{ item.add_time }}</span>
|
||||
</view>
|
||||
<view class="pos-order-goods" v-for="(val, key) in item._info" :key="key">
|
||||
<view class="goods acea-row row-between-wrapper" @click="toDetail(item)">
|
||||
<view class="picTxt acea-row row-between-wrapper">
|
||||
<view class="pictrue">
|
||||
<image :src="val.cart_info.productInfo.image" />
|
||||
</view>
|
||||
<view class="text acea-row row-between row-column">
|
||||
<view class="info line2">
|
||||
{{ val.cart_info.productInfo.store_name }}
|
||||
</view>
|
||||
<view class="attr" v-if="val.cart_info.productInfo.suk">
|
||||
{{ val.cart_info.productInfo.suk }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="money">
|
||||
<view class="x-money">¥{{ val.cart_info.productInfo.price }}</view>
|
||||
<view class="num">x{{ val.cart_info.cart_num }}</view>
|
||||
<view class="y-money">
|
||||
¥{{ val.cart_info.productInfo.ot_price }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="public-total">
|
||||
共{{ item.total_num }}件商品,应支付
|
||||
<span class="money">¥{{ item.pay_price }}</span> ( 邮费 ¥{{
|
||||
item.total_postage
|
||||
}}
|
||||
)
|
||||
</view>
|
||||
<view class="operation acea-row row-between-wrapper">
|
||||
<view class="more">
|
||||
<!-- <view class="iconfont icon-gengduo" @click="more(index)"></view>-->
|
||||
<!-- <view class="order" v-show="current === index">-->
|
||||
<!-- <view class="items">-->
|
||||
<!-- {{ where.status > 0 ? "删除" : "取消" }}订单-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="arrow"></view>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
<view class="acea-row row-middle">
|
||||
<view class="bnt" @click="modify(item, 0)" v-if="where.status == 0">
|
||||
一键改价
|
||||
</view>
|
||||
<view class="bnt" @click="modify(item, 1)">订单备注</view>
|
||||
<view class="bnt" @click="modify(item, 0)" v-if="where.status == -3 && item.refund_status === 1">
|
||||
立即退款
|
||||
</view>
|
||||
<view class="bnt cancel" v-if="item.pay_type === 'offline' && item.paid === 0" @click="offlinePay(item)">
|
||||
确认付款
|
||||
</view>
|
||||
<navigator class="bnt" v-if="where.status == 1" :url="'/pages/admin/delivery/index?id='+item.order_id">去发货
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<Loading :loaded="loaded" :loading="loading"></Loading>
|
||||
<PriceChange :change="change" :orderInfo="orderInfo" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice"
|
||||
:status="status"></PriceChange>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getAdminOrderList,
|
||||
setAdminOrderPrice,
|
||||
setAdminOrderRemark,
|
||||
setOfflinePay,
|
||||
setOrderRefund
|
||||
} from "@/api/admin";
|
||||
import Loading from '@/components/Loading/index'
|
||||
import PriceChange from '@/components/PriceChange/index'
|
||||
import { isMoney } from '@/utils/validate.js'
|
||||
export default {
|
||||
name: "AdminOrderList",
|
||||
components: {
|
||||
Loading,
|
||||
PriceChange
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
current: "",
|
||||
change: false,
|
||||
types: 0,
|
||||
where: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
status: 0
|
||||
},
|
||||
list: [],
|
||||
loaded: false,
|
||||
loading: false,
|
||||
orderInfo: {},
|
||||
status: ""
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"$route.params.types": function(newVal) {
|
||||
let that = this;
|
||||
if (newVal != undefined) {
|
||||
that.where.status = newVal;
|
||||
that.init();
|
||||
}
|
||||
},
|
||||
types: function() {
|
||||
this.getIndex();
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.where.status = option.types
|
||||
this.current = "";
|
||||
this.getIndex();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据
|
||||
getIndex: function() {
|
||||
let that = this;
|
||||
if (that.loading || that.loaded) return;
|
||||
that.loading = true;
|
||||
getAdminOrderList(that.where).then(
|
||||
res => {
|
||||
that.loading = false;
|
||||
that.loaded = res.data.length < that.where.limit;
|
||||
that.list.push.apply(that.list, res.data);
|
||||
that.where.page = that.where.page + 1;
|
||||
},
|
||||
err => {
|
||||
that.$dialog.error(err.msg);
|
||||
}
|
||||
);
|
||||
},
|
||||
// 初始化
|
||||
init: function() {
|
||||
this.list = [];
|
||||
this.where.page = 1;
|
||||
this.loaded = false;
|
||||
this.loading = false;
|
||||
this.getIndex();
|
||||
this.current = "";
|
||||
},
|
||||
// 导航切换
|
||||
changeStatus(val) {
|
||||
if (this.where.status != val) {
|
||||
this.where.status = val;
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
// 商品操作
|
||||
modify: function(item, status) {
|
||||
let temp = status.toString()
|
||||
this.change = true;
|
||||
this.orderInfo = item;
|
||||
this.status = temp;
|
||||
},
|
||||
changeclose: function(msg) {
|
||||
this.change = msg;
|
||||
},
|
||||
async savePrice(opt) {
|
||||
let that = this,
|
||||
data = {},
|
||||
price = opt.price,
|
||||
refund_price = opt.refund_price,
|
||||
refund_status = that.orderInfo.refund_status,
|
||||
remark = opt.remark;
|
||||
data.order_id = that.orderInfo.order_id;
|
||||
if (that.status == 0 && refund_status === 0) {
|
||||
if(!isMoney(price)){
|
||||
return that.$util.Tips({title: '请输入正确的金额'});
|
||||
}
|
||||
data.price = price;
|
||||
setAdminOrderPrice(data).then(
|
||||
function() {
|
||||
that.change = false;
|
||||
that.$util.Tips({
|
||||
title:'改价成功',
|
||||
icon:'success'
|
||||
})
|
||||
that.init();
|
||||
},
|
||||
function() {
|
||||
that.change = false;
|
||||
that.$util.Tips({
|
||||
title:'改价失败',
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
);
|
||||
} else if (that.status == 0 && refund_status === 1) {
|
||||
if(!isMoney(refund_price)){
|
||||
return that.$util.Tips({title: '请输入正确的金额'});
|
||||
}
|
||||
data.price = refund_price;
|
||||
data.type = opt.type;
|
||||
setOrderRefund(data).then(
|
||||
res => {
|
||||
that.change = false;
|
||||
that.$util.Tips({title: res.msg});
|
||||
that.init();
|
||||
},
|
||||
err => {
|
||||
console.log(err,'err')
|
||||
that.change = false;
|
||||
that.$util.Tips({title: err});
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
||||
if(!remark){
|
||||
return this.$util.Tips({
|
||||
title:'请输入备注'
|
||||
})
|
||||
}
|
||||
data.remark = remark;
|
||||
setAdminOrderRemark(data).then(
|
||||
res => {
|
||||
that.change = false;
|
||||
this.$util.Tips({
|
||||
title:res.msg,
|
||||
icon:'success'
|
||||
})
|
||||
that.init();
|
||||
},
|
||||
err => {
|
||||
that.change = false;
|
||||
that.$util.Tips({title: err});
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
toDetail(item){
|
||||
uni.navigateTo({
|
||||
url:`/pages/admin/orderDetail/index?id=${item.order_id}`
|
||||
})
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.getIndex()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.pos-order-list .nav {
|
||||
width: 100%;
|
||||
height: 96upx;
|
||||
background-color: #fff;
|
||||
font-size: 30upx;
|
||||
color: #282828;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.pos-order-list .nav .item.on {
|
||||
color: #2291f8;
|
||||
}
|
||||
|
||||
.pos-order-list .list {
|
||||
margin-top: 120upx;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item~.item {
|
||||
margin-top: 24upx;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .order-num {
|
||||
height: 124upx;
|
||||
border-bottom: 1px solid #eee;
|
||||
font-size: 30upx;
|
||||
font-weight: bold;
|
||||
color: #282828;
|
||||
padding: 0 30upx;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .order-num .time {
|
||||
font-size: 26upx;
|
||||
font-weight: normal;
|
||||
color: #999;
|
||||
margin-top: -40upx;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation {
|
||||
padding: 20upx 30upx;
|
||||
margin-top: 3upx;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .more {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .icon-gengduo {
|
||||
font-size: 50upx;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .order .arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 11upx solid transparent;
|
||||
border-right: 11upx solid transparent;
|
||||
border-top: 20upx solid #e5e5e5;
|
||||
position: absolute;
|
||||
left: 15upx;
|
||||
bottom: -18upx;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .order .arrow:before {
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 7upx solid transparent;
|
||||
border-right: 7upx solid transparent;
|
||||
border-top: 20upx solid #fff;
|
||||
position: absolute;
|
||||
left: -7upx;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .order {
|
||||
width: 200upx;
|
||||
background-color: #fff;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 10upx;
|
||||
position: absolute;
|
||||
top: -100upx;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .order .items {
|
||||
height: 77upx;
|
||||
line-height: 77upx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .order .items~.items {
|
||||
border-top: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .bnt {
|
||||
font-size: 28upx;
|
||||
color: #5c5c5c;
|
||||
width: 170upx;
|
||||
height: 60upx;
|
||||
border-radius: 30upx;
|
||||
border: 1px solid #bbb;
|
||||
text-align: center;
|
||||
line-height: 60upx;
|
||||
}
|
||||
|
||||
.pos-order-list .list .item .operation .bnt~.bnt {
|
||||
margin-left: 14upx;
|
||||
}
|
||||
|
||||
.pos-order-goods {
|
||||
padding: 0 30upx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods {
|
||||
height: 185upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods~.goods {
|
||||
border-top: 1px dashed #e5e5e5;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt {
|
||||
width: 515upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .pictrue {
|
||||
width: 130upx;
|
||||
height: 130upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 6upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .text {
|
||||
width: 365upx;
|
||||
height: 130upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .text .info {
|
||||
font-size: 28upx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .picTxt .text .attr {
|
||||
font-size: 24upx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .money {
|
||||
width: 164upx;
|
||||
text-align: right;
|
||||
font-size: 28upx;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .money .x-money {
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .money .num {
|
||||
color: #ff9600;
|
||||
margin: 5upx 0;
|
||||
}
|
||||
|
||||
.pos-order-goods .goods .money .y-money {
|
||||
color: #999;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.public-total {
|
||||
font-size: 28upx;
|
||||
color: #282828;
|
||||
border-top: 1px solid #eee;
|
||||
height: 92upx;
|
||||
line-height: 92upx;
|
||||
text-align: right;
|
||||
padding: 0 30upx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.public-total .money {
|
||||
color: #ff4c3c;
|
||||
}
|
||||
</style>
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 191 KiB |
|
@ -0,0 +1,631 @@
|
|||
<template>
|
||||
<div class="statistical-page" ref="container">
|
||||
<div class="navs">
|
||||
<div class="list">
|
||||
<div class="item" :class="time == 'today' ? 'on' : ''" @click="setTime('today')">
|
||||
今天
|
||||
</div>
|
||||
<div class="item" :class="time == 'yesterday' ? 'on' : ''" @click="setTime('yesterday')">
|
||||
昨天
|
||||
</div>
|
||||
<div class="item" :class="time == 'seven' ? 'on' : ''" @click="setTime('seven')">
|
||||
最近7天
|
||||
</div>
|
||||
<div class="item" :class="time == 'month' ? 'on' : ''" @click="setTime('month')">
|
||||
本月
|
||||
</div>
|
||||
<div class="item" :class="time == 'date' ? 'on' : ''" @click="dateTitle">
|
||||
<!-- <span class="iconfont icon-xiangxia"></span>
|
||||
<span v-for="(value, index) in renderValues" :key="index">
|
||||
{{ value }}</span
|
||||
> -->
|
||||
自定义
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrapper">
|
||||
<div class="title">
|
||||
{{ title }}{{ this.where.type == 1 ? "营业额(元)" : "订单量(份)" }}
|
||||
</div>
|
||||
<div class="money">{{ time_price }}</div>
|
||||
<div class="increase acea-row row-between-wrapper">
|
||||
<div>
|
||||
{{ title }}增长率:<span :class="increase_time_status === 1 ? 'red' : 'green'">{{ increase_time_status === 1 ? "" : "-" }}{{ growth_rate }}%
|
||||
<span class="iconfont" :class="
|
||||
increase_time_status === 1
|
||||
? 'icon-xiangshang1'
|
||||
: 'icon-xiangxia2'
|
||||
"></span></span>
|
||||
</div>
|
||||
<div>
|
||||
{{ title }}增长:<span :class="increase_time_status === 1 ? 'red' : 'green'">{{ increase_time_status === 1 ? "" : "-" }}{{ increase_time }}
|
||||
<span class="iconfont" :class="
|
||||
increase_time_status === 1
|
||||
? 'icon-xiangshang1'
|
||||
: 'icon-xiangxia2'
|
||||
"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart">
|
||||
<div class="chart-title">
|
||||
单位({{where.type == 1?'元':'份'}})
|
||||
</div>
|
||||
<canvas canvas-id="canvasLineA" id="canvasLineA" class="charts" disable-scroll=true @touchstart="touchLineA"
|
||||
@touchmove="moveLineA" @touchend="touchEndLineA"></canvas>
|
||||
</div>
|
||||
<div class="public-wrapper">
|
||||
<div class="title">
|
||||
<span class="iconfont icon-xiangxishuju"></span>详细数据
|
||||
</div>
|
||||
<div class="nav acea-row row-between-wrapper">
|
||||
<div class="data">日期</div>
|
||||
<div class="browse">订单量</div>
|
||||
<div class="turnover">成交额</div>
|
||||
</div>
|
||||
<div class="conter">
|
||||
<div class="item acea-row row-between-wrapper" v-for="(item, index) in list" :key="index">
|
||||
<div class="data">{{ item.time }}</div>
|
||||
<div class="browse">{{ item.count }}</div>
|
||||
<div class="turnover">{{ item.price }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<uni-calendar ref="calendar" :date="info.date" :insert="info.insert" :lunar="info.lunar" :startDate="info.startDate" :endDate="info.endDate" :range="info.range" @confirm="confirm" :showMonth="info.showMonth" />
|
||||
<div class="mask" @touchmove.prevent v-show="current === true" @click="close"></div>
|
||||
<!-- <Loading :loaded="loaded" :loading="loading"></Loading> -->
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import uCharts from '@/components/ucharts/ucharts'
|
||||
import uniCalendar from '@/components/uni-calendar/uni-calendar.vue'
|
||||
var canvaLineA = null;
|
||||
// import Calendar from 'mpvue-calendar'
|
||||
// #ifdef MP-WEIXIN
|
||||
// import 'mpvue-calendar/src/style.css
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
// import 'mpvue-calendar/src/browser-style.css'
|
||||
// #endif
|
||||
|
||||
import {
|
||||
getStatisticsMonth,
|
||||
getStatisticsTime
|
||||
} from "@/api/admin";
|
||||
// import Loading from "@components/Loading";
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
const day = new Date().getDate();
|
||||
export default {
|
||||
name: "Statistics",
|
||||
components: {
|
||||
// Calendar,
|
||||
// uCharts
|
||||
uniCalendar
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
value: [
|
||||
[year, month, day - 1],
|
||||
[year, month, day]
|
||||
],
|
||||
isrange: true,
|
||||
weekSwitch: false,
|
||||
ismulti: false,
|
||||
monFirst: true,
|
||||
clean: false, //简洁模式
|
||||
lunar: false, //显示农历
|
||||
renderValues: [],
|
||||
monthRange: [],
|
||||
current: false,
|
||||
where: {
|
||||
start: "",
|
||||
stop: "",
|
||||
type: ""
|
||||
},
|
||||
types: "", //类型|order=订单数|price=营业额
|
||||
time: "", //时间|today=今天|yesterday=昨天|month=本月
|
||||
title: "", //时间|today=今天|yesterday=昨天|month=本月
|
||||
growth_rate: "", //增长率
|
||||
increase_time: "", //增长率
|
||||
increase_time_status: "", //增长率
|
||||
time_price: "", //增长率
|
||||
loaded: false,
|
||||
loading: false,
|
||||
filter: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
start: "",
|
||||
stop: ""
|
||||
},
|
||||
list: [],
|
||||
// charts
|
||||
cWidth: '',
|
||||
cHeight: '',
|
||||
pixelRatio: 1,
|
||||
textarea: '',
|
||||
"LineA": {
|
||||
"categories": ["2012", "2013", "2014", "2015", "2016", "2017"],
|
||||
"series": [{
|
||||
"data": [35, 8, 25, 37, 4, 20]
|
||||
}]
|
||||
},
|
||||
info: {
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
lunar: false,
|
||||
range: true,
|
||||
insert: false,
|
||||
selected: [],
|
||||
showMonth:false
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"$route.params": function(newVal) {
|
||||
var that = this;
|
||||
if (newVal != undefined) {
|
||||
that.setType(newVal.type);
|
||||
that.setTime(newVal.time);
|
||||
that.getIndex();
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad: function(options) {
|
||||
this.setType(options.type);
|
||||
this.setTime(options.time);
|
||||
this.cWidth = uni.upx2px(690);
|
||||
this.cHeight = uni.upx2px(500);
|
||||
|
||||
// this.handelRenderValues();
|
||||
// this.getIndex();
|
||||
this.getInfo();
|
||||
// this.$scroll(this.$refs.container, () => {
|
||||
// !this.loading && this.getInfo();
|
||||
// });
|
||||
},
|
||||
computed: {
|
||||
monthRangeText() {
|
||||
return this.monthRange.length ? "固定" : "指定范围";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getIndex: function() {
|
||||
let tempDay = []
|
||||
let tempNum = []
|
||||
var that = this;
|
||||
getStatisticsTime(that.where).then(
|
||||
res => {
|
||||
var _info = res.data.chart,
|
||||
day = [],
|
||||
num = [];
|
||||
_info.forEach(function(item) {
|
||||
day.push(item.time);
|
||||
num.push(item.num);
|
||||
});
|
||||
that.growth_rate = res.data.growth_rate;
|
||||
that.increase_time = res.data.increase_time;
|
||||
that.increase_time_status = res.data.increase_time_status;
|
||||
that.time_price = res.data.time;
|
||||
|
||||
res.data.chart.forEach((item, index) => {
|
||||
tempDay.push(item.time)
|
||||
tempNum.push(item.num)
|
||||
})
|
||||
that.LineA.categories = tempDay
|
||||
that.LineA.series[0].data = tempNum
|
||||
that.showLineA("canvasLineA", that.LineA);
|
||||
},
|
||||
error => {
|
||||
that.$dialog.error(error.msg);
|
||||
}
|
||||
);
|
||||
},
|
||||
setTime: function(time) {
|
||||
let self = this
|
||||
this.time = time;
|
||||
var year = new Date().getFullYear(),
|
||||
month = new Date().getMonth() + 1,
|
||||
day = new Date().getDate();
|
||||
this.list = [];
|
||||
this.filter.page = 1;
|
||||
this.loaded = false;
|
||||
this.loading = false;
|
||||
switch (time) {
|
||||
case "today":
|
||||
this.where.start =
|
||||
new Date(Date.parse(year + "/" + month + "/" + day)).getTime() /
|
||||
1000;
|
||||
this.where.stop =
|
||||
new Date(Date.parse(year + "/" + month + "/" + day)).getTime() /
|
||||
1000 +
|
||||
24 * 60 * 60 -
|
||||
1;
|
||||
this.title = "今日";
|
||||
this.getIndex();
|
||||
this.getInfo();
|
||||
break;
|
||||
case "yesterday":
|
||||
this.where.start =
|
||||
new Date(Date.parse(year + "/" + month + "/" + day)).getTime() /
|
||||
1000 -
|
||||
24 * 60 * 60;
|
||||
this.where.stop =
|
||||
new Date(Date.parse(year + "/" + month + "/" + day)).getTime() /
|
||||
1000 -
|
||||
1;
|
||||
this.title = "昨日";
|
||||
this.getIndex();
|
||||
this.getInfo();
|
||||
break;
|
||||
case "month":
|
||||
this.where.start =
|
||||
new Date(year, new Date().getMonth(), 1).getTime() / 1000;
|
||||
this.where.stop = new Date(year, month, 1).getTime() / 1000 - 1;
|
||||
this.title = "本月";
|
||||
this.getIndex();
|
||||
this.getInfo();
|
||||
break;
|
||||
case "seven":
|
||||
this.where.start =
|
||||
new Date(Date.parse(year + "/" + month + "/" + day)).getTime() /
|
||||
1000 +
|
||||
24 * 60 * 60 -
|
||||
7 * 3600 * 24;
|
||||
this.where.stop =
|
||||
new Date(Date.parse(year + "/" + month + "/" + day)).getTime() /
|
||||
1000 +
|
||||
24 * 60 * 60 -
|
||||
1;
|
||||
this.title = "七日";
|
||||
this.getIndex();
|
||||
this.getInfo();
|
||||
break;
|
||||
}
|
||||
},
|
||||
setType: function(type) {
|
||||
switch (type) {
|
||||
case "price":
|
||||
this.where.type = 1;
|
||||
break;
|
||||
case "order":
|
||||
this.where.type = 2;
|
||||
break;
|
||||
}
|
||||
},
|
||||
dateTitle: function() {
|
||||
this.$refs.calendar.open()
|
||||
this.time = 'date'
|
||||
// this.current = true;
|
||||
},
|
||||
close: function() {
|
||||
this.current = false;
|
||||
},
|
||||
getInfo: function() {
|
||||
var that = this;
|
||||
if (that.loading || that.loaded) return;
|
||||
that.loading = true;
|
||||
that.filter.start = that.where.start;
|
||||
that.filter.stop = that.where.stop;
|
||||
getStatisticsMonth(that.filter).then(
|
||||
res => {
|
||||
that.loading = false;
|
||||
that.loaded = res.data.length < that.filter.limit;
|
||||
that.list.push.apply(that.list, res.data);
|
||||
that.filter.page = that.filter.page + 1;
|
||||
},
|
||||
error => {
|
||||
that.$dialog.message(error.msg);
|
||||
}
|
||||
);
|
||||
},
|
||||
// 创建charts
|
||||
showLineA(canvasId, chartData) {
|
||||
let _self = this
|
||||
canvaLineA = new uCharts({
|
||||
$this: _self,
|
||||
canvasId: canvasId,
|
||||
type: 'line',
|
||||
fontSize: 11,
|
||||
padding: [15, 15, 0, 15],
|
||||
legend: {
|
||||
show: false,
|
||||
padding: 5,
|
||||
lineHeight: 11,
|
||||
margin: 5,
|
||||
},
|
||||
dataLabel: true,
|
||||
dataPointShape: true,
|
||||
dataPointShapeType: 'hollow',
|
||||
background: '#FFFFFF',
|
||||
pixelRatio: _self.pixelRatio,
|
||||
categories: chartData.categories,
|
||||
series: chartData.series,
|
||||
animation: true,
|
||||
enableScroll: true, //开启图表拖拽功能
|
||||
xAxis: {
|
||||
disableGrid: false,
|
||||
type: 'grid',
|
||||
gridType: 'dash',
|
||||
itemCount: 4,
|
||||
scrollShow: true,
|
||||
scrollAlign: 'left'
|
||||
},
|
||||
yAxis: {
|
||||
//disabled:true
|
||||
gridType: 'dash',
|
||||
splitNumber: 8,
|
||||
min: 0,
|
||||
max: 30,
|
||||
format: (val) => {
|
||||
return val.toFixed(0)
|
||||
} //如不写此方法,Y轴刻度默认保留两位小数
|
||||
},
|
||||
width: _self.cWidth * _self.pixelRatio,
|
||||
height: _self.cHeight * _self.pixelRatio,
|
||||
extra: {
|
||||
line: {
|
||||
type: 'straight'
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
// charts触摸事件
|
||||
touchLineA(e) {
|
||||
canvaLineA.scrollStart(e);
|
||||
},
|
||||
moveLineA(e) {
|
||||
canvaLineA.scroll(e);
|
||||
},
|
||||
touchEndLineA(e) {
|
||||
canvaLineA.scrollEnd(e);
|
||||
},
|
||||
// 日历确定
|
||||
confirm(e) {
|
||||
let self = this
|
||||
if(e.range.after && e.range.before){
|
||||
let star = new Date(e.range.after).getTime()/1000
|
||||
let stop = new Date(e.range.before).getTime()/1000
|
||||
self.where.start = star
|
||||
self.where.stop = stop
|
||||
self.list = [];
|
||||
self.filter.page = 1;
|
||||
self.loaded = false;
|
||||
self.loading = false;
|
||||
Promise.all([self.getIndex(),self.getInfo()]);
|
||||
}
|
||||
},
|
||||
},
|
||||
onReachBottom() {
|
||||
this.getInfo();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
/*交易额统计*/
|
||||
.statistical-page .navs {
|
||||
width: 100%;
|
||||
height: 96upx;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
line-height: 96upx;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.statistical-page .navs .list {
|
||||
overflow-y: hidden;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.statistical-page .navs .item {
|
||||
font-size: 32upx;
|
||||
color: #282828;
|
||||
margin-left: 60upx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.statistical-page .navs .item.on {
|
||||
color: #2291f8;
|
||||
}
|
||||
|
||||
.statistical-page .navs .item .iconfont {
|
||||
font-size: 25upx;
|
||||
margin-left: 13upx;
|
||||
}
|
||||
|
||||
.statistical-page .wrapper {
|
||||
width: 740upx;
|
||||
background-color: #fff;
|
||||
border-radius: 10upx;
|
||||
margin: 119upx auto 0 auto;
|
||||
padding: 50upx 60upx;
|
||||
}
|
||||
|
||||
.statistical-page .wrapper .title {
|
||||
font-size: 30upx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.statistical-page .wrapper .money {
|
||||
font-size: 72upx;
|
||||
color: #fba02a;
|
||||
text-align: center;
|
||||
margin-top: 10upx;
|
||||
}
|
||||
|
||||
.statistical-page .wrapper .increase {
|
||||
font-size: 28upx;
|
||||
color: #999;
|
||||
margin-top: 20upx;
|
||||
}
|
||||
|
||||
.statistical-page .wrapper .increase .red {
|
||||
color: #ff6969;
|
||||
}
|
||||
|
||||
.statistical-page .wrapper .increase .green {
|
||||
color: #1abb1d;
|
||||
}
|
||||
|
||||
.statistical-page .wrapper .increase .iconfont {
|
||||
font-size: 23upx;
|
||||
margin-left: 15upx;
|
||||
}
|
||||
|
||||
.statistical-page .chart {
|
||||
width: 690upx;
|
||||
background-color: #fff;
|
||||
border-radius: 10upx;
|
||||
margin: 23upx auto 0 auto;
|
||||
/* padding: 25upx 22upx 0 22upx; */
|
||||
}
|
||||
|
||||
.statistical-page .chart .chart-title{
|
||||
padding:20upx 20upx 10upx;
|
||||
font-size: 26upx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.statistical-page .chart canvas {
|
||||
width: 100%;
|
||||
height: 530rpx;
|
||||
}
|
||||
|
||||
.statistical-page .chart .company {
|
||||
font-size: 26upx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.yd-confirm {
|
||||
background-color: #fff;
|
||||
font-size: unset;
|
||||
width: 540upx;
|
||||
height: 250upx;
|
||||
border-radius: 40upx;
|
||||
}
|
||||
|
||||
.yd-confirm-hd {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.yd-confirm-title {
|
||||
color: #030303;
|
||||
font-weight: bold;
|
||||
font-size: 36upx;
|
||||
}
|
||||
|
||||
.yd-confirm-bd {
|
||||
text-align: center;
|
||||
font-size: 28upx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.yd-confirm-ft {
|
||||
line-height: 90upx;
|
||||
margin-top: 14px;
|
||||
border-top: 1upx solid #eee;
|
||||
}
|
||||
|
||||
.yd-confirm-ft>a {
|
||||
color: #e93323;
|
||||
}
|
||||
|
||||
.yd-confirm-ft>a.primary {
|
||||
border-left: 1upx solid #eee;
|
||||
color: #e93323;
|
||||
}
|
||||
|
||||
.echarts {
|
||||
width: 100%;
|
||||
height: 550upx;
|
||||
}
|
||||
|
||||
.calendar-wrapper {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 777;
|
||||
transform: translate3d(0, 100%, 0);
|
||||
transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
|
||||
}
|
||||
|
||||
.calendar-wrapper.on {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
.statistical-page .wrapper .increase {
|
||||
font-size: 26upx;
|
||||
}
|
||||
|
||||
.statistical-page .wrapper .increase .iconfont {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.public-wrapper .title {
|
||||
font-size: 30upx;
|
||||
color: #282828;
|
||||
padding: 0 30upx;
|
||||
margin-bottom: 20upx;
|
||||
}
|
||||
|
||||
.public-wrapper .title .iconfont {
|
||||
color: #2291f8;
|
||||
font-size: 40upx;
|
||||
margin-right: 13upx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.public-wrapper {
|
||||
margin: 18upx auto 0 auto;
|
||||
width: 690upx;
|
||||
background-color: #fff;
|
||||
border-radius: 10upx;
|
||||
padding-top: 25upx;
|
||||
}
|
||||
|
||||
.public-wrapper .nav {
|
||||
padding: 0 30upx;
|
||||
height: 70upx;
|
||||
line-height: 70upx;
|
||||
font-size: 24upx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.public-wrapper .data {
|
||||
width: 210upx;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.public-wrapper .browse {
|
||||
width: 192upx;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.public-wrapper .turnover {
|
||||
width: 227upx;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.public-wrapper .conter {
|
||||
padding: 0 30upx;
|
||||
}
|
||||
|
||||
.public-wrapper .conter .item {
|
||||
border-bottom: 1px solid #f7f7f7;
|
||||
height: 70upx;
|
||||
font-size: 24upx;
|
||||
}
|
||||
|
||||
.public-wrapper .conter .item .turnover {
|
||||
color: #d84242;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,80 @@
|
|||
<template>
|
||||
<view class="lottie-bg">
|
||||
<view id="lottie">
|
||||
<image src="/static/img/live-logo.gif" rel="preload" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wechat from "@/libs/wechat";
|
||||
import {
|
||||
getUserInfo
|
||||
} from "@/api/user";
|
||||
export default {
|
||||
name: "Auth",
|
||||
mounted() {
|
||||
|
||||
},
|
||||
onLoad(option) {
|
||||
let that = this
|
||||
const {
|
||||
code,
|
||||
state
|
||||
} = option;
|
||||
wechat.auth(code, state)
|
||||
.then(() => {
|
||||
getUserInfo().then(res => {
|
||||
console.log(res);
|
||||
console.log(option.back_url);
|
||||
console.log(decodeURIComponent(
|
||||
decodeURIComponent(option.back_url)
|
||||
));
|
||||
that.$store.commit("SETUID", res.data.uid);
|
||||
location.href = decodeURIComponent(
|
||||
decodeURIComponent(option.back_url)
|
||||
);
|
||||
}).catch(res => {
|
||||
console.log('getUserInfo错误='+res);
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
// location.replace("/");
|
||||
console.log('auth错误='+err);
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.lottie-bg {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#lottie {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
transform: translate3d(0, 0, 0);
|
||||
margin: auto;
|
||||
|
||||
image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,144 @@
|
|||
<template>
|
||||
<div class="quality-recommend">
|
||||
<div class="slider-banner swiper">
|
||||
<view class="swiper">
|
||||
<swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration"
|
||||
indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
|
||||
<block v-for="(item,index) in imgUrls" :key="index">
|
||||
<swiper-item>
|
||||
<image :src="item.img" class="slide-image"></image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
</div>
|
||||
<div class="title acea-row row-center-wrapper">
|
||||
<div class="line"></div>
|
||||
<div class="name">
|
||||
<span class="iconfont" :class="icon"></span>{{ name }}
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
<view class="wrapper">
|
||||
<GoodList :bastList="goodsList" :is-sort="false"></GoodList>
|
||||
<view class="txt-bar" v-if="goodsList.length>0 && !isScroll">我是有底线的~</view>
|
||||
<emptyPage v-if="goodsList.length==0 && !isScroll" title="暂无数据~"></emptyPage>
|
||||
</view>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import emptyPage from '@/components/emptyPage.vue'
|
||||
import GoodList from "@/components/goodList";
|
||||
import { getGroomList } from "@/api/store";
|
||||
export default {
|
||||
name: "HotNewGoods",
|
||||
components: {
|
||||
GoodList,
|
||||
emptyPage,
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
imgUrls: [],
|
||||
goodsList: [],
|
||||
name: "",
|
||||
icon: "",
|
||||
type:0,
|
||||
autoplay:true,
|
||||
circular:true,
|
||||
interval: 3000,
|
||||
duration: 500,
|
||||
page:1,
|
||||
limit:8,
|
||||
isScroll:true
|
||||
};
|
||||
},
|
||||
onLoad: function(option) {
|
||||
this.type = option.type
|
||||
this.titleInfo();
|
||||
this.getIndexGroomList();
|
||||
},
|
||||
methods: {
|
||||
titleInfo: function() {
|
||||
if (this.type === "1") {
|
||||
this.name = "精品推荐";
|
||||
this.icon = "icon-jingpintuijian";
|
||||
// document.title = "精品推荐";
|
||||
uni.setNavigationBarTitle({
|
||||
title:"精品推荐"
|
||||
})
|
||||
} else if (this.type === "2") {
|
||||
this.name = "热门榜单";
|
||||
this.icon = "icon-remen";
|
||||
uni.setNavigationBarTitle({
|
||||
title:"热门榜单"
|
||||
})
|
||||
} else if (this.type === "3") {
|
||||
this.name = "首发新品";
|
||||
this.icon = "icon-xinpin";
|
||||
uni.setNavigationBarTitle({
|
||||
title:"首发新品"
|
||||
})
|
||||
}else if (this.type === "4") {
|
||||
this.name = "促销单品";
|
||||
this.icon = "icon-xinpin";
|
||||
uni.setNavigationBarTitle({
|
||||
title:"促销单品"
|
||||
})
|
||||
}
|
||||
},
|
||||
getIndexGroomList: function() {
|
||||
if(!this.isScroll) return
|
||||
let that = this;
|
||||
let type = this.type;
|
||||
getGroomList(type,{
|
||||
page:this.page,
|
||||
limit:this.limit
|
||||
}).then(res => {
|
||||
that.imgUrls = res.data.banner;
|
||||
that.goodsList = that.goodsList.concat(res.data.list);
|
||||
that.isScroll = res.data.list.length>=that.limit
|
||||
that.page++
|
||||
})
|
||||
.catch(function(res) {
|
||||
that.$util.Tips({ title: res });
|
||||
});
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.getIndexGroomList()
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
/deep/ .empty-box{
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.swiper,swiper,swiper-item,.slide-image{
|
||||
width: 100%;
|
||||
height: 280rpx;
|
||||
}
|
||||
.quality-recommend {
|
||||
.wrapper{
|
||||
background: #fff;
|
||||
}
|
||||
.title {
|
||||
height: 120rpx;
|
||||
font-size:32rpx;
|
||||
color: #282828;
|
||||
background-color: #f5f5f5;
|
||||
.line{
|
||||
width: 230rpx;
|
||||
height: 2rpx;
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
}
|
||||
}
|
||||
.txt-bar{
|
||||
padding: 20rpx 0;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,80 @@
|
|||
<template>
|
||||
<div class="CustomerList">
|
||||
<div
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="item in list"
|
||||
:key="item.id"
|
||||
@click="goPage(item)"
|
||||
>
|
||||
<div class="pictrue"><img :src="item.avatar" /></div>
|
||||
<div class="text line1">{{ item.nickname }}</div>
|
||||
</div>
|
||||
<home></home>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { serviceList } from "@/api/user";
|
||||
import home from '@/components/home';
|
||||
|
||||
export default {
|
||||
name: "CustomerList",
|
||||
components:{
|
||||
home
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
productId: 0,
|
||||
orderId: ""
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
serviceList().then(res => {
|
||||
this.list = res.data;
|
||||
});
|
||||
},
|
||||
goPage(item){
|
||||
uni.navigateTo({
|
||||
url:'/pages/customer_list/chat?uid='+item.uid+'&productId='+ this.productId+'&orderId='+this.orderId
|
||||
})
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.getList();
|
||||
if (option.productId)
|
||||
this.productId = option.productId;
|
||||
if (option.orderId) {
|
||||
this.orderId = option.orderId
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.CustomerList {
|
||||
margin-top:13rpx;
|
||||
}
|
||||
.CustomerList .item {
|
||||
height: 138rpx;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding: 0 24rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
.CustomerList .item .pictrue {
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
border-radius: 50%;
|
||||
border: 3rpx solid #fff;
|
||||
box-shadow: 0 0 1rpx 5rpx #f3f3f3;
|
||||
}
|
||||
.CustomerList .item .pictrue img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.CustomerList .item .text {
|
||||
width: 582rpx;
|
||||
font-size: 32rpx;
|
||||
color: #000;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,94 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class='quality-recommend'>
|
||||
<swipers :imgUrls="imgUrls"></swipers>
|
||||
<view class='title acea-row row-center-wrapper'>
|
||||
<view class='line'></view>
|
||||
<view class='name'><text class='iconfont' :class="icon"></text>{{name}}</view>
|
||||
<view class='line'></view>
|
||||
</view>
|
||||
<goodList :bastList="bastList" :status="status"></goodList>
|
||||
</view>
|
||||
<home></home>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import goodList from '@/components/goodList';
|
||||
import home from '@/components/home';
|
||||
import swipers from '@/components/swipers';
|
||||
import { getGroomList } from '@/api/store.js';
|
||||
export default {
|
||||
components: {
|
||||
goodList,
|
||||
swipers,
|
||||
home
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgUrls: [],
|
||||
bastList:[],
|
||||
name:'',
|
||||
icon:'',
|
||||
type:0,
|
||||
status:0
|
||||
};
|
||||
},
|
||||
onLoad: function (options) {
|
||||
this.type = options.type;
|
||||
},
|
||||
onShow: function () {
|
||||
let type = this.type;
|
||||
if (type == 1){
|
||||
uni.setNavigationBarTitle({
|
||||
title:"精品推荐"
|
||||
});
|
||||
this.name = '精品推荐';
|
||||
this.icon = 'icon-jingpintuijian';
|
||||
} else if (type == 2) {
|
||||
uni.setNavigationBarTitle({
|
||||
title:"热门榜单"
|
||||
});
|
||||
this.name = '热门榜单';
|
||||
this.icon = 'icon-remen';
|
||||
this.status = 1;
|
||||
} else if (type == 3) {
|
||||
uni.setNavigationBarTitle({
|
||||
title:"首发新品"
|
||||
});
|
||||
this.name = '首发新品';
|
||||
this.icon = 'icon-xinpin';
|
||||
} else if (type == 4) {
|
||||
uni.setNavigationBarTitle({
|
||||
title:"促销单品"
|
||||
});
|
||||
this.name = '促销单品';
|
||||
this.icon = 'icon-cuxiaoguanli';
|
||||
}else{
|
||||
uni.setNavigationBarTitle({
|
||||
title:"首发新品"
|
||||
});
|
||||
this.name = '首发新品';
|
||||
this.icon = 'icon-xinpin';
|
||||
}
|
||||
this.getIndexGroomList();
|
||||
},
|
||||
methods: {
|
||||
getIndexGroomList: function () {
|
||||
let that = this;
|
||||
getGroomList(that.type).then(res=>{
|
||||
that.imgUrls = res.data.banner;
|
||||
that.$set(that,'bastList',res.data.list)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page{background-color:#fff;}
|
||||
.quality-recommend .title{height:120rpx;font-size:32rpx;color:#282828;background-color:#f5f5f5;}
|
||||
.quality-recommend .title .line{width:230rpx;height:2rpx;background-color:#e9e9e9;}
|
||||
.quality-recommend .title .name{margin:0 20rpx;}
|
||||
.quality-recommend .title .name .iconfont{margin-right:13rpx;font-size:38rpx;vertical-align:-4rpx;color:#343434;}
|
||||
</style>
|
|
@ -0,0 +1,251 @@
|
|||
<template>
|
||||
<view class='productSort'>
|
||||
<view class='header acea-row row-center-wrapper'>
|
||||
<view class='acea-row row-between-wrapper input'>
|
||||
<text class='iconfont icon-sousuo'></text>
|
||||
<input type='text' placeholder='点击搜索商品信息' @confirm="searchSubmitValue" confirm-type='search' name="search"
|
||||
placeholder-class='placeholder'></input>
|
||||
</view>
|
||||
</view>
|
||||
<view class='aside'>
|
||||
<view class='item acea-row row-center-wrapper' :class='index==navActive?"on":""' v-for="(item,index) in productList"
|
||||
:key="index" @click='tap(index,"b"+index)'><text>{{item.name}}</text></view>
|
||||
</view>
|
||||
<view class='conter'>
|
||||
<scroll-view scroll-y="true" :scroll-into-view="toView" :style='"height:"+height+"rpx;"' @scroll="scroll"
|
||||
scroll-with-animation='true'>
|
||||
<block v-for="(item,index) in productList" :key="index">
|
||||
|
||||
<view class='listw' :id="'b'+index">
|
||||
<view class='title acea-row row-center-wrapper'>
|
||||
<view class='line'></view>
|
||||
<view class='name'>{{item.name}}</view>
|
||||
<view class='line'></view>
|
||||
</view>
|
||||
<view class='list acea-row'>
|
||||
<block v-for="(itemn,indexn) in item.child" :key="indexn">
|
||||
<navigator hover-class='none' :url='"/pages/goods_list/index?cid="+itemn.id+"&title="+itemn.name' class='item acea-row row-column row-middle'>
|
||||
<view class='picture'>
|
||||
<image :src='itemn.extra'></image>
|
||||
</view>
|
||||
<view class='name line1'>{{itemn.name}}</view>
|
||||
</navigator>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view :style='"height:"+(height-300)+"rpx;"' v-if="number<15"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getCategoryList
|
||||
} from '@/api/store.js';
|
||||
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
navlist: [],
|
||||
productList: [],
|
||||
navActive: 0,
|
||||
number: "",
|
||||
height: 0,
|
||||
hightArr: [],
|
||||
toView: ""
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.getAllCategory();
|
||||
},
|
||||
onShow(){},
|
||||
methods: {
|
||||
infoScroll: function() {
|
||||
let that = this;
|
||||
let len = that.productList.length;
|
||||
let child = that.productList[len - 1]&&that.productList[len - 1].child?that.productList[len - 1].child:[];
|
||||
this.number = child?child.length:0;
|
||||
//设置商品列表高度
|
||||
uni.getSystemInfo({
|
||||
success: function(res) {
|
||||
that.height = (res.windowHeight) * (750 / res.windowWidth) - 98;
|
||||
},
|
||||
});
|
||||
let height = 0;
|
||||
let hightArr = [];
|
||||
for (let i = 0; i < len; i++) {
|
||||
//获取元素所在位置
|
||||
let query = uni.createSelectorQuery().in(this);
|
||||
let idView = "#b" + i;
|
||||
query.select(idView).boundingClientRect();
|
||||
query.exec(function(res) {
|
||||
let top = res[0].top;
|
||||
hightArr.push(top);
|
||||
that.hightArr = hightArr
|
||||
});
|
||||
};
|
||||
},
|
||||
tap: function(index, id) {
|
||||
this.toView = id;
|
||||
this.navActive = index;
|
||||
},
|
||||
getAllCategory: function() {
|
||||
let that = this;
|
||||
getCategoryList().then(res => {
|
||||
that.productList = res.data;
|
||||
setTimeout(function(){
|
||||
that.infoScroll();
|
||||
},500)
|
||||
})
|
||||
},
|
||||
scroll: function(e) {
|
||||
let scrollTop = e.detail.scrollTop;
|
||||
let scrollArr = this.hightArr;
|
||||
for (let i = 0; i < scrollArr.length; i++) {
|
||||
if (scrollTop >= 0 && scrollTop < scrollArr[1] - scrollArr[0]) {
|
||||
this.navActive = 0
|
||||
} else if (scrollTop >= scrollArr[i] - scrollArr[0] && scrollTop < scrollArr[i + 1] - scrollArr[0]) {
|
||||
this.navActive = i
|
||||
} else if (scrollTop >= scrollArr[scrollArr.length - 1] - scrollArr[0]) {
|
||||
this.navActive = scrollArr.length - 1
|
||||
}
|
||||
}
|
||||
},
|
||||
searchSubmitValue: function(e) {
|
||||
if (this.$util.trim(e.detail.value).length > 0)
|
||||
uni.navigateTo({
|
||||
url: '/pages/goods_list/index?searchValue=' + e.detail.value
|
||||
})
|
||||
else
|
||||
return this.$util.Tips({
|
||||
title: '请填写要搜索的产品信息'
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.productSort .header {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 9;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.productSort .header .input {
|
||||
width: 700rpx;
|
||||
height: 60rpx;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 50rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0 25rpx;
|
||||
}
|
||||
|
||||
.productSort .header .input .iconfont {
|
||||
font-size: 35rpx;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.productSort .header .input .placeholder {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.productSort .header .input input {
|
||||
font-size: 26rpx;
|
||||
height: 100%;
|
||||
width: 597rpx;
|
||||
}
|
||||
|
||||
.productSort .aside {
|
||||
position: fixed;
|
||||
width: 180rpx;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
top:0;
|
||||
background-color: #f7f7f7;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
margin-top: 96rpx;
|
||||
}
|
||||
|
||||
.productSort .aside .item {
|
||||
height: 100rpx;
|
||||
width: 100%;
|
||||
font-size: 26rpx;
|
||||
color: #424242;
|
||||
}
|
||||
|
||||
.productSort .aside .item.on {
|
||||
background-color: #fff;
|
||||
border-left: 4rpx solid #fc4141;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fc4141;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.productSort .conter {
|
||||
margin: 96rpx 0 0 180rpx;
|
||||
padding: 0 14rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.productSort .conter .listw {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
|
||||
.productSort .conter .listw .title {
|
||||
height: 90rpx;
|
||||
}
|
||||
|
||||
.productSort .conter .listw .title .line {
|
||||
width: 100rpx;
|
||||
height: 2rpx;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
.productSort .conter .listw .title .name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin: 0 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.productSort .conter .list {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.productSort .conter .list .item {
|
||||
width: 177rpx;
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
|
||||
.productSort .conter .list .item .picture {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.productSort .conter .list .item .picture image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.productSort .conter .list .item .name {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
width: 120rpx;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,81 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="canvasStatus">
|
||||
<view class="mask"></view>
|
||||
<image :src='imagePath' class="canvas"></image>
|
||||
</view>
|
||||
<view v-else>
|
||||
<canvas style="width:750rpx;height:1190rpx;position: fixed;z-index: -5;" canvas-id="firstCanvas"></canvas>
|
||||
<canvas style="position:fixed;z-index: -5;opacity: 0;" canvas-id="qrcode" :style="{width: `${qrcodeSize}px`, height: `${qrcodeSize}px`}"/>
|
||||
</view>
|
||||
<div @click='clickgg'>点击</div>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
||||
import {
|
||||
HTTP_REQUEST_URL
|
||||
} from '@/config/app.js';
|
||||
export default {
|
||||
data(){
|
||||
return{
|
||||
imagePath:'',
|
||||
canvasStatus:false,
|
||||
|
||||
qrcodeText: HTTP_REQUEST_URL,
|
||||
qrcodeSize: 129,
|
||||
PromotionCode:''
|
||||
}
|
||||
},
|
||||
onReady: function (e) {
|
||||
this.make();
|
||||
},
|
||||
methods: {
|
||||
// 生成二维码;
|
||||
make() {
|
||||
let that = this;
|
||||
uQRCode.make({
|
||||
canvasId: 'qrcode',
|
||||
text: this.qrcodeText,
|
||||
size: this.qrcodeSize,
|
||||
margin: 10,
|
||||
success: res => {
|
||||
that.PromotionCode = res;
|
||||
},
|
||||
complete: () => {
|
||||
},
|
||||
fail:res=>{
|
||||
that.$util.Tips({
|
||||
title: '海报二维码生成失败!'
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
clickgg(){
|
||||
let that = this;
|
||||
// ../../static/images/barg002.png
|
||||
let arrImages = ['../../static/images/posterbackgd.png','../../static/images/explosion.png',that.PromotionCode];
|
||||
let storeName = '1十大歌手大好时光的电视广上世纪法国设计风格加工费设计规范技术规范设计规范手机话费csdsdsdsd9';
|
||||
let price = '20';
|
||||
that.$util.PosterCanvas(arrImages, storeName, price, function(tempFilePath) {
|
||||
console.log('klklkl');
|
||||
that.imagePath = tempFilePath;
|
||||
that.canvasStatus = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.canvas{
|
||||
position: fixed;
|
||||
width: 512rpx;
|
||||
height: 864rpx;
|
||||
top:50%;
|
||||
left:50%;
|
||||
margin-left: -256rpx;
|
||||
margin-top: -432rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,394 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class='productList'>
|
||||
<view class='search bg-color acea-row row-between-wrapper'>
|
||||
<view class='input acea-row row-between-wrapper'><text class='iconfont icon-sousuo'></text>
|
||||
<input placeholder='搜索商品名称' placeholder-class='placeholder' confirm-type='search' name="search" :value='where.keyword'
|
||||
@confirm="searchSubmit"></input>
|
||||
</view>
|
||||
<view class='iconfont' :class='is_switch==true?"icon-pailie":"icon-tupianpailie"' @click='Changswitch'></view>
|
||||
</view>
|
||||
<view class='nav acea-row row-middle'>
|
||||
<view class='item' :class='title ? "font-color":""' @click='set_where(1)'>{{title ? title:'默认'}}</view>
|
||||
<view class='item' @click='set_where(2)'>
|
||||
价格
|
||||
<image v-if="price==1" src='../../static/images/up.png'></image>
|
||||
<image v-else-if="price==2" src='../../static/images/down.png'></image>
|
||||
<image v-else src='../../static/images/horn.png'></image>
|
||||
</view>
|
||||
<view class='item' @click='set_where(3)'>
|
||||
销量
|
||||
<image v-if="stock==1" src='../../static/images/up.png'></image>
|
||||
<image v-else-if="stock==2" src='../../static/images/down.png'></image>
|
||||
<image v-else src='../../static/images/horn.png'></image>
|
||||
</view>
|
||||
<!-- down -->
|
||||
<view class='item' :class='nows ? "font-color":""' @click='set_where(4)'>新品</view>
|
||||
</view>
|
||||
<view class='list acea-row row-between-wrapper' :class='is_switch==true?"":"on"'>
|
||||
<view class='item' :class='is_switch==true?"":"on"' hover-class='none' v-for="(item,index) in productList" :key="index" @click="godDetail(item)">
|
||||
<view class='pictrue' :class='is_switch==true?"":"on"'>
|
||||
<image :src='item.image' :class='is_switch==true?"":"on"'></image>
|
||||
<span class="pictrue_log_class" :class="is_switch === true ? 'pictrue_log_big' : 'pictrue_log'" v-if="item.activity && item.activity.type === '1'">秒杀</span>
|
||||
<span class="pictrue_log_class" :class="is_switch === true ? 'pictrue_log_big' : 'pictrue_log'" v-if="item.activity && item.activity.type === '2'">砍价</span>
|
||||
<span class="pictrue_log_class" :class="is_switch === true ? 'pictrue_log_big' : 'pictrue_log'" v-if="item.activity && item.activity.type === '3'">拼团</span>
|
||||
</view>
|
||||
<view class='text' :class='is_switch==true?"":"on"'>
|
||||
<view class='name line1'>{{item.storeName}}</view>
|
||||
<view class='money font-color' :class='is_switch==true?"":"on"'>¥<text class='num'>{{item.price}}</text></view>
|
||||
<view class='vip acea-row row-between-wrapper' :class='is_switch==true?"":"on"'>
|
||||
<view class='vip-money' v-if="item.vip_price && item.vip_price > 0">¥{{item.vip_price}}
|
||||
<image src='../../static/images/vip.png'></image>
|
||||
</view>
|
||||
<view>已售{{item.sales}}{{item.unitName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='loadingicon acea-row row-center-wrapper' v-if='productList.length > 0'>
|
||||
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='noCommodity' v-if="productList.length==0 && where.page > 1">
|
||||
<view class='pictrue'>
|
||||
<image src='../../static/images/noShopper.png'></image>
|
||||
</view>
|
||||
<recommend :hostProduct="hostProduct"></recommend>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getProductslist,
|
||||
getProductHot
|
||||
} from '@/api/store.js';
|
||||
import recommend from '@/components/recommend';
|
||||
import {mapGetters} from "vuex";
|
||||
import { goShopDetail } from '@/libs/order.js'
|
||||
export default {
|
||||
computed: mapGetters(['uid']),
|
||||
components: {
|
||||
recommend
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
productList: [],
|
||||
is_switch: true,
|
||||
where: {
|
||||
keyword: '',
|
||||
priceOrder: '',
|
||||
salesOrder: '',
|
||||
news: 0,
|
||||
page: 1,
|
||||
limit: 20,
|
||||
cid: 0,
|
||||
},
|
||||
price: 0,
|
||||
stock: 0,
|
||||
nows: false,
|
||||
loadend: false,
|
||||
loading: false,
|
||||
loadTitle: '加载更多',
|
||||
title: '',
|
||||
hostProduct: [],
|
||||
hotPage:1,
|
||||
hotLimit:10,
|
||||
hotScroll:false
|
||||
};
|
||||
},
|
||||
onLoad: function(options) {
|
||||
this.$set(this.where, 'cid', options.cid || 0);
|
||||
this.title = options.title || '';
|
||||
this.$set(this.where, 'keyword', options.searchValue || '');
|
||||
this.get_product_list();
|
||||
this.get_host_product();
|
||||
},
|
||||
methods: {
|
||||
// 去详情页
|
||||
godDetail(item){
|
||||
goShopDetail(item,this.uid).then(res=>{
|
||||
uni.navigateTo({
|
||||
url:`/pages/goods_details/index?id=${item.id}`
|
||||
})
|
||||
})
|
||||
},
|
||||
Changswitch: function() {
|
||||
let that = this;
|
||||
that.is_switch = !that.is_switch
|
||||
},
|
||||
searchSubmit: function(e) {
|
||||
let that = this;
|
||||
that.$set(that.where, 'keyword', e.detail.value);
|
||||
that.loadend = false;
|
||||
that.$set(that.where, 'page', 1)
|
||||
this.get_product_list(true);
|
||||
},
|
||||
/**
|
||||
* 获取我的推荐
|
||||
*/
|
||||
get_host_product: function() {
|
||||
let that = this;
|
||||
if(that.hotScroll) return
|
||||
getProductHot(
|
||||
that.hotPage,
|
||||
that.hotLimit,
|
||||
).then(res => {
|
||||
that.hotPage++
|
||||
that.hotScroll = res.data.list.length<that.hotLimit
|
||||
that.hostProduct = that.hostProduct.concat(res.data.list)
|
||||
// that.$set(that, 'hostProduct', res.data)
|
||||
});
|
||||
},
|
||||
//点击事件处理
|
||||
set_where: function(e) {
|
||||
switch (e) {
|
||||
case 1:
|
||||
// #ifdef H5
|
||||
return history.back();
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
return uni.navigateBack({
|
||||
delta: 1,
|
||||
})
|
||||
// #endif
|
||||
break;
|
||||
case 2:
|
||||
if (this.price == 0) this.price = 1;
|
||||
else if (this.price == 1) this.price = 2;
|
||||
else if (this.price == 2) this.price = 0;
|
||||
this.stock = 0;
|
||||
break;
|
||||
case 3:
|
||||
if (this.stock == 0) this.stock = 1;
|
||||
else if (this.stock == 1) this.stock = 2;
|
||||
else if (this.stock == 2) this.stock = 0;
|
||||
this.price = 0
|
||||
break;
|
||||
case 4:
|
||||
this.nows = !this.nows;
|
||||
break;
|
||||
}
|
||||
this.loadend = false;
|
||||
this.$set(this.where, 'page', 1);
|
||||
this.get_product_list(true);
|
||||
},
|
||||
//设置where条件
|
||||
setWhere: function() {
|
||||
if (this.price == 0) this.where.priceOrder = '';
|
||||
else if (this.price == 1) this.where.priceOrder = 'desc';
|
||||
else if (this.price == 2) this.where.priceOrder = 'asc';
|
||||
if (this.stock == 0) this.where.salesOrder = '';
|
||||
else if (this.stock == 1) this.where.salesOrder = 'desc';
|
||||
else if (this.stock == 2) this.where.salesOrder = 'asc';
|
||||
this.where.news = this.nows ? 1 : 0;
|
||||
},
|
||||
//查找产品
|
||||
get_product_list: function(isPage) {
|
||||
let that = this;
|
||||
that.setWhere();
|
||||
if (that.loadend) return;
|
||||
if (that.loading) return;
|
||||
if (isPage === true) that.$set(that, 'productList', []);
|
||||
that.loading = true;
|
||||
that.loadTitle = '';
|
||||
getProductslist(that.where).then(res => {
|
||||
let list = res.data.list;
|
||||
let productList = that.$util.SplitArray(list, that.productList);
|
||||
let loadend = list.length < that.where.limit;
|
||||
that.loadend = loadend;
|
||||
that.loading = false;
|
||||
that.loadTitle = loadend ? '已全部加载' : '加载更多';
|
||||
that.$set(that, 'productList', productList);
|
||||
that.$set(that.where, 'page', that.where.page + 1);
|
||||
}).catch(err => {
|
||||
that.loading = false;
|
||||
that.loadTitle = '加载更多';
|
||||
});
|
||||
},
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
onReachBottom() {
|
||||
if(this.productList.length>0){
|
||||
this.get_product_list();
|
||||
}else{
|
||||
this.get_host_product();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.productList .search {
|
||||
width: 100%;
|
||||
height: 86rpx;
|
||||
padding-left: 23rpx;
|
||||
box-sizing: border-box;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.productList .search .input {
|
||||
width: 640rpx;
|
||||
height: 60rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 50rpx;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.productList .search .input input {
|
||||
width: 548rpx;
|
||||
height: 100%;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.productList .search .input .placeholder {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.productList .search .input .iconfont {
|
||||
font-size: 35rpx;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.productList .search .icon-pailie,
|
||||
.productList .search .icon-tupianpailie {
|
||||
color: #fff;
|
||||
width: 62rpx;
|
||||
font-size: 40rpx;
|
||||
height: 86rpx;
|
||||
line-height: 86rpx;
|
||||
}
|
||||
|
||||
.productList .nav {
|
||||
height: 86rpx;
|
||||
color: #454545;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
background-color: #fff;
|
||||
margin-top: 86rpx;
|
||||
top: 0;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.productList .nav .item {
|
||||
width: 25%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.productList .nav .item.font-color {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.productList .nav .item image {
|
||||
width: 15rpx;
|
||||
height: 19rpx;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.productList .list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 172rpx;
|
||||
}
|
||||
|
||||
.productList .list.on {
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #f6f6f6;
|
||||
}
|
||||
|
||||
.productList .list .item {
|
||||
width: 345rpx;
|
||||
margin-top: 20rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.productList .list .item.on {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
border-bottom: 1rpx solid #f6f6f6;
|
||||
padding: 30rpx 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.productList .list .item .pictrue {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 345rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .pictrue.on {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .pictrue image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
}
|
||||
|
||||
.productList .list .item .pictrue image.on {
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .text {
|
||||
padding: 20rpx 17rpx 26rpx 17rpx;
|
||||
font-size: 30rpx;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.productList .list .item .text.on {
|
||||
width: 508rpx;
|
||||
padding: 0 0 0 22rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .text .money {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .text .money.on {
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .text .money .num {
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .text .vip {
|
||||
font-size: 22rpx;
|
||||
color: #aaa;
|
||||
margin-top: 7rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .text .vip.on {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.productList .list .item .text .vip .vip-money {
|
||||
font-size: 24rpx;
|
||||
color: #282828;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.productList .list .item .text .vip .vip-money image {
|
||||
width: 46rpx;
|
||||
height: 21rpx;
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
|
||||
.noCommodity {
|
||||
background-color: #fff;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,219 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class='searchGood'>
|
||||
<view class='search acea-row row-between-wrapper'>
|
||||
<view class='input acea-row row-between-wrapper'>
|
||||
<text class='iconfont icon-sousuo2'></text>
|
||||
<input type='text' :value='searchValue' :focus="focus" placeholder='点击搜索商品' placeholder-class='placeholder' @input="setValue"></input>
|
||||
</view>
|
||||
<view class='bnt' @tap='searchBut'>搜索</view>
|
||||
</view>
|
||||
<view class='title'>热门搜索</view>
|
||||
<view class='list acea-row'>
|
||||
<block v-for="(item,index) in hotSearchList" :key="index">
|
||||
<view class='item' @tap='setHotSearchValue(item.title)'>{{item.title}}</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class='line'></view>
|
||||
<goodList :bastList="bastList" v-if="bastList.length > 0"></goodList>
|
||||
<view class='loadingicon acea-row row-center-wrapper' v-if="bastList.length > 0">
|
||||
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
|
||||
</view>
|
||||
</view>
|
||||
<view class='noCommodity'>
|
||||
<view class='pictrue' v-if="bastList.length == 0">
|
||||
<image src='../../static/images/noSearch.png'></image>
|
||||
</view>
|
||||
<recommend :hostProduct='hostProduct' v-if="bastList.length == 0"></recommend>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getSearchKeyword,
|
||||
getProductslist,
|
||||
getProductHot
|
||||
} from '@/api/store.js';
|
||||
import goodList from '@/components/goodList';
|
||||
import recommend from '@/components/recommend';
|
||||
export default {
|
||||
components: {
|
||||
goodList,
|
||||
recommend
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
hostProduct: [],
|
||||
searchValue: '',
|
||||
focus: true,
|
||||
bastList: [],
|
||||
hotSearchList: [],
|
||||
first: 0,
|
||||
limit: 8,
|
||||
page: 1,
|
||||
loading: false,
|
||||
loadend: false,
|
||||
loadTitle: '加载更多',
|
||||
hotPage:1,
|
||||
isScroll:true
|
||||
};
|
||||
},
|
||||
onShow: function() {
|
||||
this.getRoutineHotSearch();
|
||||
this.getHostProduct();
|
||||
},
|
||||
onReachBottom: function() {
|
||||
if(this.bastList.length>0){
|
||||
this.getProductList();
|
||||
}else{
|
||||
this.getHostProduct();
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
getRoutineHotSearch: function() {
|
||||
let that = this;
|
||||
getSearchKeyword().then(res => {
|
||||
that.$set(that, 'hotSearchList', res.data);
|
||||
});
|
||||
},
|
||||
getProductList: function() {
|
||||
let that = this;
|
||||
if (that.loadend) return;
|
||||
if (that.loading) return;
|
||||
that.loading = true;
|
||||
that.loadTitle = '';
|
||||
getProductslist({
|
||||
keyword: that.searchValue,
|
||||
page: that.page,
|
||||
limit: that.limit
|
||||
}).then(res => {
|
||||
let list = res.data.list,
|
||||
loadend = list.length < that.limit;
|
||||
that.bastList = that.$util.SplitArray(list, that.bastList);
|
||||
that.$set(that,'bastList',that.bastList);
|
||||
that.loading = false;
|
||||
that.loadend = loadend;
|
||||
that.loadTitle = loadend ? "😕人家是有底线的~~" : "加载更多";
|
||||
that.page = that.page + 1;
|
||||
}).catch(err => {
|
||||
that.loading = false,
|
||||
that.loadTitle = '加载更多'
|
||||
});
|
||||
},
|
||||
getHostProduct: function() {
|
||||
let that = this;
|
||||
if(!this.isScroll) return
|
||||
getProductHot(that.hotPage,that.limit).then(res => {
|
||||
that.isScroll = res.data.list.length>=that.limit
|
||||
that.hostProduct = that.hostProduct.concat(res.data.list)
|
||||
that.hotPage += 1;
|
||||
});
|
||||
},
|
||||
setHotSearchValue: function(event) {
|
||||
this.$set(this, 'searchValue', event);
|
||||
this.page = 1;
|
||||
this.loadend = false;
|
||||
this.$set(this, 'bastList', []);
|
||||
this.getProductList();
|
||||
},
|
||||
setValue: function(event) {
|
||||
this.$set(this, 'searchValue', event.detail.value);
|
||||
},
|
||||
searchBut: function() {
|
||||
let that = this;
|
||||
that.focus = false;
|
||||
if (that.searchValue.length > 0) {
|
||||
that.page = 1;
|
||||
that.loadend = false;
|
||||
that.$set(that, 'bastList', []);
|
||||
uni.showLoading({
|
||||
title: '正在搜索中'
|
||||
});
|
||||
that.getProductList();
|
||||
uni.hideLoading();
|
||||
} else {
|
||||
return this.$util.Tips({
|
||||
title: '请输入要搜索的商品',
|
||||
icon: 'none',
|
||||
duration: 1000,
|
||||
mask: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.searchGood .search {
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
|
||||
.searchGood .search {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.searchGood .search .input {
|
||||
width: 598rpx;
|
||||
background-color: #f7f7f7;
|
||||
border-radius: 33rpx;
|
||||
padding: 0 35rpx;
|
||||
box-sizing: border-box;
|
||||
height: 66rpx;
|
||||
}
|
||||
|
||||
.searchGood .search .input input {
|
||||
width: 472rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.searchGood .search .input .placeholder {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.searchGood .search .input .iconfont {
|
||||
color: #000;
|
||||
font-size: 35rpx;
|
||||
}
|
||||
|
||||
.searchGood .search .bnt {
|
||||
width: 120rpx;
|
||||
text-align: center;
|
||||
height: 66rpx;
|
||||
line-height: 66rpx;
|
||||
font-size: 30rpx;
|
||||
color: #282828;
|
||||
}
|
||||
|
||||
.searchGood .title {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
margin: 50rpx 30rpx 25rpx 30rpx;
|
||||
}
|
||||
|
||||
.searchGood .list {
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.searchGood .list .item {
|
||||
font-size: 26rpx;
|
||||
color: #454545;
|
||||
padding: 0 21rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 3rpx;
|
||||
line-height: 60rpx;
|
||||
border: 1rpx solid #aaa;
|
||||
margin: 0 0 20rpx 20rpx;
|
||||
}
|
||||
|
||||
.searchGood .line {
|
||||
border-bottom: 1rpx solid #eee;
|
||||
margin: 20rpx 30rpx 0 30rpx;
|
||||
}
|
||||
</style>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue