4 Commits

Author SHA1 Message Date
Yer11214
4400e406f6 IM客服适配 2024-10-20 21:48:31 +08:00
RyanRan
78f81a8407 删除店铺显示 2024-10-05 22:47:11 +08:00
misworga831
d166d5943c fix: 已选择的分销商品,一直显示十个商品,下拉并没有增加 2024-09-23 22:34:06 +08:00
chc
c0e5d75cc6 订单增加部分发货状态 2024-09-18 15:25:32 +08:00
26 changed files with 208 additions and 246 deletions

View File

@@ -2,6 +2,17 @@ import { http,Method } from "@/utils/request.js";
import api from "@/config/api.js";
export function getImSetting() {
return http.request({
url: `/other/setting/get/IM_SETTING`,
method: Method.GET,
needToken: true,
});
}
/**
* 获取聊天详情接口
* @param {*} talkId

View File

@@ -32,26 +32,7 @@
<span>已售 {{ item.buyCount || "0" }}</span>
<span>{{ item.commentNum || "0" }}条评论</span>
</div>
<div
class="store-seller-name"
v-if="storeName"
@click="navigateToStoreDetailPage(item)"
>
<div class="text-hidden">
<u-tag
style="margin-right: 10rpx"
size="mini"
mode="dark"
v-if="item.selfOperated"
text="自营"
type="error"
/>
<span>{{ item.storeName || "暂无" }}</span>
</div>
<span>
<u-icon name="arrow-right"></u-icon>
</span>
</div>
</view>
</view>
</view>

View File

@@ -34,16 +34,7 @@
<span>已售 {{ item.buyCount || "0" }}</span>
<span>{{ item.commentNum || "0" }}条评论</span>
</div>
<div class="store-seller-name" v-if="storeName" @click="navigateToStoreDetailPage(item)">
<div class="text-hidden">
<u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated"
text="自营" type="error" />
<span>{{ item.storeName || "暂无" }}</span>
</div>
<span>
<u-icon name="arrow-right"></u-icon>
</span>
</div>
</view>
</view>
</view>
@@ -79,18 +70,7 @@
<span style="float: left; font-size: 22rpx">已售 {{ item.buyCount || '0' }}</span>
<span style="float: right; font-size: 22rpx">{{ item.commentNum || '0' }}条评论</span>
</div>
<div style="overflow: hidden" @click="navigateToStoreDetailPage(item)" class="count-config">
<div class="text-hidden" v-if="storeName">
<u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated"
text="自营" type="error" />
<span class="line1-store-name">{{ item.storeName }}</span>
<span class="to-store">进店<u-icon size="24" name="arrow-right" color="#666"></u-icon>
</span>
</div>
<span>
<u-icon name="arrow-right" color="#c5c5c5"></u-icon>
</span>
</div>
</div>
</div>

View File

@@ -399,7 +399,7 @@
"pages": [{
"path": "shopPage",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "店铺详情",
"navigationStyle": "custom"
}
},{

View File

@@ -28,7 +28,6 @@
</view>
<view class="log-item-view">
<view>创建时间{{ item.createTime }}</view>
<view>店铺{{ item.storeName }}</view>
</view>
<view class="log-item-footer">
<view>会员名称{{ item.memberName }}</view>

View File

@@ -66,6 +66,7 @@
<!-- 商品列表 -->
<view class="goods-list">
<scroll-view class="body-view" scroll-y @scrolltolower="renderDate">
<u-swipe-action v-for="(item, index) in goodsList" :disabled="!params.checked" :show="item.___selected" @open="openAction(item)" :index="index" :options="options" bg-color="#fff"
ref="swiperAction" :key="item.id" @click="changeActionTab(item)">
@@ -102,6 +103,8 @@
</view>
</div>
</u-swipe-action>
</scroll-view>
<view class="empty">
<!-- <u-empty v-if="empty" text="没有分销商品了" mode="list"></u-empty> -->
@@ -295,15 +298,30 @@ export default {
});
this.goodsList.push(...res.data.result.records);
}
if (this.goodsList.length == 0) {
if (this.goodsList.length === 0) {
this.empty = true;
}
});
},
/**
* 底部加载数据
*/
renderDate() {
this.params.pageNumber += 1;
this.init();
},
},
};
</script>
<style lang="scss" scoped>
.body-view {
overflow-y: auto;
height: calc(100vh - 44px - 80rpx - 104rpx);
}
.canvas-hide {
/* 1 */
position: fixed;

View File

@@ -27,36 +27,7 @@
</scroll-view>
</view>
<!-- 显示收藏的店铺栏 -->
<view v-else class="tab-content">
<scroll-view class="list-scroll-content" scroll-y>
<!-- 空白页 -->
<u-empty style="margin-top: 40rpx" text="暂无收藏店铺数据" mode="favor" v-if="storeEmpty"></u-empty>
<!-- 店铺展示数据 -->
<u-swipe-action @open="openLeftChange(item, 'store')" :show="item.selected" btn-width="180"
:options="LeftOptions" v-else v-for="(item, index) in storeList" :key="index"
@click="clickStoreSwiperAction(item)">
<view class="store" @click="goStoreMainPage(item.id)">
<view class="intro">
<view class="store-logo">
<u-image width="102rpx" height="102rpx" :src="item.storeLogo" :alt="item.storeName"
mode="aspectFit">
<u-loading slot="loading"></u-loading>
</u-image>
</view>
<view class="store-name">
<view>{{ item.storeName }}</view>
<u-tag size="mini" type="error" :color="$mainColor" v-if="item.selfOperated"
text="自营" mode="plain" shape="circle" />
</view>
<view class="store-collect">
<view>进店逛逛</view>
</view>
</view>
</view>
</u-swipe-action>
</scroll-view>
</view>
</view>
</view>
</template>
@@ -90,14 +61,7 @@
pageSize: 10,
},
},
{
name: "店铺(0)",
params: {
pageNumber: 1,
pageSize: 10,
},
},
],
goodsEmpty: false, //商品数据是否为空

