yarkool-kefu
v1.0.4
Published
微信小程序客服组件
Downloads
8
Readme
goodDetail.wxml
<view class="icon-btn" bindtap="toCustomerService" data-goods="{{CurStock}}">
<image
class="img-icon mx-auto mb"
src="/images/never/good6.png"
style="width:50rpx;height:50rpx;"
mode="aspectFit"
/>
<view class="lh-3 text-xm text-center text-block">客服</view>
</view>
goodDetail.js
// 若没有CurStock,就在请求toCustomerService接口下面加 !!!minxinahui没售后 没CurStock
let goods = {
StockName: (this.data.currentStock.StockName),
ItemName: (this.data.ItemName),
ImageUrl: this.data.currentStock.ImageUrl,
SalePrice: this.data.currentStock.SalePrice,
StockID: this.data.currentStock.StockID,
ItemID: this.data.ItemID
}
toCustomerService(e) {
wx.getStorage({
key: 'member',
success: (res => {
let goods = encodeURIComponent(JSON.stringify(e.currentTarget.dataset.goods));
wx.navigateTo({
url: `/packageA/pages/customerService_com/customerService/customerService?goods=${goods}&CustomerServiceType=1`,
})
}),
fail: (rej => {
wx.switchTab({
url: `/pages/index/user/user`,
})
})
})
},
user.js
toCustomerService(){
wx.navigateTo({
url: '/packageA/pages/customerService_com/customerService/customerService?CustomerServiceType=2',
})
}
app.wxss
/* 客服主题颜色 */
.bg-color {
background-color: #66c5c2 !important;
}
.bor-btm-color {
border-bottom: 4rpx solid #66c5c2 !important;
}
.bor-color {
border: 2rpx solid #66c5c2 !important;
}
.text-color {
color: #66c5c2 !important;
}
.search_status-bg_text {
background-color: #66c5c2 !important;
color: #fff !important;
}
app.js resData 为请求 GetAppInfo 的返回值
wx.setStorage({
key: "TenantCode",
data: resData.TenantCode,
});
order.wxml ......
<block wx:if="{{(v.OrderStatus==2 || v.OrderStatus==3 || v.OrderStatus==8)}}" class="ptb30">
<button class="red" size="mini"
catchtap="toCustomerService" data-order="{{v}}">联系客服</button>
</block>
order.js
toCustomerService(e) {
let data = null;
if (e.currentTarget.dataset.order) {
let order = e.currentTarget.dataset.order
let obj = {
PayNo: order.PayNo,
StatusText: order.OrderStatusText,
TotalAmount: order.Amount,
OrderID: order.OrderID
}
let OrderItems = []
for (let j = 0; j < order.ApiOrderItemList.length; j++) {
OrderItems.push({
ImageUrl: order.ApiOrderItemList[j].ImageUrl,
ItemName: order.ApiOrderItemList[j].ItemName,
StockName: order.ApiOrderItemList[j].StockName,
BuyNumber: order.ApiOrderItemList[j].Number,
Amount: order.ApiOrderItemList[j].Price
})
}
data = {
...obj,
OrderItems
};
wx.getStorage({
key: 'member',
success: (res => {
wx.navigateTo({
url: `/packageA/pages/customerService_com/customerService/customerService?order=${encodeURIComponent(JSON.stringify(data))}&CustomerServiceType=2`,
})
}),
fail: (rej => {
wx.switchTab({
url: `/pages/index/user/user`,
})
})
})
}
},