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

View File

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

View File

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

View File

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

View File

@ -35,6 +35,53 @@ export function goodsFormatPrice(val) {
return valNum.toFixed(2).split("."); 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,
});
}
/** /**
* 脱敏姓名 * 脱敏姓名
*/ */