View File

@@ -9,7 +9,6 @@
<u-empty text="暂无历史记录" style="margin-top:200rpx;" mode="history" v-if="whetherEmpty"></u-empty>
<div v-else>
<view v-for="(item, index) in trackList" :key="index">
<view class="myTracks-title" @click="navigateToStore(item)">{{item.storeName}}</view>
<view class="myTracks-items">
<u-swipe-action style="width: 100%;" :show="item.show" :index="index" :key="item.id"

View File

@@ -28,9 +28,6 @@
>
<!-- 店铺名称 -->
<view class="seller-info u-flex u-row-between" v-if="current == 0">
<view class="seller-name">
<view class="name">{{ order.storeName }}</view>
</view>
<view class="order-sn">订单编号:{{ order.sn }}</view>
</view>
<!-- 申请记录 选项卡 -->

View File

@@ -2,13 +2,6 @@
<view class="content">
<u-form :model="form" ref="uForm">
<view class="after-sales-goods-detail-view">
<view class="header">
<view>
本次售后服务将由
<text class="seller-name">{{ sku.storeName }}</text>
为您提供
</view>
</view>
<view>
<view class="goods-item-view" v-for="(item,index) in sku.orderItems" v-if="item.sn == sn"
@click="gotoGoodsDetail(sku.goods_id)">

View File

@@ -2,13 +2,7 @@
<view class="mp-iphonex-bottom content">
<u-form :model="form" ref="uForm">
<view class="after-sales-goods-detail-view">
<view class="header">
<view>
本次售后服务将由
<text class="seller-name">{{ sku.storeName }}</text>
为您提供
</view>
</view>
<view>
<view class="goods-item-view" @click="gotoGoodsDetail(sku.skuId)">
<view class="goods-img">

View File

@@ -1,13 +1,7 @@
<template>
<view>
<view class="after-sales-goods-detail-view">
<view class="header">
<view>
本次售后服务将由
<text class="seller-name">{{ sku.storeName }}</text>
为您提供
</view>
</view>
<view>
<view class="goods-item-view" :key="index" v-for="(item,index) in sku.orderItems" v-if="item.sn == sn" @click="navigateToGoodsDetail(sku.skuId)">
<view class="goods-img">

View File

@@ -1,13 +1,6 @@
<template>
<view v-if="serviceDetail">
<view class="after-sales-goods-detail-view">
<view class="header">
<view>
本次售后服务将由
<text class="seller-name">{{ serviceDetail.storeName }}</text>
为您提供
</view>
</view>
<view class="apply-info-view">
<view class="status-info">
<view class="status-info-box">

View File

