style: 新增复制粘贴以及拨打电话封装模块,优化部分文件中的变量名、将冗余功能抽出、优化订单详情展示

master
学习很差啦 2023-01-29 18:14:53 +08:00
parent 43fc159e27
commit 5dc562396c
5 changed files with 96 additions and 80 deletions

View File

@ -83,20 +83,7 @@ export default {
this.configs.shareLink +
getCurrentPages()[getCurrentPages().length - 1].__page__.fullPath;
}
if (content === null || content === undefined) {
content = "";
} else content = content + "";
const result = h5Copy(content);
if (result === false) {
uni.showToast({
title: "不支持",
});
} else {
uni.showToast({
title: "复制成功",
icon: "none",
});
}
this.$options.filters.setClipboard(content)
},
// #endif

View File

@ -14,7 +14,7 @@ export default {
customerServiceEmail: "lili@lili.com", //客服邮箱
imWebSrc: "https://im.pickmall.cn", //IM地址
baseWsUrl: "wss://im-api.pickmall.cn/lili/webSocket", // IM WS 地址
enableGetClipboard: true, //是否启用粘贴板获取 scanAuthNavigation 中的链接,如果匹配则会跳转到对应页面
enableGetClipboard: false, //是否启用粘贴板获取 scanAuthNavigation 中的链接,如果匹配则会跳转到对应页面
enableMiniBarStartUpApp: true, //是否在h5中右侧浮空按钮点击启动app
/**
* 如需更换主题请修改此处以及uni.scss中的全局颜色

View File

@ -9,21 +9,21 @@
</div>
<!-- 物流信息 -->
<view class="info-view logi-view">
<view class="logi-List" v-if="logiList && logiList.traces.length != 0">
<view class="logi-List-title">
{{ logiList.traces[logiList.traces.length - 1].AcceptStation }}
<view class="info-view logistics-view">
<view class="logistics-List" v-if="logisticsList && logisticsList.traces.length != 0 ">
<view class="logistics-List-title">
{{ logisticsList.traces[logisticsList.traces.length - 1].AcceptStation }}
</view>
<view class="logi-List-time">
{{ logiList.traces[logiList.traces.length - 1].AcceptTime }}
<view class="logistics-List-time">
{{ logisticsList.traces[logisticsList.traces.length - 1].AcceptTime }}
</view>
</view>
<view class="logi-List" v-else>
<view class="logistics-List" v-else>
<view class="verificationCode" v-if="order.verificationCode">
券码 {{ order.verificationCode }}
</view>
<view v-else class="logi-List-title">
<view v-else class="logistics-List-title">
{{ '暂无物流信息' }}
</view>
</view>
@ -47,12 +47,15 @@
<view class="info-view" v-if="order.deliveryMethod == 'SELF_PICK_UP'">
<view class="address-view">
<view>
<view class="address-title">
自提点地址:<span>{{ order.storeAddressPath }}</span>
<view class="order-info-view">
<view class="title">自提点地址:</view>
<view class="value address-line-height">{{ order.storeAddressPath }}</view>
</view>
<view class="address-title">
联系方式:<span>{{ order.storeAddressMobile }}</span>
<view class="order-info-view" @click="callPhone" >
<view class="title">联系方式:</view>
<view class="value">{{ order.storeAddressMobile }}<u-icon name='phone-fill' ></u-icon></view>
</view>
</view>
</view>
</view>
@ -62,7 +65,7 @@
<view class="seller-view">
<!-- 店铺名称 -->
<view class="seller-info u-flex u-row-between">
<view class="seller-name" @click="tostore(order)">
<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>
@ -165,7 +168,7 @@
</view>
<view class="order-info-view">
<view class="title">支付方式</view>
<view class="value">{{ orderDetail.paymentMethodValue }}</view>
<view class="value">{{ orderDetail.paymentMethodValue || '暂无'}}</view>
</view>
</view>
</view>
@ -173,7 +176,7 @@
<view class="info-view" v-if="order.payStatus == 'PAID'">
<view>
<view class="invoice-info-view">
<view class="ltitle">发票信息</view>
<view class="invoice-title">发票信息</view>
<view v-if="!order.needReceipt" class="value"></view>
<view v-else class="value" @click="onReceipt(orderDetail.receipt)"></view>
</view>
@ -232,8 +235,8 @@
@confirm="confirmRog"></u-modal>
<!-- 分享 -->
<shares v-if="shareFlage" :thumbnail="orderDetail.orderItems[0].image"
:goodsName="orderDetail.orderItems[0].goodsName" @close="shareFlage = false" />
<shares v-if="shareFlag" :thumbnail="orderDetail.orderItems[0].image"
:goodsName="orderDetail.orderItems[0].goodsName" @close="shareFlag = false" />
</view>
</template>
@ -242,7 +245,6 @@
import { getExpress } from "@/api/trade.js";
import { cancelOrder, confirmReceipt, getOrderDetail } from "@/api/order.js";
import { h5Copy } from "@/js_sdk/h5-copy/h5-copy.js";
import shares from "@/components/m-share/index"; //
import { getClearReason } from "@/api/after-sale.js";
@ -254,8 +256,8 @@ export default {
data() {
return {
lightColor: this.$lightColor,
logiList: "", //
shareFlage: false, //
logisticsList: "", //
shareFlag: false, //
orderStatusList: {
UNPAID: {
title: "未付款",
@ -305,7 +307,10 @@ export default {
this.sn = options.sn;
},
methods: {
tostore(val) {
callPhone(){
this.$options.filters.callPhone(this.order.storeAddressMobile )
},
goToShopPage(val) {
uni.navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId,
});
@ -313,13 +318,13 @@ export default {
//
loadLogistics(sn) {
getExpress(sn).then((res) => {
this.logiList = res.data.result;
this.logisticsList = res.data.result;
});
},
//
inviteGroup() {
this.shareFlage = true;
this.shareFlag = true;
},
// #TODO
ByUserMessage(order) {
@ -360,35 +365,7 @@ export default {
});
},
onCopy(sn) {
// #ifdef H5
if (sn === null || sn === undefined) {
sn = "";
} else sn = sn + "";
const result = h5Copy(sn);
if (result === false) {
uni.showToast({
title: "不支持",
});
} else {
uni.showToast({
title: "复制成功",
icon: "none",
});
}
// #endif
// #ifndef H5
uni.setClipboardData({
data: sn,
success: function () {
uni.showToast({
title: "复制成功!",
duration: 2000,
icon: "none",
});
},
});
// #endif
this.$options.filters.setClipboard(sn)
},
/**
@ -546,7 +523,7 @@ export default {
flex-wrap: wrap;
}
.logi-view {
.logistics-view {
justify-content: space-between;
padding: 30rpx !important;
margin: 0 !important;
@ -566,12 +543,12 @@ export default {
}
}
.logi-List-title {
.logistics-List-title {
margin-bottom: 10rpx;
font-size: 26rpx;
}
.logi-List-time {
.logistics-List-time {
font-size: 24rpx;
color: #999;
}
@ -666,11 +643,14 @@ page,
width: 140rpx;
font-size: 24rpx;
font-weight: 600;
flex:3;
min-width: 160rpx;
}
.value {
color: #666;
font-size: 24rpx;
flex:10;
}
.copy {
@ -688,7 +668,7 @@ page,
width: 100%;
margin: 10rpx 0rpx;
.ltitle {
.invoice-title {
width: 550rpx;
font-size: 28rpx;
color: #333333;
@ -765,4 +745,7 @@ page,
text-align: center;
}
}
.address-line-height{
line-height: 1.75;
}
</style>

View File

@ -31,7 +31,7 @@
}}</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="navigateToConpon(item)">
<view class="right-col" v-if="item.canReceiveCoupon" @click="navigateToCoupon(item)">
<div class="right-line"></div>
<span>领劵</span>
</view>
@ -119,7 +119,7 @@
</u-swipe-action>
</div>
</div>
<u-modal v-model="deleteShow" :confirm-style="{'color':lightColor}" @confirm="delectConfirm" show-cancel-button
<u-modal v-model="deleteShow" :confirm-style="{'color':lightColor}" @confirm="deleteConfirm" show-cancel-button
:content="deleteContent" :async-close="true"></u-modal>
<!-- 结账 -->
<div class="box box6">
@ -220,7 +220,6 @@ export default {
// #endif
},
onPullDownRefresh(){
console.log("132")
this.getCardData();
},
/**
@ -283,7 +282,7 @@ export default {
/**
* 点击删除
*/
delectConfirm() {
deleteConfirm() {
API_Trade.deleteSkuItem(this.goodsVal.goodsSku.id).then((res) => {
if (res.statusCode == 200) {
uni.showToast({
@ -341,7 +340,7 @@ export default {
/**
* 跳转到优惠券
*/
navigateToConpon(val) {
navigateToCoupon(val) {
uni.navigateTo({
url: "/pages/cart/coupon/couponCenter?storeId=" + val.storeId,
});
@ -512,19 +511,19 @@ export default {
uni.stopPullDownRefresh();
if (result.data.success) {
this.cartDetail = result.data.result;
let checkouted = true;
let checkOuted = true;
for (let i = 0; i < this.cartDetail.cartList.length; i++) {
let item = this.cartDetail.cartList[i];
console.log(item);
//
if (item.checked == 0) {
checkouted = false;
checkOuted = false;
}
// 便
item.skuList &&
item.skuList.forEach((sku) => {
if (sku.checked == 0) {
checkouted = false;
checkOuted = false;
}
if(Object.keys(sku.promotionMap).length != 0)
{
@ -538,7 +537,7 @@ export default {
});
}
this.checkout = checkouted;
this.checkout = checkOuted;
uni.stopPullDownRefresh();
}
})

View File

@ -35,6 +35,53 @@ export function goodsFormatPrice(val) {
return valNum.toFixed(2).split(".");
}
/**
* 将内容复制到粘贴板
*/
import { h5Copy } from "@/js_sdk/h5-copy/h5-copy.js";
export function setClipboard(val){
// #ifdef H5
if (val === null || val === undefined) {
val = "";
} else val = val + "";
const result = h5Copy(val);
if (result === false) {
uni.showToast({
title: "不支持",
});
} else {
uni.showToast({
title: "复制成功",
icon: "none",
});
}
// #endif
// #ifndef H5
uni.setClipboardData({
data: val,
success: function () {
uni.showToast({
title: "复制成功!",
duration: 2000,
icon: "none",
});
},
});
// #endif
}
/**
* 拨打电话
*/
export function callPhone(phoneNumber) {
uni.makePhoneCall({
phoneNumber: phoneNumber,
});
}
/**
* 脱敏姓名
*/