榴莲果配置 扫码加好友
This commit is contained in:
parent
e6d75c5a01
commit
d77e175b52
|
@ -72,5 +72,15 @@ export const durian = {
|
|||
load: true,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 榴莲果配置
|
||||
* @param {Object} param
|
||||
*/
|
||||
durianFruitConfig() {
|
||||
return util.request({
|
||||
url: `/coreplay/durianFruitTransactionType/10`,
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
}
|
||||
export default durian
|
|
@ -449,6 +449,31 @@ const shop = {
|
|||
query: param,
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 根据店铺id查商品列表
|
||||
* @param {Object} param
|
||||
*/
|
||||
getShopProductList(param) {
|
||||
return util.request({
|
||||
url: `/shopify/appProductionApi/getProductionList`,
|
||||
method: 'GET',
|
||||
query: param,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询用户在当前商铺的订单列表
|
||||
* @param {Object} param
|
||||
*/
|
||||
getShopOrderList(param) {
|
||||
return util.request({
|
||||
url: `/shopify/appOrder/getOrderList`,
|
||||
method: 'GET',
|
||||
query: param,
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default shop
|
|
@ -8,6 +8,7 @@ const config = {
|
|||
// #ifndef H5
|
||||
// host: 'http://91f.xyz:8080',
|
||||
host: 'https://b433d23.r24.cpolar.top/',
|
||||
// host: 'http://hvw2rn.natappfree.cc',
|
||||
// #endif
|
||||
// 支付方式配置
|
||||
payType: {
|
||||
|
|
|
@ -110,6 +110,28 @@ function handleList(list) {
|
|||
if (item.groupId != null) {
|
||||
item.unreadCount = getGroupNoReadNum(item.groupId)
|
||||
}
|
||||
if (item.callbackJson.callback_json.length) {
|
||||
let msgType = item.callbackJson.callback_json[0].MsgType;
|
||||
if (msgType == TencentCloudChat.TYPES.MSG_TEXT) {
|
||||
item.chatText = item.callbackJson.callback_json[0].MsgContent.Text
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_IMAGE) {
|
||||
item.chatText = '[图片]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_AUDIO) {
|
||||
item.chatText = '[语音]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_VIDEO) {
|
||||
item.chatText = '[视频]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_CUSTOM) {
|
||||
if (item.callbackJson.callback_json[0].businessType == 'redPacket') {
|
||||
item.chatText = `[红包] ${item.callbackJson.blessing}`
|
||||
} else if (item.callbackJson.callback_json[0].businessType == '1') {
|
||||
// if (item.callbackJson.callback_json[0].call_type == '1') {
|
||||
// item.chatText = '[语音通话]'
|
||||
// } else if (item.callbackJson.callback_json[0].call_type == '2') {
|
||||
// item.chatText = '[视频通话]'
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return list
|
||||
|
@ -297,8 +319,7 @@ function setRead(item) {
|
|||
<view class="datetime c999 f22">
|
||||
{{ util.formatTime('MM-dd HH:mm', item.createTime) }}</view>
|
||||
</view>
|
||||
<view class="desc thd mt10 c666 f24">{{
|
||||
item.callbackJson.callback_json[0].MsgContent.Text }}</view>
|
||||
<view class="desc thd mt10 c666 f24">{{ item.chatText }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-swipe-action-item>
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
<uni-section>
|
||||
<template v-slot:decoration>
|
||||
<!-- 商品图 -->
|
||||
<image class="shop-image" :src="orderInfo.productName" mode="aspectFill"></image>
|
||||
<image class="shop-image" :src="orderInfo.productImage" mode="aspectFill"></image>
|
||||
</template>
|
||||
<template v-slot:content>
|
||||
<!-- 订单 | 聊天-->
|
||||
<template v-if="showType == 1 || showType == 4">
|
||||
<view class="commodity-name commodity-name-1">
|
||||
<text class="commodity-name-title t2hd">耳钉耳钉耳钉耳钉耳钉耳钉耳钉耳钉耳钉耳钉耳钉</text>
|
||||
<text class="commodity-name-ks thd">X602 款式</text>
|
||||
<text v-if="showType == 4">待发货</text>
|
||||
<text class="commodity-name-title t2hd">{{ orderInfo.productName }}</text>
|
||||
<text class="commodity-name-ks thd">{{ orderInfo.status_text }}</text>
|
||||
<text v-if="showType == 4">{{ orderInfo.status }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 历史浏览 | 收藏 -->
|
||||
|
@ -54,10 +54,10 @@
|
|||
<view class="price-num">
|
||||
<view class="df aic price">
|
||||
<text class="f20 jg">¥</text>
|
||||
<text class="f28">999.00</text>
|
||||
<text class="f28">{{ orderInfo.productPrice }}</text>
|
||||
</view>
|
||||
<!-- 数量 -->
|
||||
<text class="c999 f24">x1</text>
|
||||
<text class="c999 f24">x{{ orderInfo.totalNum }}</text>
|
||||
</view>
|
||||
<!-- 发送到聊天 -->
|
||||
<view @click.stop="emit('consult', orderInfo)" class="go-buy" v-if="showType == 4">
|
||||
|
@ -106,6 +106,10 @@ const props = defineProps({
|
|||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.commodity-information {
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
$h : 164rpx;
|
||||
|
||||
.shop-image {
|
||||
|
|
|
@ -90,21 +90,11 @@ function handleBuy() {
|
|||
// 客服
|
||||
function toCustomer() {
|
||||
api.shop.getCustomerService({ merchantId: props.detail.merId }).then(rs => {
|
||||
console.log(rs);
|
||||
|
||||
//
|
||||
if (rs.code == 200) {
|
||||
|
||||
} else {
|
||||
util.alert(rs.msg)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
let param = {};
|
||||
param.type = 'C2C'
|
||||
param.name = `${props.detail.merName}`
|
||||
param.msgId = `${props.detail.merId}`
|
||||
param.msgId = `${rs.data.serviceId}`
|
||||
param.isCustomer = true
|
||||
|
||||
util.toChat(param)
|
||||
|
@ -113,7 +103,10 @@ function toCustomer() {
|
|||
uni.navigateTo({
|
||||
url: util.setUrl('/pages/news/chat/chat', param)
|
||||
})
|
||||
|
||||
} else {
|
||||
util.alert(rs.msg)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
@ -138,10 +131,10 @@ function toCustomer() {
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view class="option ver" @click="toCustomer">
|
||||
<!-- <view class="option ver" @click="toCustomer">
|
||||
<image class="wh30" src="/static/customer-service.png" mode="aspectFit" />
|
||||
<text class="text mt10">客服</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 下单 -->
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
// @ts-nocheck
|
||||
export {};
|
||||
|
||||
; declare module 'vue' {
|
||||
export interface GlobalComponents { }
|
||||
export interface GlobalDirectives { }
|
||||
}
|
||||
; declare global {
|
||||
const __VLS_intrinsicElements: __VLS_IntrinsicElements;
|
||||
const __VLS_directiveBindingRestFields: { instance: null, oldValue: null, modifiers: any, dir: any };
|
||||
const __VLS_unref: typeof import('vue').unref;
|
||||
const __VLS_placeholder: any;
|
||||
|
||||
const __VLS_nativeElements = {
|
||||
...{} as SVGElementTagNameMap,
|
||||
...{} as HTMLElementTagNameMap,
|
||||
};
|
||||
|
||||
type __VLS_IntrinsicElements = globalThis.JSX.IntrinsicElements;
|
||||
type __VLS_Element = globalThis.JSX.Element;
|
||||
type __VLS_GlobalComponents = import('vue').GlobalComponents & Pick<typeof import('vue'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>;
|
||||
type __VLS_GlobalDirectives = import('vue').GlobalDirectives;
|
||||
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
||||
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
||||
type __VLS_unknownDirective = (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
|
||||
type __VLS_WithComponent<N0 extends string, LocalComponents, Self, N1 extends string, N2 extends string, N3 extends string> =
|
||||
N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N1] } :
|
||||
N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N2] } :
|
||||
N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N3] } :
|
||||
Self extends object ? { [K in N0]: Self } :
|
||||
N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N1] } :
|
||||
N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N2] } :
|
||||
N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N3] } :
|
||||
{ [K in N0]: unknown };
|
||||
type __VLS_FunctionalComponentProps<T, K> =
|
||||
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
||||
: T extends (props: infer P, ...args: any) => any ? P :
|
||||
{};
|
||||
type __VLS_IsFunction<T, K> = K extends keyof T
|
||||
? __VLS_IsAny<T[K]> extends false
|
||||
? unknown extends T[K]
|
||||
? false
|
||||
: true
|
||||
: false
|
||||
: false;
|
||||
type __VLS_NormalizeComponentEvent<Props, Events, onEvent extends keyof Props, Event extends keyof Events, CamelizedEvent extends keyof Events> = (
|
||||
__VLS_IsFunction<Props, onEvent> extends true
|
||||
? Props
|
||||
: __VLS_IsFunction<Events, Event> extends true
|
||||
? { [K in onEvent]?: Events[Event] }
|
||||
: __VLS_IsFunction<Events, CamelizedEvent> extends true
|
||||
? { [K in onEvent]?: Events[CamelizedEvent] }
|
||||
: Props
|
||||
) & Record<string, unknown>;
|
||||
// fix https://github.com/vuejs/language-tools/issues/926
|
||||
type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
|
||||
type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R
|
||||
? U extends T
|
||||
? never
|
||||
: __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
|
||||
: never;
|
||||
type __VLS_OverloadUnion<T> = Exclude<
|
||||
__VLS_OverloadUnionInner<(() => never) & T>,
|
||||
T extends () => never ? never : () => never
|
||||
>;
|
||||
type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
|
||||
? F extends (event: infer E, ...args: infer A) => any
|
||||
? { [K in E & string]: (...args: A) => void; }
|
||||
: never
|
||||
: never;
|
||||
type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<
|
||||
__VLS_UnionToIntersection<
|
||||
__VLS_ConstructorOverloads<T> & {
|
||||
[K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
|
||||
}
|
||||
>
|
||||
>;
|
||||
type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
|
||||
type __VLS_PickFunctionalComponentCtx<T, K> = NonNullable<__VLS_PickNotAny<
|
||||
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? Ctx : never : any
|
||||
, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
|
||||
>>;
|
||||
type __VLS_OmitStringIndex<T> = {
|
||||
[K in keyof T as string extends K ? never : K]: T[K];
|
||||
};
|
||||
type __VLS_UseTemplateRef<T> = Readonly<import('vue').ShallowRef<T | null>>;
|
||||
|
||||
function __VLS_getVForSourceType(source: number): [number, number][];
|
||||
function __VLS_getVForSourceType(source: string): [string, number][];
|
||||
function __VLS_getVForSourceType<T extends any[]>(source: T): [
|
||||
item: T[number],
|
||||
index: number,
|
||||
][];
|
||||
function __VLS_getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
||||
item: T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never,
|
||||
index: number,
|
||||
][];
|
||||
// #3845
|
||||
function __VLS_getVForSourceType<T extends number | { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
||||
item: number | (Exclude<T, number> extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never),
|
||||
index: number,
|
||||
][];
|
||||
function __VLS_getVForSourceType<T>(source: T): [
|
||||
item: T[keyof T],
|
||||
key: keyof T,
|
||||
index: number,
|
||||
][];
|
||||
// @ts-ignore
|
||||
function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
|
||||
// @ts-ignore
|
||||
function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
|
||||
function __VLS_asFunctionalDirective<T>(dir: T): T extends import('vue').ObjectDirective
|
||||
? NonNullable<T['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']>
|
||||
: T extends (...args: any) => any
|
||||
? T
|
||||
: __VLS_unknownDirective;
|
||||
function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
|
||||
function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
|
||||
function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
|
||||
T extends new (...args: any) => any
|
||||
? (props: (K extends { $props: infer Props } ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & { __ctx?: {
|
||||
attrs?: any,
|
||||
slots?: K extends { $scopedSlots: infer Slots } ? Slots : any,
|
||||
emit?: K extends { $emit: infer Emit } ? Emit : any
|
||||
} & { props?: (K extends { $props: infer Props } ? Props : any) & Record<string, unknown>; expose?(exposed: K): void; } }
|
||||
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
||||
: T extends (...args: any) => any ? T
|
||||
: (_: {} & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: {} & Record<string, unknown> } };
|
||||
function __VLS_asFunctionalElement<T>(tag: T, endTag?: T): (_: T & Record<string, unknown>) => void;
|
||||
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
|
||||
function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
|
||||
function __VLS_tryAsConstant<const T>(t: T): T;
|
||||
}
|
|
@ -69,6 +69,12 @@
|
|||
return store.state.purse || {}
|
||||
})
|
||||
|
||||
// 榴莲果配置
|
||||
const configData = reactive({
|
||||
minConsumption: '',
|
||||
platformPercentage: ''
|
||||
})
|
||||
|
||||
onReady(() => {
|
||||
// proxy.$refs.dealRef.open()
|
||||
// proxy.$refs.payPwdRef.open()
|
||||
|
@ -77,6 +83,8 @@
|
|||
onLoad(() => {
|
||||
// 获取钱包
|
||||
util.getPurse()
|
||||
|
||||
getConfig()
|
||||
})
|
||||
|
||||
// 榴莲果交易
|
||||
|
@ -200,6 +208,22 @@
|
|||
url: path
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 榴莲果配置
|
||||
function getConfig() {
|
||||
api.durian.durianFruitConfig().then(rs => {
|
||||
if (rs.code == 200) {
|
||||
configData.minConsumption = rs.data.minConsumption
|
||||
configData.platformPercentage = +rs.data.platformPercentage * 100
|
||||
return;
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -255,7 +279,7 @@
|
|||
<image class="fruit wh150" src="/static/fruit.png" mode="aspectFit" />
|
||||
<view class="mt30 f20">
|
||||
<view class=" f1 b">可用: {{ purse.fruit }}</view>
|
||||
<view class="cFF4242 f1 mt10">待释放: 105.53</view>
|
||||
<view class="cFF4242 f1 mt10">待释放: {{ purse.fruitFrozen }}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
|
@ -296,8 +320,8 @@
|
|||
</view>
|
||||
|
||||
<view class="hint mtb30 tac f22">
|
||||
<view>销毁15%</view>
|
||||
<view>(最低x起转)</view>
|
||||
<view>销毁{{ configData.platformPercentage }}%</view>
|
||||
<view>(最低{{ configData.minConsumption }}起转)</view>
|
||||
</view>
|
||||
|
||||
<view class="button btn lg bar black" @click="handleSubmit">转移</view>
|
||||
|
|
|
@ -49,6 +49,13 @@
|
|||
// 朋友
|
||||
const friend = ref({})
|
||||
|
||||
onLoad((option) => {
|
||||
if (option.account) {
|
||||
keyword.value = option.account
|
||||
refreshFriendList()
|
||||
}
|
||||
})
|
||||
|
||||
onReady(() => {
|
||||
// proxy.$refs.friendRef.open()
|
||||
})
|
||||
|
|
|
@ -12,6 +12,8 @@ import {
|
|||
screenHeight
|
||||
} from '@/components/public/Mixins'
|
||||
import JyCommodityInformation from '@/components/public/jy-commodity-information'
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
import { inject } from 'vue'
|
||||
|
@ -75,6 +77,9 @@ const popupData = reactive({
|
|||
title: '选择订单'
|
||||
})
|
||||
|
||||
// 订单列表
|
||||
const list = reactive([])
|
||||
|
||||
// 加号方法对象
|
||||
const plusClickObj = {
|
||||
voice: () => {
|
||||
|
@ -109,14 +114,49 @@ const plusClickObj = {
|
|||
|
||||
// 选择订单
|
||||
chooseOrder: () => {
|
||||
let param = {
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
merId: props.msg.id,
|
||||
}
|
||||
api.shop.getShopOrderList(param).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
list.length = 0
|
||||
list.push(...rs.rows.map(item => {
|
||||
// 状态
|
||||
item.status = Number(item.status)
|
||||
// 编辑订单状态文字
|
||||
item.status_text = {
|
||||
'0': '待支付',
|
||||
'1': '待发货',
|
||||
'4': '待收货',
|
||||
'5': '已收货',
|
||||
'6': '已完成',
|
||||
'9': '已取消',
|
||||
}[item.status]
|
||||
return item
|
||||
}))
|
||||
|
||||
|
||||
nextTick().then(() => {
|
||||
popupRef.value.open()
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
// 选择商品
|
||||
chooseShop: () => {
|
||||
checkLink('pages/news/goodsList/index')
|
||||
uni.navigateTo({
|
||||
url: `/pages/news/goodsList/index?merId=${props.msg.id}`
|
||||
});
|
||||
},
|
||||
|
||||
// 发送红包
|
||||
|
@ -228,11 +268,11 @@ const consult = (content) => {
|
|||
</uni-easyinput>
|
||||
</view>
|
||||
<scroll-view scroll-y scroll-with-animation>
|
||||
<view v-for="(item, index) in 2">
|
||||
<view v-for="(item, index) in list" :key="index">
|
||||
<view class="time">
|
||||
下单时间:2024-07-28 22:45:25
|
||||
下单时间:{{ item.createTime }}
|
||||
</view>
|
||||
<JyCommodityInformation :showType="4" @consult="consult"></JyCommodityInformation>
|
||||
<JyCommodityInformation :showType="4" :orderInfo="item" @consult="consult"></JyCommodityInformation>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
|
|
@ -1,22 +1,122 @@
|
|||
<script setup>
|
||||
|
||||
/**
|
||||
* 客服聊天界面商品列表
|
||||
*/
|
||||
import {
|
||||
reactive,
|
||||
defineExpose,
|
||||
} from 'vue'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
|
||||
// 商品信息
|
||||
import JyCommodityInformation from '@/components/public/jy-commodity-information'
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
|
||||
|
||||
|
||||
// 参数
|
||||
const listPrototype = reactive({
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
total: 0,
|
||||
merId: '',
|
||||
data: [],
|
||||
})
|
||||
|
||||
|
||||
onLoad(option => {
|
||||
getList(option)
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 点击列表项
|
||||
* @param {Object} item 列表项
|
||||
*/
|
||||
function handleItem(item) {
|
||||
//
|
||||
uni.navigateTo({
|
||||
url: util.setUrl('/pages/shop/commodity/index', {
|
||||
productId: item.id
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 重载列表
|
||||
function refreshList() {
|
||||
listPrototype.pageNum = 1
|
||||
listPrototype.total = 0
|
||||
getList()
|
||||
}
|
||||
|
||||
// 加载更多列表
|
||||
function getMoreList() {
|
||||
console.log('getMoreList', listPrototype)
|
||||
if (listPrototype.total <= listPrototype.data.length) return
|
||||
listPrototype.pageNum++
|
||||
getList()
|
||||
}
|
||||
|
||||
// 获取商品
|
||||
function getList(option) {
|
||||
let param = {
|
||||
pageSize: listPrototype.pageSize,
|
||||
pageNum: listPrototype.pageNum,
|
||||
merId: option.merId
|
||||
}
|
||||
api.shop.getShopProductList(param).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
if (listPrototype.pageNum == 1) listPrototype.data.length = []
|
||||
listPrototype.data.push(...rs.rows)
|
||||
listPrototype.total = rs.total
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
}).finally(rs => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
}
|
||||
|
||||
// 发送商品给客服
|
||||
function sendProduct(item) {
|
||||
console.log('发送商品', item);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
getList,
|
||||
listPrototype,
|
||||
refreshList,
|
||||
getMoreList,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="appbw">
|
||||
<scroll-view scroll-y scroll-with-animation>
|
||||
<view v-for="(item, index) in 10">
|
||||
<JyCommodityInformation :showType="5"></JyCommodityInformation>
|
||||
<view class="list">
|
||||
<view class="product line df ptb20 plr20" v-for="(item, index) in listPrototype.data" :key="index"
|
||||
@click="handleItem(item)">
|
||||
|
||||
<view class="poster wh160">
|
||||
<image class="wh160 br10" :src="item.sliderImage.split(',')[0]" mode="aspectFill" />
|
||||
</view>
|
||||
|
||||
<view class="info df fdc jcsb f1 ml20">
|
||||
<view class="name t2hd c333 f28">{{ item.name }}</view>
|
||||
|
||||
<view class="other rows">
|
||||
<view class="col c333">
|
||||
<text class="f20">¥</text>
|
||||
<text class="f30">{{ item.price }}</text>
|
||||
<text class="count ml20 fs0 c999 f24">销量:{{ item.sales }}</text>
|
||||
</view>
|
||||
<view @click.stop="sendProduct(item)" class="btn ti warmHollow plr20">去咨询</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style scoped lang="scss"></style>
|
|
@ -13,6 +13,8 @@
|
|||
import {
|
||||
onLoad,
|
||||
} from '@dcloudio/uni-app'
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
// vuex
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
|
@ -37,21 +39,18 @@
|
|||
mask: true
|
||||
})
|
||||
|
||||
//
|
||||
const content = {
|
||||
key: 'user',
|
||||
userId: userinfo.value.userId,
|
||||
userNickname: userinfo.value.userNickname,
|
||||
}
|
||||
let url = `${util.config.host}/#/pages/news/addFriend?account=${userinfo.value.account}`
|
||||
console.log(url);
|
||||
|
||||
|
||||
uQRCode.make({
|
||||
canvasId: 'qrcode',
|
||||
text: JSON.stringify(content),
|
||||
text: url,
|
||||
size: qrcodeSize.value,
|
||||
margin: 10,
|
||||
success: res => {
|
||||
qrUrl.value = res
|
||||
console.log('qrcodeSrc ', qrUrl.value);
|
||||
// console.log('qrcodeSrc ', qrUrl.value);
|
||||
},
|
||||
complete: () => {
|
||||
uni.hideLoading()
|
||||
|
@ -80,5 +79,4 @@
|
|||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
//
|
||||
</style>
|
||||
// </style>
|
|
@ -5,6 +5,7 @@ import uni from '@dcloudio/vite-plugin-uni';
|
|||
|
||||
// let target = 'http://91f.xyz:8080'
|
||||
let target = 'https://b433d23.r24.cpolar.top/'
|
||||
// let target = 'http://hvw2rn.natappfree.cc'
|
||||
|
||||
|
||||
export default defineConfig({
|
||||
|
|
|
@ -8,20 +8,21 @@ export default {
|
|||
// 登录令牌
|
||||
const token = uni.getStorageSync('token')
|
||||
// 用户信息
|
||||
const userinfo = uni.getStorageSync('userinfo')
|
||||
const userinfo = JSON.parse(uni.getStorageSync('userinfo'))
|
||||
|
||||
// 如果登录保活
|
||||
if (token) {
|
||||
// 用户信息
|
||||
if (userinfo) store.commit('setState', {
|
||||
if (userinfo) {
|
||||
store.commit('setState', {
|
||||
key: 'userinfo',
|
||||
value: userinfo
|
||||
})
|
||||
|
||||
// // 腾讯im登录
|
||||
// util.getUserinfo().then(rs => {
|
||||
|
||||
// 登录腾讯IM
|
||||
// util.loginTencent(userinfo)
|
||||
// })
|
||||
}
|
||||
} else {
|
||||
// 如果未登录,跳转到登录页面
|
||||
uni.redirectTo({
|
||||
|
|
|
@ -35,7 +35,8 @@ const login = {
|
|||
userLoginOut(param) {
|
||||
return util.request({
|
||||
url: '/user/customerService/logout',
|
||||
data: param.data,
|
||||
method: 'POST',
|
||||
query: param,
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
const config = {
|
||||
// 接口域名
|
||||
// #ifdef H5
|
||||
host: 'http://localhost:5173',
|
||||
host: 'http://localhost:8888',
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// host: 'http://91f.xyz:8080',
|
||||
|
|
|
@ -1433,31 +1433,33 @@ const util = {
|
|||
// 登录腾讯聊天
|
||||
loginTencent(userinfo) {
|
||||
api.login.getIMToken({}).then(rs => {
|
||||
//
|
||||
console.log(rs);
|
||||
|
||||
const imSig = rs.msg
|
||||
|
||||
// #ifdef APP
|
||||
// 音视频登录
|
||||
const loginParams = {
|
||||
SDKAppID: util.config.TChat.SDKAppID,
|
||||
userID: userinfo.id + '',
|
||||
userSig: imSig,
|
||||
}
|
||||
uni.$TUICallKit.login(loginParams, res => {
|
||||
if (res.code === 0) {
|
||||
console.log('[TUICallKit] login success.');
|
||||
} else {
|
||||
console.error('[TUICallKit] login failed, failed message = ', res.msg, params);
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
||||
uni.$chat.login({
|
||||
userID: userinfo.id + '',
|
||||
userID: userinfo.serviceId + '',
|
||||
userSig: imSig,
|
||||
}).then(rs => {
|
||||
console.log('im login success', rs)
|
||||
})
|
||||
|
||||
// // #ifdef APP
|
||||
// // 音视频登录
|
||||
// const loginParams = {
|
||||
// SDKAppID: util.config.TChat.SDKAppID,
|
||||
// userID: userinfo.id + '',
|
||||
// userSig: imSig,
|
||||
// }
|
||||
// uni.$TUICallKit.login(loginParams, res => {
|
||||
// if (res.code === 0) {
|
||||
// console.log('[TUICallKit] login success.');
|
||||
// } else {
|
||||
// console.error('[TUICallKit] login failed, failed message = ', res.msg, params);
|
||||
// }
|
||||
// })
|
||||
// // #endif
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -1545,10 +1547,13 @@ const util = {
|
|||
*/
|
||||
logout(cb) {
|
||||
// 用户信息
|
||||
const userinfo = store.state.userinfo
|
||||
const userinfo = JSON.parse(uni.getStorageSync('userinfo'))
|
||||
|
||||
console.log(userinfo.serviceId);
|
||||
|
||||
|
||||
// 用户id
|
||||
if (userinfo.id) {
|
||||
if (userinfo.serviceId) {
|
||||
uni.$emit('logout') // 触发自定义事件监听
|
||||
|
||||
// tim登出
|
||||
|
@ -1558,7 +1563,7 @@ const util = {
|
|||
console.log('tim logout error:', rs);
|
||||
});
|
||||
|
||||
api.login.userLoginOut().then(rs => {
|
||||
api.login.userLoginOut({ serviceId: userinfo.serviceId }).then(rs => {
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login',
|
||||
|
|
|
@ -17,31 +17,28 @@ import {
|
|||
} from '@dcloudio/uni-app'
|
||||
// 路由
|
||||
import util from '@/common/js/util.js'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
|
||||
const chatList = reactive([{
|
||||
id: 1,
|
||||
avatar: 'https://p3-flow-imagex-sign.byteimg.com/user-avatar/9f4488a87a17f6f31b9716331e14fe26~tplv-a9rns2rl98-icon-tiny.jpeg?rk3s=98c978ad&x-expires=1740537084&x-signature=OrjX8tZaafN4XJE2o8QzZDs3Q20%3D',
|
||||
name: '客户 A',
|
||||
lastMessage: '您好,商品什么时候发货?',
|
||||
dot: 1,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
avatar: 'https://p3-flow-imagex-sign.byteimg.com/user-avatar/9f4488a87a17f6f31b9716331e14fe26~tplv-a9rns2rl98-icon-tiny.jpeg?rk3s=98c978ad&x-expires=1740537084&x-signature=OrjX8tZaafN4XJE2o8QzZDs3Q20%3D',
|
||||
name: '客户 B',
|
||||
lastMessage: '这个商品有优惠吗?',
|
||||
dot: '',
|
||||
}
|
||||
])
|
||||
|
||||
const chatList = reactive([])
|
||||
|
||||
// 用户信息
|
||||
const userinfo = JSON.parse(uni.getStorageSync('userinfo'))
|
||||
|
||||
|
||||
console.log(userinfo);
|
||||
|
||||
|
||||
// 右滑菜单
|
||||
const rightOption = [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#F85050'
|
||||
},
|
||||
fn: (item) => delMsg(item)
|
||||
}, {
|
||||
text: '设为已读',
|
||||
style: {
|
||||
backgroundColor: '#00ADEE'
|
||||
},
|
||||
fn: (item) => setRead(item)
|
||||
},]
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
@ -74,7 +71,27 @@ function getList() {
|
|||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
// list.data = handleList(rs.data);
|
||||
chatList.push(...rs.data.map(item => {
|
||||
item.callbackData = JSON.parse(item.callbackJson)
|
||||
|
||||
if (item.callbackData.callback_json.length) {
|
||||
let msgType = item.callbackData.callback_json[0].MsgType;
|
||||
if (msgType == TencentCloudChat.TYPES.MSG_TEXT) {
|
||||
item.chatText = item.callbackData.callback_json[0].MsgContent.Text
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_IMAGE) {
|
||||
item.chatText = '[图片]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_AUDIO) {
|
||||
item.chatText = '[语音]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_VIDEO) {
|
||||
item.chatText = '[视频]'
|
||||
} else if (msgType == TencentCloudChat.TYPES.MSG_CUSTOM) {
|
||||
if (item.callbackData.callback_json[0].businessType == 'redPacket') {
|
||||
item.chatText = `[红包] ${item.callbackData.blessing}`
|
||||
}
|
||||
}
|
||||
}
|
||||
return item
|
||||
}))
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
|
@ -84,26 +101,23 @@ function getList() {
|
|||
})
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 去聊天
|
||||
// * @param {Number} item 聊天对象
|
||||
// */
|
||||
// function handleChat(item) {
|
||||
// //
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 去聊天
|
||||
* @param {Number} item 聊天对象
|
||||
*/
|
||||
function handleChat(item) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转
|
||||
* @param {String} url 路由地址
|
||||
*/
|
||||
function link(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
})
|
||||
}
|
||||
// /**
|
||||
// * 跳转
|
||||
// * @param {String} url 路由地址
|
||||
// */
|
||||
// function link(url) {
|
||||
// uni.navigateTo({
|
||||
// url,
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
// 退出登录
|
||||
|
@ -120,6 +134,78 @@ function handleLogout() {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 去聊天
|
||||
* @param {Object} item
|
||||
*/
|
||||
function handleChat(item) {
|
||||
let param = {};
|
||||
// 单聊
|
||||
if (item.groupId == null) {
|
||||
param.type = 'C2C'
|
||||
param.name = `${item.callbackJson.from_name}`
|
||||
param.msgId = `${item.callbackJson.from_id}`
|
||||
} else {
|
||||
// 群聊
|
||||
param.type = 'GROUP'
|
||||
param.name = `${item.groupChatDTO.name}`
|
||||
param.msgId = `${item.groupId}`
|
||||
param.num = `${item.groupChatDTO.memberCount}`
|
||||
}
|
||||
//
|
||||
util.toChat(param)
|
||||
}
|
||||
/**
|
||||
* 菜单
|
||||
* @param {Object} ev 默认事件
|
||||
* @param {Object} item 单项
|
||||
*/
|
||||
function handleMenu(ev, item) {
|
||||
console.log('ev', ev, item)
|
||||
ev.content.fn(item)
|
||||
proxy.$refs.swipeAction.closeAll()
|
||||
}
|
||||
|
||||
// 删除会话
|
||||
function delMsg(item) {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
if (!isReady) {
|
||||
setTimeout(function () {
|
||||
delMsg(item);
|
||||
}, 200);
|
||||
return
|
||||
}
|
||||
|
||||
let conversationId = item.groupId == null ? `C2C${item.fromId}` : `GROUP${item.groupId}`;
|
||||
|
||||
uni.$chat.deleteConversation(conversationId).then(rs => {
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
// 标为已读
|
||||
function setRead(item) {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
if (!isReady) {
|
||||
setTimeout(function () {
|
||||
setRead(item);
|
||||
}, 200);
|
||||
return
|
||||
}
|
||||
|
||||
let conversationId = item.groupId == null ? `C2C${item.fromId}` : `GROUP${item.groupId}`;
|
||||
uni.$chat.setMessageRead({
|
||||
conversationID: conversationId,
|
||||
}).then(rs => {
|
||||
getList()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -148,7 +234,7 @@ function handleLogout() {
|
|||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<!-- <view class="list">
|
||||
<view class="item rows ptb20 plr20" v-for="(item, index) in chatList" :key="index"
|
||||
@click="handleChat(item)">
|
||||
<view class="avatar">
|
||||
|
@ -169,6 +255,47 @@ function handleLogout() {
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
|
||||
<view class="firendBox pr">
|
||||
<scroll-view scroll-y="true" class="scroll">
|
||||
<uni-swipe-action ref="swipeAction">
|
||||
<view class="list pb30">
|
||||
<uni-swipe-action-item :right-options="rightOption" v-for="(item, index) in chatList"
|
||||
:key="index" @click="handleMenu($event, item)">
|
||||
<view class="item rows ptb20 plr30" @click="handleChat(item)">
|
||||
<view class="image wh90 pr">
|
||||
<template v-if="item.groupId == null">
|
||||
<image class="cir wh90" :src="item.callbackJson.from_url" mode="aspectFill" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<image class="cir wh90" :src="item.groupChatDTO.groupFaceUrl"
|
||||
mode="aspectFill" />
|
||||
</template>
|
||||
<view class="mark pa t0 r0 cfff f22 cir" v-if="item.unreadCount">{{ item.unreadCount
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="col f1 ml20">
|
||||
<view class="rows">
|
||||
<template v-if="item.groupId == null">
|
||||
<view class="name f1 thd c333 f32">{{ item.callbackJson.from_name }}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="name f1 thd c333 f32">{{ item.groupChatDTO.name }}</view>
|
||||
</template>
|
||||
<view class="datetime c999 f22">
|
||||
{{ util.formatTime('MM-dd HH:mm', item.createTime) }}</view>
|
||||
</view>
|
||||
<view class="desc thd mt10 c666 f24">{{ item.chatText }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-swipe-action-item>
|
||||
<view class="mtb20 tac c999 f20">到底啦~</view>
|
||||
</view>
|
||||
</uni-swipe-action>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -194,25 +321,56 @@ function handleLogout() {
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 朋友列表
|
||||
.firendBox {
|
||||
height: 100%;
|
||||
|
||||
.scroll {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
// 列表
|
||||
.list {
|
||||
.item {
|
||||
border-top: 1rpx solid #eee;
|
||||
|
||||
// 消息提示点
|
||||
.mark,
|
||||
.dot {
|
||||
background-color: #FF6B17;
|
||||
text-align: center;
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.mark {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
|
||||
.dot {
|
||||
padding: 5rpx;
|
||||
border-radius: 100rpx;
|
||||
background-color: #f00;
|
||||
|
||||
// 内容
|
||||
.content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
// //
|
||||
// .list {
|
||||
// .item {
|
||||
// border-top: 1rpx solid #eee;
|
||||
|
||||
// .dot {
|
||||
// padding: 5rpx;
|
||||
// border-radius: 100rpx;
|
||||
// background-color: #f00;
|
||||
|
||||
// // 内容
|
||||
// .content {
|
||||
// display: flex;
|
||||
// justify-content: center;
|
||||
// align-items: center;
|
||||
// width: 20rpx;
|
||||
// height: 20rpx;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }</style>
|
|
@ -10,7 +10,7 @@ export default defineConfig({
|
|||
plugins: [uni()],
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
port: 5173,
|
||||
port: 8888,
|
||||
proxy: {
|
||||
"/system": {
|
||||
target,
|
||||
|
|
Loading…
Reference in New Issue