@@ -4,7 +4,6 @@
<view class="seller-view">
<view class="seller-info u-flex u-row-between">
<view class="seller-name">
<view class="name">{{ order.storeName || "" }}</view>
<view class="status">{{ orderStatusList[order.orderStatus] }}</view>
</view>
<view class="order-sn"></view>
@@ -68,6 +67,7 @@ export default {
orderStatusList: {
//订单状态列表
UNDELIVERED: "待发货",
PARTS_DELIVERED: "部分发货",
UNPAID: "未付款",
PAID: "已付款",
DELIVERED: "已发货",

View File

@@ -2,9 +2,6 @@
<view>
<view class="seller-view" v-for="(item, index) in complaionData" :key="index">
<view class="seller-info u-flex u-row-between">
<view class="seller-name">
<view class="name">{{ item.storeName }}</view>
</view>
<view class="order-sn">{{ statusData[item.complainStatus] }}</view>
</view>
<u-line color="#DCDFE6"></u-line>

View File

@@ -11,11 +11,6 @@
<u-empty text="尚无需要评价的商品" mode="list" v-if="orderList.length == 0"></u-empty>
<view class="seller-view" v-for="(order, index) in orderList" :key="index">
<!-- 店铺名称 -->
<view class="box-title">
<view class="title_seller_name">
{{ order.storeName }}
</view>
</view>
<view v-for="(sku, _index) in order.orderItems" :key="_index">
<view class="goods-item-view">
<view>

View File

@@ -125,11 +125,6 @@
:key="index"
>
<div v-if="item.checked">
<div @click="navigateToStore(item)">
<div class="store-name">
<span>{{ item.storeName }}</span>
</div>
</div>
<div class="promotionNotice">{{ item.promotionNotice || "" }}</div>
<div
class="flex goods-item"

View File

@@ -39,10 +39,7 @@
v-for="(order, oderIndex) in tabItem.orderList"
>
<!-- 店铺名称 -->
<view class="seller-info u-flex u-row-between">
<view class="seller-name wes" @click="navigateToStore(order)">
<view class="name wes">{{ order.storeName }}</view>
</view>
<view class="seller-info u-flex u-row-left ">
<view class="order-sn">{{
order.orderStatus | orderStatusList
}}</view>
@@ -701,7 +698,7 @@ page,
}
.order-sn {
flex:2;
width:120rpx;
text-align: center;
color: $aider-light-color;

View File

@@ -72,14 +72,6 @@
<view>
<view class="seller-view">
<!-- 店铺名称 -->
<view class="seller-info u-flex u-row-between">
<view class="seller-name" @click="goToShopPage(order)">
<view class="name">{{ order.storeName }}</view>
<view class="status" v-if="orderStatusList[order.orderStatus]"> {{ orderStatusList[order.orderStatus].title
}}</view>
</view>
<view class="order-sn"></view>
</view>
<view>
<view v-for="(sku, skuIndex) in orderGoodsList" :key="skuIndex">
<view class="goods-item-view">
@@ -289,6 +281,10 @@ export default {
title: "待发货",
value: "商品等待发货中",
},
PARTS_DELIVERED: {
title: "部分发货",
value: "商品已部分发货。",
},
DELIVERED: {
title: "已发货",
value: "商品已发货,请您耐心等待",

View File

@@ -183,8 +183,6 @@
<!-- 评价 -->
<Evaluation id="main5" :goodsDetail="goodsDetail" />
<!-- 店铺推荐 -->
<storeLayout id="main7" :storeDetail="storeDetail" :goodsDetail="goodsDetail" :res="recommendList" />
<!-- 宝贝详情 -->
<GoodsIntro id="main9" :res="goodsDetail" :goodsParams="goodsParams" :goodsId="goodsDetail.goodsId"
@@ -198,10 +196,6 @@
<view class="page-bottom mp-iphonex-bottom" id="pageBottom">
<view class="icon-btn">
<view class="icon-btn-item" @click="navigateToStore(goodsDetail.storeId)">
<u-icon size="34" class="red" name="home-fill"></u-icon>
<view class="red icon-btn-name">店铺</view>
</view>
<view class="icon-btn-item" @click="linkMsgDetail()">
<u-icon size="34" name="kefu-ermai"></u-icon>
<view class="icon-btn-name">客服</view>
@@ -293,7 +287,7 @@ import PromotionAssembleListLayout from "./product/promotion/-promotion-assemble
import PromotionCoupon from "./product/promotion/-promotion-coupon"; //优惠券组件
import GoodsIntro from "./product/goods/-goods-intro"; //商品介绍组件
import GoodsRecommend from "./product/goods/-goods-recommend"; //宝贝推荐
import storeLayout from "./product/shop/-shop"; //店铺组件
import Evaluation from "./product/evaluation/-evaluation"; //评价组件
import GoodsSwiper from "./product/goods/-goods-swiper"; //轮播图组件
import popupGoods from "@/components/m-buy/goods"; //购物车商品的模块
@@ -314,7 +308,7 @@ export default {
PromotionCoupon,
GoodsIntro,
GoodsRecommend,
storeLayout,
Evaluation,
GoodsSwiper,
popupGoods,
@@ -625,7 +619,7 @@ export default {
linkMsgDetail () {
// lili 基础客服
this.$options.filters.talkIm(this.goodsDetail.storeId, this.routerVal.goodsId, this.routerVal.id)
this.$options.filters.talkIm(this.goodsDetail.storeId, this.routerVal.goodsId, this.routerVal.id,this.goodsDetail)
// uni.navigateTo({
// url: `/pages/mine/im/index?userId=${this.goodsDetail.storeId}&goodsid=${this.routerVal.goodsId}&skuid=${this.routerVal.id}`
// });

View File

@@ -6,10 +6,6 @@
<u-image width="120rpx" mode="aspectFit" height="120rpx" :src="storeDetail.storeLogo"></u-image>
</view>
<view class="name-star star-con">
<div class="name">
{{ storeDetail.storeName }}
<span v-if="storeDetail.selfOperated == 1" class="shopTag">自营</span>
</div>
<div class="store-row">
<div class="collectionNum">{{ storeDetail.collectionNum || 0 }}人关注</div>
<div class="goodsNum">{{ storeDetail.goodsNum || 0 }}件商品</div>

View File

@@ -11,9 +11,6 @@
</u-image>
</div>
<div class="store-msg">
<div class="store-name">
{{item.storeName}}
</div>
<div class="goods-num">
商品 {{item.goodsNum}}
</div>

View File

@@ -19,24 +19,8 @@
:key="index">
<view class="tab">
<view class="store-line">
<u-checkbox-group class="store-line-check">
<!-- #ifndef MP-WEIXIN -->
<u-checkbox shape="circle" :active-color="lightColor" v-model="item.checked"
@change="checkboxChangeDP(item)"></u-checkbox>
<!-- #endif -->
<!-- 微信小程序这里 v-model出现问题改用:value -->
<!-- #ifdef MP-WEIXIN -->
<u-checkbox shape="circle" :active-color="lightColor" :value="item.checked"
@change="checkboxChangeDP(item)"></u-checkbox>
<!-- #endif -->
</u-checkbox-group>
<span class="store-name wes store-line-desc" @click.stop="navigateToStore(item)">{{
item.storeName
}}</span>
<u-icon @click="navigateToStore(item)" size="24" style="margin-left:10rpx;" name="arrow-right"></u-icon>
</view>
<view class="right-col" v-if="item.canReceiveCoupon" @click="navigateToCoupon(item)">
<div class="right-line"></div>
<span>领劵</span>
</view>
</view>

View File

@@ -91,12 +91,6 @@
<view>关于</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/passport/entry/seller/index')">
<image src="/static/mine/feedback.png" mode=""></image>
<view>店铺入驻</view>
</view>
<view class="interact-item" @click="navigateTo('/pages/mine/set/setUp')">
<image src="/static/mine/setting.png" mode=""></image>
<view>设置</view>

View File

@@ -153,6 +153,9 @@ $font-weight: 400;
.flex-j-sb{
justify-content: space-between;
}
.flex-j-c{
justify-content: center;
}
.relative {
position: relative;
}

View File

@@ -10,7 +10,7 @@ import Foundation from "./Foundation.js";
* @param location
* @returns {*}
*/
export function unitPrice (val, unit, location) {
export function unitPrice(val, unit, location) {
if (!val) val = 0;
let price = Foundation.formatPrice(val);
if (location === "before") {
@@ -27,7 +27,7 @@ export function unitPrice (val, unit, location) {
* @param {*} val
* @returns
*/
export function goodsFormatPrice (val) {
export function goodsFormatPrice(val) {
if (typeof val == "undefined") {
return val;
}
@@ -40,7 +40,7 @@ export function goodsFormatPrice (val) {
* 将内容复制到粘贴板
*/
import { h5Copy } from "@/js_sdk/h5-copy/h5-copy.js";
export function setClipboard (val) {
export function setClipboard(val) {
// #ifdef H5
if (val === null || val === undefined) {
val = "";
@@ -76,7 +76,7 @@ export function setClipboard (val) {
* 拨打电话
*/
export function callPhone (phoneNumber) {
export function callPhone(phoneNumber) {
uni.makePhoneCall({
phoneNumber: phoneNumber,
});
@@ -86,7 +86,7 @@ export function callPhone (phoneNumber) {
* 脱敏姓名
*/
export function noPassByName (str) {
export function noPassByName(str) {
if (null != str && str != undefined) {
if (str.length <= 3) {
return "*" + str.substring(1, str.length);
@@ -106,7 +106,7 @@ export function noPassByName (str) {
* @param format
* @returns {*|string}
*/
export function unixToDate (unix, format) {
export function unixToDate(unix, format) {
let _format = format || "yyyy-MM-dd hh:mm:ss";
const d = new Date(unix * 1000);
const o = {
@@ -137,7 +137,7 @@ export function unixToDate (unix, format) {
*
* @param {Object} datetime
*/
export function beautifyTime (datetime = "") {
export function beautifyTime(datetime = "") {
if (datetime == null || datetime == undefined || !datetime) {
return "";
}
@@ -187,7 +187,7 @@ export function beautifyTime (datetime = "") {
return `${minutes}分钟前`;
}
// 时间转换
function timestampToTime (timestamp) {
function timestampToTime(timestamp) {
var date = new Date(timestamp);//时间戳为10位需*1000时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
@@ -203,7 +203,7 @@ function timestampToTime (timestamp) {
* @param mobile
* @returns {*}
*/
export function secrecyMobile (mobile) {
export function secrecyMobile(mobile) {
mobile = String(mobile);
if (!/\d{11}/.test(mobile)) {
return mobile;
@@ -216,7 +216,7 @@ export function secrecyMobile (mobile) {
*
* @param {Object} datetime
*/
export function formatTime (datetime) {
export function formatTime(datetime) {
if (datetime == null) return "";
datetime = datetime.replace(/-/g, "/");
@@ -271,7 +271,7 @@ export function formatTime (datetime) {
* @param {String} cFormat
* @returns {String | null}
*/
export function parseTime (time, cFormat) {
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
return null;
}
@@ -320,7 +320,7 @@ export function parseTime (time, cFormat) {
* 清除逗号
*
*/
export function clearStrComma (str) {
export function clearStrComma(str) {
str = str.replace(/,/g, ""); //取消字符串中出现的所有逗号
return str;
}
@@ -330,7 +330,7 @@ export function clearStrComma (str) {
* @param val 如果为auth则判断是否登录
* 如果传入 auth 则为判断是否登录
*/
export function isLogin (val) {
export function isLogin(val) {
let userInfo = storage.getUserInfo();
if (val == "auth") {
return userInfo && userInfo.id ? true : false;
@@ -343,12 +343,12 @@ export function isLogin (val) {
* 退出登录
*
*/
export function quiteLoginOut () {
export function quiteLoginOut() {
uni.showModal({
title: "提示",
content: "是否退出登录?",
confirmColor: Vue.prototype.$mainColor,
async success (res) {
async success(res) {
if (res.confirm) {
storage.setAccessToken("");
storage.setRefreshToken("");
@@ -365,12 +365,12 @@ export function quiteLoginOut () {
* 用户注销
*
*/
export function logoff () {
export function logoff() {
uni.showModal({
title: "提示",
content: "确认注销用户么注销用户将无法再次登录并失去当前数据就。根据法规数据最长保留6个月期间可以联系客服人员进行恢复数据。",
confirmColor: Vue.prototype.$mainColor,
async success (res) {
async success(res) {
if (res.confirm) {
await logoffConfirm();
storage.setAccessToken("");
@@ -382,24 +382,93 @@ export function logoff () {
});
}
import { getImSetting } from '@/api/im.js'
/**
* 跳转im
*/
export function talkIm (storeId, goodsId, id) {
export async function talkIm(storeId, goodsId, id,goodsDetail) {
if (isLogin('auth')) {
let url = `/pages/mine/im/index?userId=${storeId}`
if(goodsId && id) url = `/pages/mine/im/index?userId=${storeId}&goodsid=${goodsId}&skuid=${id}`
uni.navigateTo({
url
});
try {
const res = await getImSetting()
if (res.data.success) {
let setting = res.data.result
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
let curRoute = routes[routes.length - 1].route //获取当前页面路由
let curParam = routes[routes.length - 1].options; //获取路由参数
// 拼接参数
let param = ''
for (let key in curParam) {
param += '&' + key + '=' + curParam[key]
}
// #ifdef H5
window.location.href = setting.url;
// #endif
// #ifdef APP-PLUS
let sweixin = null
plus.share.getServices(res => {
sweixin = res.find(i => i.id === 'weixin')
if (sweixin) {
sweixin.openCustomerServiceChat({
corpid: setting.companyId,
url: setting.url,
}, suc => {
console.log("success", JSON.stringify(res))
}, err => {
console.log("error", JSON.stringify(err))
})
} else {
plus.nativeUI.alert('当前环境不支持微信操作!')
}
}, function () {
uni.showToast({
title: "获取服务失败,不支持该操作。" + JSON.stringify(e),
icon: 'error'
})
})
// plus.runtime.openURL('https://work.weixin.qq.com/kfid/kfcda2f3a9985de16f7', function(res) {});
// #endif
// #ifdef MP-WEIXIN
if (wx.openCustomerServiceChat) {
console.log(curRoute + param)
wx.openCustomerServiceChat({
extInfo: { url: setting.url },
corpId: setting.companyId,
sendMessageImg: goodsDetail.goodsGalleryList[0],
sendMessagePath: curRoute + param,
sendMessageTitle: goodsDetail.goodsName,
showMessageCard: true,
success(res) {
console.log("res", res)
}
})
} else {
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
uni.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})
}
// #endif
}
} catch (error) {
// uni.showToast({
// title: '网络错误请稍后重试',
// icon: 'none'
// })
}
}
else {
tipsToLogin()
}
}
export function tipsToLogin (type) {
export function tipsToLogin(type) {
if (!isLogin("auth")) {
uni.showModal({
title: "提示",
@@ -409,9 +478,12 @@ export function tipsToLogin (type) {
confirmColor: Vue.prototype.$mainColor,
success: (res) => {
if (res.confirm) {
navigateToLogin();
// navigateToLogin();
uni.navigateTo({
url: "/pages/passport/login",
})
} else if (res.cancel) {
if(type !== 'normal'){
if (type !== 'normal') {
uni.navigateBack();
}
@@ -426,7 +498,7 @@ export function tipsToLogin (type) {
/**
* 获取用户信息并重新添加到缓存里面
*/
export async function userInfo () {
export async function userInfo() {
let res = await getUserInfo();
if (res.data.success) {
storage.setUserInfo(res.data.result);
@@ -440,7 +512,7 @@ export async function userInfo () {
* @returns
*/
export function forceLogin () {
export function forceLogin() {
let userInfo = storage.getUserInfo();
if (!userInfo || !userInfo.id) {
// #ifdef MP-WEIXIN
@@ -465,7 +537,7 @@ export function forceLogin () {
* 获取当前加载的页面对象
* @param val
*/
export function getPages (val) {
export function getPages(val) {
const pages = getCurrentPages(); //获取加载的页面
const currentPage = pages[pages.length - 1]; //获取当前页面的对象
const url = currentPage.route; //当前页面url
@@ -476,7 +548,7 @@ export function getPages (val) {
/**
* 跳转到登录页面
*/
export function navigateToLogin (type = "navigateTo") {
export function navigateToLogin(type = "navigateTo") {
/**
* 此处进行条件编译判断
* 微信小程序跳转到微信小程序登录页面
@@ -497,7 +569,7 @@ export function navigateToLogin (type = "navigateTo") {
/**
* 服务状态列表
*/
export function serviceStatusList (val) {
export function serviceStatusList(val) {
let statusList = {
APPLY: "申请售后",
PASS: "通过售后",
@@ -517,11 +589,12 @@ export function serviceStatusList (val) {
/**
* 订单状态列表
*/
export function orderStatusList (val) {
export function orderStatusList(val) {
let orderStatusList = {
UNDELIVERED: "待发货",
UNPAID: "未付款",
PAID: "已付款",
PARTS_DELIVERED: "部分发货",
DELIVERED: "已发货",
CANCELLED: "已取消",
COMPLETED: "已完成",
@@ -531,3 +604,21 @@ export function orderStatusList (val) {
};
return orderStatusList[val];
}
// 比较版本
export function compareVersions(str1, str2) {
const arr1 = str1.split('.').map(Number);
const arr2 = str2.split('.').map(Number);
const length = Math.max(arr1.length, arr2.length);
for (let i = 0; i < length; i++) {
if (arr1[i] > arr2[i]) {
return 1;
} else if (arr1[i] < arr2[i]) {
return -1;
}
}
return 0;
}