chat.vue 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674
  1. <template>
  2. <div class="broadcast-details" :style="'height:'+windowH+'px'">
  3. <view class="hd-wrapper" :class="active === true ? 'on' : ''">
  4. <view class="store-wrapper" v-if="storeInfo">
  5. <view class="left">
  6. <image :src="storeInfo.mer_avatar" mode=""></image>
  7. <view class="txt">{{storeInfo.mer_name}}</view>
  8. </view>
  9. <navigator v-if="hide_mer_status != 1" :url="'/pages/store/home/index?id='+storeInfo.mer_id" class="link" open-type="redirect">进店</navigator>
  10. </view>
  11. <div class="broadcast-details_order">
  12. <!-- 商品信息 -->
  13. <div class="broadcast-details_box" v-if="productId && productInfo.product_id">
  14. <div class="broadcast_details_img">
  15. <img v-if="!presellId" :src="productInfo.image" />
  16. <img v-else :src="productInfo.product.image" />
  17. </div>
  18. <div class="broadcast_details_picBox">
  19. <div class="broadcast_details_tit" v-text="productInfo.store_name"></div>
  20. <div class="acea-row row-between">
  21. <div class="broadcast_details_pic">
  22. ¥{{ productInfo.price
  23. }}<span class="broadcast_details_pic_num">¥{{ productInfo.ot_price }}</span>
  24. </div>
  25. <div class="broadcast_details_btn" @click="sendProduct">发送客服</div>
  26. </div>
  27. </div>
  28. </div>
  29. <!-- 订单信息 -->
  30. <div class="broadcast_box" v-if="orderId && orderInfo.order_id">
  31. <div class="broadcast-details_num broadcast_num">
  32. <span>订单号:{{ orderInfo.order_sn }}</span>
  33. <span>{{ orderInfo.pay_time }}</span>
  34. </div>
  35. <div class="broadcast-details_box">
  36. <div class="broadcast_details_img">
  37. <img :src="cartInfo.cart_info.product.image" />
  38. <div class="broadcast_details_model">
  39. {{ orderInfo.total_num }}件商品
  40. </div>
  41. </div>
  42. <div class="broadcast_details_picBox">
  43. <div class="broadcast_details_tit">
  44. {{ cartInfo.cart_info.product.store_name }}
  45. </div>
  46. <div class="acea-row row-between">
  47. <div class="broadcast_details_pic">
  48. ¥{{ cartInfo.cart_info.productAttr.price
  49. }}<span class="broadcast_details_pic_num">¥{{ cartInfo.cart_info.productAttr.cost }}</span>
  50. </div>
  51. <div class="broadcast_details_btn" @click="sendOrder">
  52. 发送客服
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <!-- 退款订单 -->
  59. <div class="broadcast_box" v-if="refund_order_id && refundDetail.refund_order_id">
  60. <div class="broadcast-details_num broadcast_num">
  61. <span>订单号:{{ refundDetail.refund_order_sn }}</span>
  62. <span>{{ refundDetail.status_time }}</span>
  63. </div>
  64. <div class="broadcast-details_box">
  65. <div class="broadcast_details_img">
  66. <img :src="refundDetail.refundProduct[0].product.cart_info.product.image" />
  67. <div class="broadcast_details_model">
  68. {{ refundDetail.refund_num }}件商品
  69. </div>
  70. </div>
  71. <div class="broadcast_details_picBox">
  72. <div class="broadcast_details_tit">
  73. {{ refundDetail.refundProduct[0].product.cart_info.product.store_name }}
  74. </div>
  75. <div class="acea-row row-between">
  76. <div class="broadcast_details_pic">
  77. ¥{{ refundDetail.refundProduct[0].product.cart_info.productAttr.price
  78. }}<span class="broadcast_details_pic_num">¥{{ refundDetail.refundProduct[0].product.cart_info.productAttr.ot_price}}</span>
  79. </div>
  80. <div class="broadcast_details_btn" @click="sendRefundOrder">
  81. 发送客服
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <scroll-view scroll-y="true" style="height: 100%; overflow: hidden;" :scroll-top="scrollTop" scroll-with-animation="true"
  89. @scrolltoupper="bindScroll">
  90. <div class="chat" ref="chat">
  91. <Loading :loaded="status" :loading="loading"></Loading>
  92. <!-- 客服聊天列表 -->
  93. <block v-for="(item,index) in history" v-if="userId != 0" :key="index">
  94. <!-- 左边 -->
  95. <div class="item acea-row row-top" v-if="item.send_type == 0">
  96. <div class="pictrue">
  97. <image :src="item.user.avatar" v-if="item.user.avatar"/>
  98. <image src="/static/images/f.png" mode="" v-else></image>
  99. </div>
  100. <div class="text">
  101. <div class="name">{{ item.user.nickname }}</div>
  102. <div class="acea-row">
  103. <!--退款订单链接-->
  104. <navigator v-if="item.msn_type === 6 && item.refundOrder && item.refundOrder.refund_order_id" open-type="redirect">
  105. <div class="broadcast-details_num">
  106. <span>退款单号:{{ item.refundOrder.refund_order_sn }}</span>
  107. </div>
  108. <div class="conter acea-row row-middle">
  109. <div class="broadcast-details_order noPad" v-for="(val, inx) in item.refundOrder.refundProduct" :key="item.service_log_id">
  110. <div class="broadcast-details_box noPad" v-if="inx == 0">
  111. <div class="broadcast_details_img">
  112. <img :src="val.product.cart_info.product.image" />
  113. <div class="broadcast_details_model">
  114. {{item.refundOrder.refund_num}}件商品
  115. </div>
  116. </div>
  117. <div class="broadcast_details_picBox noPad">
  118. <div class="broadcast_details_tit" v-text="val.product.cart_info.product.store_name"></div>
  119. <div class="broadcast_details_pic">
  120. ¥{{ val.product.cart_info.productAttr.price }}
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </navigator>
  127. <!--订单链接-->
  128. <navigator v-if="item.msn_type === 5 && item.orderInfo && item.orderInfo.order_id" :url="'/pages/admin/orderDetail/index?id='+item.orderInfo.order_id" open-type="redirect">
  129. <div class="broadcast-details_num">
  130. <span>订单号:{{ item.orderInfo.order_sn }}</span>
  131. </div>
  132. <div class="conter acea-row row-middle">
  133. <div class="broadcast-details_order noPad" v-for="(val, inx) in item.orderInfo.orderProduct" :key="val.id">
  134. <div class="broadcast-details_box noPad" v-if="inx == 0">
  135. <div class="broadcast_details_img">
  136. <img :src="val.cart_info.product.image" />
  137. <div class="broadcast_details_model">
  138. {{item.orderInfo.total_num}}件商品
  139. </div>
  140. </div>
  141. <div class="broadcast_details_picBox noPad">
  142. <div class="broadcast_details_tit" v-text="val.cart_info.product.store_name"></div>
  143. <div class="broadcast_details_pic">
  144. ¥{{ val.cart_info.productAttr.price }}
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </navigator>
  151. <!--商品链接-->
  152. <div class="conter acea-row row-middle" v-if="item.msn_type === 4 && item.product">
  153. <div class=" noPad">
  154. <navigator class="acea-row row-column-around noPad" v-if="item.product.product_id" :url="`/pages/goods_details/index?id=${item.product.product_id}`" open-type="redirect">
  155. <div class="broadcast_details_img_no">
  156. <img :src="item.product.image" />
  157. </div>
  158. <div class="broadcast_details_picBox_no noPad">
  159. <div class="broadcast_details_pic">
  160. ¥{{ item.product.price }}
  161. </div>
  162. <div class="broadcast_details_tit_no" v-text="item.product.store_name"></div>
  163. </div>
  164. </navigator>
  165. </div>
  166. </div>
  167. <!--预售商品链接-->
  168. <div class="conter acea-row row-middle" v-if="item.msn_type === 7 && item.presell && item.presell.product">
  169. <div class=" noPad">
  170. <navigator class="acea-row row-column-around noPad" v-if="item.presell.product_presell_id" :url="`/pages/activity/presell_details/index?id=${item.presell.product_presell_id}`" open-type="redirect">
  171. <div class="broadcast_details_img_no">
  172. <img :src="item.presell.product.image" />
  173. </div>
  174. <div class="broadcast_details_picBox_no noPad">
  175. <div class="broadcast_details_pic">
  176. ¥{{ item.presell.price }}
  177. </div>
  178. <div class="broadcast_details_tit_no" v-text="item.presell.store_name"></div>
  179. </div>
  180. </navigator>
  181. </div>
  182. </div>
  183. <!--拼团商品链接-->
  184. <div class="conter acea-row row-middle" v-if="item.msn_type === 8 && item.productGroup && item.productGroup.product">
  185. <div class=" noPad">
  186. <navigator class="acea-row row-column-around noPad" v-if="item.productGroup.product_group_id" :url="`/pages/activity/combination_details/index?id=${item.productGroup.product_group_id}`" open-type="redirect">
  187. <div class="broadcast_details_img_no">
  188. <img :src="item.productGroup.product.image" />
  189. </div>
  190. <div class="broadcast_details_picBox_no noPad">
  191. <div class="broadcast_details_pic">
  192. ¥{{ item.productGroup.product.price }}
  193. </div>
  194. <div class="broadcast_details_tit_no" v-text="item.productGroup.product.store_name"></div>
  195. </div>
  196. </navigator>
  197. </div>
  198. </div>
  199. <!-- <div class="conter acea-row row-middle" v-if="item.msn_type === 3">
  200. <img src="/static/images/signal2.gif" class="signal" style="margin-right: 0.27rem;" />
  201. </div> -->
  202. <div class="conter acea-row row-middle" v-if="item.msn_type === 3">
  203. <image :src="item.msn" mode="heightFix" />
  204. </div>
  205. <div class="conter acea-row row-middle" v-if="item.msn_type === 2">
  206. <i class="em" :class="item.msn"></i>
  207. </div>
  208. <div class="conter acea-row row-middle" v-if="item.msn_type === 1">
  209. {{ item.msn }}
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. <!-- 右边 -->
  215. <div class="item acea-row row-top row-right" v-else>
  216. <div class="text textR">
  217. <div class="name">{{ item.service.nickname }}</div>
  218. <div class="acea-row ">
  219. <!--退款订单链接-->
  220. <navigator v-if="item.msn_type === 6 && item.refundOrder.refund_order_id" open-type="redirect">
  221. <div class="broadcast-details_num">
  222. <span>订单号:{{ item.refundOrder.refund_order_sn }}</span>
  223. </div>
  224. <div class="conter acea-row row-middle">
  225. <div class="broadcast-details_order noPad" v-for="(val, inx) in item.refundOrder.refundProduct" :key="val.id">
  226. <div class="broadcast-details_box noPad" v-if="inx == 0">
  227. <div class="broadcast_details_img">
  228. <img :src="val.product.cart_info.product.image" />
  229. <div class="broadcast_details_model">
  230. {{item.refundOrder.refund_num}}件商品
  231. </div>
  232. </div>
  233. <div class="broadcast_details_picBox noPad">
  234. <div class="broadcast_details_tit" v-text="val.product.cart_info.product.store_name"></div>
  235. <div class="broadcast_details_pic">
  236. ¥{{ val.product.cart_info.productAttr.price }}
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. </navigator>
  243. <!--订单链接-->
  244. <navigator v-if="item.msn_type === 5 && item.orderInfo.order_id" :url="'/pages/admin/orderDetail/index?id='+item.orderInfo.order_id" open-type="redirect">
  245. <div class="broadcast-details_num">
  246. <span>订单号:{{ item.orderInfo.order_sn }}</span>
  247. </div>
  248. <div class="conter acea-row row-middle">
  249. <div class="broadcast-details_order noPad" v-for="(val, inx) in item.orderInfo.orderProduct" :key="val.id">
  250. <div class="broadcast-details_box noPad" v-if="inx == 0">
  251. <div class="broadcast_details_img">
  252. <img :src="val.cart_info.product.image" />
  253. <div class="broadcast_details_model">
  254. {{item.orderInfo.total_num}}件商品
  255. </div>
  256. </div>
  257. <div class="broadcast_details_picBox noPad">
  258. <div class="broadcast_details_tit" v-text="val.cart_info.product.store_name"></div>
  259. <div class="broadcast_details_pic">
  260. ¥{{ val.cart_info.productAttr.price }}
  261. </div>
  262. </div>
  263. </div>
  264. </div>
  265. </div>
  266. </navigator>
  267. <!--商品链接-->
  268. <div class="conter acea-row row-middle" v-if="item.msn_type === 4 && item.product">
  269. <div class=" acea-row row-column-around noPad">
  270. <navigator class="" v-if="item.product.product_id" :url="`/pages/goods_details/index?id=${item.product.product_id}`" open-type="redirect">
  271. <div class="broadcast_details_img_no">
  272. <img :src="item.product.image" />
  273. </div>
  274. <div class="broadcast_details_picBox_no noPad">
  275. <div class="broadcast_details_pic">
  276. ¥{{ item.product.price }}
  277. </div>
  278. <div class="broadcast_details_tit_no" v-text="item.product.store_name"></div>
  279. </div>
  280. </navigator>
  281. </div>
  282. </div>
  283. <!--预售商品链接-->
  284. <div class="conter acea-row row-middle" v-if="item.msn_type === 7 && item.presell && item.presell.product">
  285. <div class=" acea-row row-column-around noPad">
  286. <navigator class="" v-if="item.presell.product_presell_id" :url="`/pages/activity/presell_details/index?id=${item.presell.product_presell_id}`" open-type="redirect">
  287. <div class="broadcast_details_img_no">
  288. <img :src="item.presell.product.image" />
  289. </div>
  290. <div class="broadcast_details_picBox_no noPad">
  291. <div class="broadcast_details_pic">
  292. ¥{{ item.presell.price }}
  293. </div>
  294. <div class="broadcast_details_tit_no" v-text="item.presell.store_name"></div>
  295. </div>
  296. </navigator>
  297. </div>
  298. </div>
  299. <!--拼团商品链接-->
  300. <div class="conter acea-row row-middle" v-if="item.msn_type === 8 && item.productGroup && item.productGroup.product">
  301. <div class=" acea-row row-column-around noPad">
  302. <navigator class="" v-if="item.productGroup.product_group_id" :url="`/pages/activity/combination_details/index?id=${item.productGroup.product_group_id}`" open-type="redirect">
  303. <div class="broadcast_details_img_no">
  304. <img :src="item.productGroup.product.image" />
  305. </div>
  306. <div class="broadcast_details_picBox_no noPad">
  307. <div class="broadcast_details_pic">
  308. ¥{{ item.productGroup.product.price }}
  309. </div>
  310. <div class="broadcast_details_tit_no" v-text="item.productGroup.product.store_name"></div>
  311. </div>
  312. </navigator>
  313. </div>
  314. </div>
  315. <div class="conter acea-row row-middle" v-if="item.msn_type === 3">
  316. <image :src="item.msn" mode="heightFix" />
  317. </div>
  318. <div class="conter acea-row row-middle" v-if="item.msn_type === 2">
  319. <i class="em" :class="item.msn"></i>
  320. </div>
  321. <div class="conter acea-row row-middle" v-if="item.msn_type === 1">
  322. {{ item.msn }}
  323. </div>
  324. </div>
  325. </div>
  326. <div class="pictrue">
  327. <image :src="item.service.avatar" v-if="item.service.avatar" />
  328. <image src="/static/images/f.png" mode="" v-else></image>
  329. </div>
  330. </div>
  331. </block>
  332. <!-- 客户聊天列表 -->
  333. <block v-for="(item,j) in history" v-if="userId == 0" :key="j">
  334. <!-- 左边 -->
  335. <div class="item acea-row row-top" v-if="item.send_type == 1">
  336. <div class="pictrue">
  337. <image :src="item.service.avatar" v-if="item.service.avatar" />
  338. <image src="/static/images/f.png" mode="" v-else></image>
  339. </div>
  340. <div class="text">
  341. <div class="name">{{ item.service.nickname }}</div>
  342. <div class="acea-row">
  343. <!--退款订单链接-->
  344. <navigator v-if="item.msn_type === 6 && item.refundOrder.refund_order_id" open-type="redirect">
  345. <div class="broadcast-details_num">
  346. <span>退款单号:{{ item.refundOrder.refund_order_sn }}</span>
  347. </div>
  348. <div class="conter acea-row row-middle">
  349. <!-- :key="item.service_log_id" -->
  350. <div class="broadcast-details_order noPad" v-for="(val, inx) in item.refundOrder.refundProduct">
  351. <div class="broadcast-details_box noPad" v-if="inx == 0">
  352. <div class="broadcast_details_img">
  353. <img :src="val.product.cart_info.product.image" />
  354. <div class="broadcast_details_model">
  355. {{item.refundOrder.refund_num}}件商品
  356. </div>
  357. </div>
  358. <div class="broadcast_details_picBox noPad">
  359. <div class="broadcast_details_tit" v-text="val.product.cart_info.product.store_name"></div>
  360. <div class="broadcast_details_pic">
  361. ¥{{ val.product.cart_info.productAttr.price }}
  362. </div>
  363. </div>
  364. </div>
  365. </div>
  366. </div>
  367. </navigator>
  368. <!--订单链接-->
  369. <navigator v-if="item.msn_type === 5 && item.orderInfo.order_id" :url="'/pages/order_details/index?order_id='+item.orderInfo.order_id" open-type="redirect">
  370. <div class="broadcast-details_num">
  371. <span>订单号:{{ item.orderInfo.order_sn }}</span>
  372. </div>
  373. <div class="conter acea-row row-middle">
  374. <!-- :key="item.service_log_id" -->
  375. <div class="broadcast-details_order noPad" v-for="(val, inx) in item.orderInfo.orderProduct">
  376. <div class="broadcast-details_box noPad" v-if="inx == 0">
  377. <div class="broadcast_details_img">
  378. <img :src="val.cart_info.product.image" />
  379. <div class="broadcast_details_model">
  380. {{item.orderInfo.total_num}}件商品
  381. </div>
  382. </div>
  383. <div class="broadcast_details_picBox noPad">
  384. <div class="broadcast_details_tit" v-text="val.cart_info.product.store_name"></div>
  385. <div class="broadcast_details_pic">
  386. ¥{{ val.cart_info.productAttr.price }}
  387. </div>
  388. </div>
  389. </div>
  390. </div>
  391. </div>
  392. </navigator>
  393. <!--商品链接-->
  394. <div class="conter acea-row row-middle" v-if="item.msn_type === 4 && item.product">
  395. <div class=" noPad">
  396. <navigator class="acea-row row-column-around noPad" v-if="item.product.product_id" :url="`/pages/goods_details/index?id=${item.product.product_id}`" open-type="redirect">
  397. <div class="broadcast_details_img_no">
  398. <img :src="item.product.image" />
  399. </div>
  400. <div class="broadcast_details_picBox_no noPad">
  401. <div class="broadcast_details_pic">
  402. ¥{{ item.product.price }}
  403. </div>
  404. <div class="broadcast_details_tit_no" v-text="item.product.store_name"></div>
  405. </div>
  406. </navigator>
  407. </div>
  408. </div>
  409. <!--预售商品链接-->
  410. <div class="conter acea-row row-middle" v-if="item.msn_type === 7 && item.presell && item.presell.product">
  411. <div class=" noPad">
  412. <navigator class="acea-row row-column-around noPad" v-if="item.presell.product_presell_id" :url="`/pages/activity/presell_details/index?id=${item.presell.product_presell_id}`" open-type="redirect">
  413. <div class="broadcast_details_img_no">
  414. <img :src="item.presell.product.image" />
  415. </div>
  416. <div class="broadcast_details_picBox_no noPad">
  417. <div class="broadcast_details_pic">
  418. ¥{{ item.presell.price }}
  419. </div>
  420. <div class="broadcast_details_tit_no" v-text="item.presell.store_name"></div>
  421. </div>
  422. </navigator>
  423. </div>
  424. </div>
  425. <!--拼团商品链接-->
  426. <div class="conter acea-row row-middle" v-if="item.msn_type === 8 && item.productGroup && item.productGroup.product">
  427. <div class="noPad">
  428. <navigator class="acea-row row-column-around noPad" v-if="item.productGroup.product_group_id" :url="`/pages/activity/combination_details/index?id=${item.productGroup.product_group_id}`" open-type="redirect">
  429. <div class="broadcast_details_img_no">
  430. <img :src="item.productGroup.product.image" />
  431. </div>
  432. <div class="broadcast_details_picBox_no noPad">
  433. <div class="broadcast_details_pic">
  434. ¥{{ item.productGroup.product.price }}
  435. </div>
  436. <div class="broadcast_details_tit_no" v-text="item.productGroup.product.store_name"></div>
  437. </div>
  438. </navigator>
  439. </div>
  440. </div>
  441. <div class="conter acea-row row-middle" v-if="item.msn_type === 3">
  442. <image :src="item.msn" mode="heightFix" />
  443. </div>
  444. <div class="conter acea-row row-middle" v-if="item.msn_type === 2">
  445. <i class="em" :class="item.msn"></i>
  446. </div>
  447. <div class="conter acea-row row-middle" v-if="item.msn_type === 1">
  448. {{ item.msn }}
  449. </div>
  450. </div>
  451. </div>
  452. </div>
  453. <!-- 右边 -->
  454. <div class="item acea-row row-top row-right" v-else>
  455. <div class="text textR">
  456. <div class="name">{{ item.user.nickname }}</div>
  457. <div class="acea-row ">
  458. <!--退款订单链接-->
  459. <navigator v-if="item.msn_type === 6 && item.refundOrder.refund_order_id" open-type="redirect">
  460. <div class="broadcast-details_num">
  461. <span>退款单号:{{ item.refundOrder.refund_order_sn }}</span>
  462. </div>
  463. <div class="conter acea-row row-middle">
  464. <!-- :key="item.service_log_id" -->
  465. <div class="broadcast-details_order noPad" v-for="(val, inx) in item.refundOrder.refundProduct">
  466. <div class="broadcast-details_box noPad" v-if="inx == 0">
  467. <div class="broadcast_details_img">
  468. <img :src="val.product.cart_info.product.image" />
  469. <div class="broadcast_details_model">
  470. {{item.refundOrder.refund_num}}件商品
  471. </div>
  472. </div>
  473. <div class="broadcast_details_picBox noPad">
  474. <div class="broadcast_details_tit" v-text="val.product.cart_info.product.store_name"></div>
  475. <div class="broadcast_details_pic">
  476. ¥{{ val.product.cart_info.productAttr.price }}
  477. </div>
  478. </div>
  479. </div>
  480. </div>
  481. </div>
  482. </navigator>
  483. <!--订单链接-->
  484. <navigator v-if="item.msn_type === 5 && item.orderInfo.order_id" :url="'/pages/order_details/index?order_id='+item.orderInfo.order_id" open-type="redirect">
  485. <div class="broadcast-details_num">
  486. <span>订单号:{{ item.orderInfo.order_sn }}</span>
  487. </div>
  488. <div class="conter acea-row row-middle">
  489. <!-- :key="item.service_log_id" -->
  490. <div class="broadcast-details_order noPad" v-for="(val, inx) in item.orderInfo.orderProduct">
  491. <div class="broadcast-details_box noPad" v-if="inx == 0">
  492. <div class="broadcast_details_img">
  493. <img :src="val.cart_info.product.image" />
  494. <div class="broadcast_details_model">
  495. {{item.orderInfo.total_num}}件商品
  496. </div>
  497. </div>
  498. <div class="broadcast_details_picBox noPad">
  499. <div class="broadcast_details_tit" v-text="val.cart_info.product.store_name"></div>
  500. <div class="broadcast_details_pic">
  501. ¥{{ val.cart_info.productAttr.price }}
  502. </div>
  503. </div>
  504. </div>
  505. </div>
  506. </div>
  507. </navigator>
  508. <!--商品链接-->
  509. <div class="conter acea-row row-middle" v-if="item.msn_type === 4 && item.product">
  510. <div class=" acea-row row-column-around noPad">
  511. <navigator class="" v-if="item.product.product_id" :url="`/pages/goods_details/index?id=${item.product.product_id}`" open-type="redirect">
  512. <div class="broadcast_details_img_no">
  513. <img :src="item.product.image" />
  514. </div>
  515. <div class="broadcast_details_picBox_no noPad">
  516. <div class="broadcast_details_pic">
  517. ¥{{ item.product.price }}
  518. </div>
  519. <div class="broadcast_details_tit_no" v-text="item.product.store_name"></div>
  520. </div>
  521. </navigator>
  522. </div>
  523. </div>
  524. <!--预售商品链接-->
  525. <div class="conter acea-row row-middle" v-if="item.msn_type === 7 && item.presell && item.presell.product">
  526. <div class=" acea-row row-column-around noPad">
  527. <navigator class="" v-if="item.presell.product_presell_id" :url="`/pages/activity/presell_details/index?id=${item.presell.product_presell_id}`" open-type="redirect">
  528. <div class="broadcast_details_img_no">
  529. <img :src="item.presell.product.image" />
  530. </div>
  531. <div class="broadcast_details_picBox_no noPad">
  532. <div class="broadcast_details_pic">
  533. ¥{{ item.presell.price }}
  534. </div>
  535. <div class="broadcast_details_tit_no" v-text="item.presell.store_name"></div>
  536. </div>
  537. </navigator>
  538. </div>
  539. </div>
  540. <!--拼团商品链接-->
  541. <div class="conter acea-row row-middle" v-if="item.msn_type === 8 && item.productGroup && item.productGroup.product">
  542. <div class=" acea-row row-column-around noPad">
  543. <navigator class="" v-if="item.productGroup.product_group_id" :url="`/pages/activity/combination_details/index?id=${item.productGroup.product_group_id}`" open-type="redirect">
  544. <div class="broadcast_details_img_no">
  545. <img :src="item.productGroup.product.image" />
  546. </div>
  547. <div class="broadcast_details_picBox_no noPad">
  548. <div class="broadcast_details_pic">
  549. ¥{{ item.productGroup.product.price }}
  550. </div>
  551. <div class="broadcast_details_tit_no" v-text="item.productGroup.product.store_name"></div>
  552. </div>
  553. </navigator>
  554. </div>
  555. </div>
  556. <div class="conter acea-row row-middle" v-if="item.msn_type === 3">
  557. <image :src="item.msn" mode="heightFix" />
  558. </div>
  559. <div class="conter acea-row row-middle" v-if="item.msn_type === 2">
  560. <i class="em" :class="item.msn"></i>
  561. </div>
  562. <div class="conter acea-row row-middle" v-if="item.msn_type === 1">
  563. {{ item.msn }}
  564. </div>
  565. </div>
  566. </div>
  567. <div class="pictrue">
  568. <image :src="item.user.avatar" v-if="item.user.avatar"/>
  569. <image src="/static/images/f.png" mode="" v-else></image>
  570. </div>
  571. </div>
  572. </block>
  573. </div>
  574. <div :style=" active === true
  575. ? 'height:' + footerConH + 'rem;'
  576. : 'height:' + footerH + 'rem;'
  577. "></div>
  578. </scroll-view>
  579. </view>
  580. <div class="footerCon" :class="active === true ? 'on' : ''" :style="'transform: translate3d(0,' + percent + '%,0);'"
  581. ref="footerCon">
  582. <form>
  583. <div class="footer acea-row row-between row-bottom" ref="footer">
  584. <!--<img-->
  585. <!--:src="-->
  586. <!--voice === true-->
  587. <!--? require('@assets/images/keyboard.png')-->
  588. <!--: require('@assets/images/voice.png')-->
  589. <!--"-->
  590. <!--@click="voiceBnt"-->
  591. <!--/>-->
  592. <img @click="uploadImg" src="/static/images/plus.png" />
  593. <img :src="
  594. active === true
  595. ? '/static/images/keyboard.png'
  596. : '/static/images/face.png'
  597. "
  598. @click="emoticon" />
  599. <div class="voice acea-row row-center-wrapper" v-if="voice" @touchstart.prevent="start" @touchmove.prevent="move"
  600. @touchend.prevent="end">
  601. {{ speak }}
  602. </div>
  603. <!-- <p contenteditable="true" class="input" ref="input" v-show="!voice" @keydown="keydown($event)" @keyup="keyup" @focus="focus"></p> -->
  604. <input type="text" placeholder="请输入内容" class="input" ref="input" v-show="!voice" @input="bindInput" @keyup="keyup"
  605. @focus="focus" cursor-spacing="20" v-model="textCon">
  606. <div class="send" :class="sendColor === true ? 'font-color-red' : ''" @click="sendTest">
  607. 发送
  608. </div>
  609. </div>
  610. </form>
  611. <div class="banner slider-banner">
  612. <swiper class="swiper-wrapper" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration"
  613. v-if="emojiGroup.length > 0">
  614. <block v-for="(emojiList, index) in emojiGroup" :key="index">
  615. <swiper-item>
  616. <i class="em" :class="emoji" v-for="emoji in emojiList" :key="emoji" @click="addEmoji(emoji)"></i>
  617. <img src="/static/images/del.png" class="emoji-outer" />
  618. </swiper-item>
  619. </block>
  620. </swiper>
  621. </div>
  622. </div>
  623. <div class="recording" v-if="recording">
  624. <img src="/static/images/recording.png" />
  625. </div>
  626. </div>
  627. </template>
  628. <script>
  629. import emojiList from "@/utils/emoji";
  630. import Socket from "@/libs/chat";
  631. import {
  632. getChatRecord,
  633. getMerHistory
  634. } from "@/api/user";
  635. import {
  636. getProductDetail,
  637. getPresellProductDetail,
  638. getStoreDetail
  639. } from "@/api/store";
  640. import {
  641. getCombinationDetail
  642. } from "@/api/activity";
  643. import {
  644. getOrderDetail,
  645. refundDetail
  646. } from "@/api/order";
  647. // import VueCoreImageUpload from "vue-core-image-upload";
  648. import easyUpload from '@/components/easy-upload/easy-upload.vue'
  649. import Loading from "@/components/Loading";
  650. import {
  651. TOKENNAME,
  652. HTTP_REQUEST_URL
  653. } from '@/config/app.js';
  654. const chunk = function(arr, num) {
  655. num = num * 1 || 1;
  656. var ret = [];
  657. arr.forEach(function(item, i) {
  658. if (i % num === 0) {
  659. ret.push([]);
  660. }
  661. ret[ret.length - 1].push(item);
  662. });
  663. return ret;
  664. };
  665. const NAME = "CustomerService";
  666. const PATH = 'pages/chat/customer_list/chat'
  667. const app = getApp();
  668. export default {
  669. name: NAME,
  670. components: {
  671. // swiper,
  672. // swiperSlide,
  673. Loading,
  674. easyUpload
  675. },
  676. props: {
  677. couponList: {
  678. type: Array,
  679. default: () => []
  680. }
  681. },
  682. data: function() {
  683. return {
  684. url: `${HTTP_REQUEST_URL}/api/upload/image`,
  685. headers: {
  686. "Authori-zation": "Bearer " + this.$store.state.app.token
  687. },
  688. emojiGroup: chunk(emojiList, 20),
  689. active: false,
  690. voice: false,
  691. speak: "按住 说话",
  692. recording: false,
  693. swiperOption: {
  694. pagination: {
  695. el: ".swiper-pagination",
  696. clickable: true
  697. },
  698. speed: 1000,
  699. observer: true,
  700. observeParents: true
  701. },
  702. percent: 0,
  703. footerConH: 0,
  704. footerH: 1.08,
  705. socket: null,
  706. toUid: 0,
  707. page: 1,
  708. limit: 30,
  709. loading: false,
  710. loaded: false,
  711. history: [],
  712. sendColor: false,
  713. sendtxt: "",
  714. productId: 0,
  715. presellId: 0,
  716. combinationId: 0,
  717. productInfo: {},
  718. orderId: "",
  719. orderInfo: {},
  720. cartInfo: {},
  721. autoplay: false,
  722. circular: true,
  723. interval: 3000,
  724. duration: 500,
  725. upload_max: 2, //图片大小
  726. //上传的图片地址
  727. uploadImages: [],
  728. //展示的图片地址
  729. uploads: [],
  730. // 超出限制数组
  731. exceeded_list: [],
  732. windowH: 0,
  733. isBQ: false,
  734. scrollTop: 0, //滚动距离
  735. textCon: '', //文字
  736. mer_id: 0, //商铺id
  737. refund_order_id: 0, //退款订单id
  738. refundDetail: '', //退款订单详情
  739. userId: 0, //客服----用户id
  740. pageType: 0, //页面区分
  741. status: false, //砍价列表是否获取完成 false 未完成 true 完成
  742. storeInfo: '',
  743. isBack: false,
  744. hide_mer_status: app.globalData.hide_mer_status
  745. };
  746. },
  747. watch: {
  748. // // #ifdef H5
  749. // $route(n) {
  750. // console.log(n)
  751. // if (n.path == PATH) {
  752. // if (n.query) {
  753. // this.orderId = n.query.order_id;
  754. // this.toUid = n.query.uid || 0;
  755. // this.productId = parseInt(n.query.productId) || 0;
  756. // this.orderId = n.query.order_id || ""
  757. // this.mer_id = n.query.mer_id || 0
  758. // this.refund_order_id = n.query.refund_order_id || 0
  759. // this.userId = n.query.userId || 0
  760. // }
  761. // this.wsStart();
  762. // } else {
  763. // if (this.userId == 0) {
  764. // this.socket.send({
  765. // data: {
  766. // mer_id: this.mer_id
  767. // },
  768. // type: "chat_end"
  769. // });
  770. // } else {
  771. // this.socket.send({
  772. // data: {
  773. // uid: this.userId
  774. // },
  775. // type: "service_chat_end"
  776. // });
  777. // }
  778. // this.socket && this.socket.onClose();
  779. // }
  780. // }
  781. // // #endif
  782. },
  783. beforeDestroy() {
  784. console.log('beforeDestroy')
  785. this.wsEnd();
  786. },
  787. onUnload() {
  788. console.log('onUnload')
  789. this.wsEnd();
  790. },
  791. // onHide() {
  792. // console.log('onHide')
  793. // this.wsEnd();
  794. // },
  795. onLoad(option) {
  796. let self = this
  797. this.toUid = option.uid || 0;
  798. this.productId = parseInt(option.productId) || 0;
  799. this.presellId = parseInt(option.presellId) || 0;
  800. this.combinationId = parseInt(option.combinationId) || 0;
  801. this.orderId = option.order_id || ""
  802. this.mer_id = option.mer_id || 0
  803. this.refund_order_id = option.refund_order_id || 0
  804. this.userId = option.userId || 0
  805. uni.getSystemInfo({
  806. success: function(res) {
  807. self.windowH = res.windowHeight
  808. }
  809. })
  810. },
  811. onReady() {
  812. uni.$on('update',(data)=>{
  813. this.hide_mer_status = data.hide_mer_status
  814. })
  815. },
  816. mounted: function() {
  817. this.height();
  818. if (this.userId == 0) {
  819. // 用户
  820. this.getHistory();
  821. this.getproductInfo();
  822. this.getOrderInfo();
  823. this.getRefundDetail();
  824. this.getStoreDetail();
  825. } else {
  826. // 客服
  827. this.getMerHistory();
  828. }
  829. uni.$on("socket_open", () => {
  830. if (this.userId == 0) {
  831. this.socket.send({
  832. data: {
  833. mer_id: this.mer_id
  834. },
  835. type: "chat_start"
  836. });
  837. } else {
  838. this.socket.send({
  839. data: {
  840. uid: this.userId
  841. },
  842. type: "service_chat_start"
  843. });
  844. }
  845. });
  846. uni.$on(["reply", "chat", "send_chat"], data => {
  847. this.history.push(data);
  848. this.height();
  849. });
  850. uni.$on("socket_error", () => {
  851. if (!this.isBack) {
  852. let self = this
  853. uni.showModal({
  854. title: '提示',
  855. content: '连接失败,是否重新连接',
  856. success: function(res) {
  857. if (res.confirm) {
  858. self.wsStart()
  859. } else if (res.cancel) {
  860. uni.navigateBack();
  861. }
  862. }
  863. });
  864. }
  865. });
  866. uni.$on("err_tip", data => {
  867. let pages = getCurrentPages();
  868. let curPage = pages[pages.length - 1]; // 当前页面路径
  869. let beforePage = pages[pages.length - 2]; // 前一个页面路径
  870. console.log(pages,'pages')
  871. console.log(curPage.route,'curPage')
  872. if (!this.isBack) {
  873. uni.showModal({
  874. title: '提示',
  875. content: data,
  876. success: function(res) {
  877. if (res.confirm) {
  878. console.log('用户点击确定');
  879. } else if (res.cancel) {
  880. console.log('用户点击取消');
  881. }
  882. }
  883. });
  884. }
  885. });
  886. uni.$on("socket_close", () => {
  887. let pages = getCurrentPages();
  888. let curPage = pages[pages.length - 1]; // 当前页面路径
  889. let beforePage = pages[pages.length - 2]; // 前一个页面路径
  890. console.log(pages,'pages')
  891. console.log(curPage,'curPage')
  892. if (!this.isBack) {
  893. let curRoute = this.$mp.page.route;
  894. console.log(this.$mp.page, 'curRoute')
  895. let self = this
  896. uni.showModal({
  897. title: '提示',
  898. content: '连接断开,是否重新连接',
  899. success: function(res) {
  900. if (res.confirm) {
  901. self.wsStart()
  902. } else if (res.cancel) {
  903. uni.navigateBack();
  904. }
  905. }
  906. });
  907. }
  908. })
  909. this.$nextTick(() => {
  910. this.hide_mer_status = app.globalData.hide_mer_status
  911. });
  912. this.wsStart();
  913. },
  914. methods: {
  915. // 获取店铺详情
  916. getStoreDetail() {
  917. getStoreDetail(this.mer_id).then(res => {
  918. this.storeInfo = res.data
  919. })
  920. },
  921. // ws连接
  922. wsStart() {
  923. this.socket = new Socket();
  924. this.height();
  925. },
  926. // ws关闭
  927. wsEnd() {
  928. if (this.userId == 0) {
  929. this.socket.send({
  930. data: {
  931. mer_id: this.mer_id
  932. },
  933. type: "chat_end"
  934. });
  935. } else {
  936. this.socket.send({
  937. data: {
  938. uid: this.userId
  939. },
  940. type: "service_chat_end"
  941. });
  942. }
  943. this.isBack = true
  944. this.socket && this.socket.onClose();
  945. },
  946. // 退款订单
  947. getRefundDetail() {
  948. if (this.refund_order_id) {
  949. refundDetail(this.refund_order_id).then(res => {
  950. this.refundDetail = res.data
  951. })
  952. }
  953. },
  954. uploadImg() {
  955. let self = this
  956. self.$util.uploadImageOne('upload/image', function(res) {
  957. if(res.status == 200){
  958. self.sendMsg(res.data.path, 3)
  959. }
  960. });
  961. },
  962. getOrderInfo() {
  963. if (!this.orderId) return;
  964. getOrderDetail(this.orderId).then(res => {
  965. this.orderInfo = res.data;
  966. // if (this.orderInfo.add_time_h) {
  967. // this.orderInfo.add_time_h = this.orderInfo.add_time_h.substring(
  968. // 0,
  969. // this.orderInfo.add_time_h.lastIndexOf(":")
  970. // );
  971. // }
  972. if (this.orderInfo.orderProduct.length) {
  973. this.cartInfo = this.orderInfo.orderProduct[0];
  974. }
  975. });
  976. },
  977. getproductInfo() {
  978. let that = this;
  979. if (!that.productId && !that.presellId && !that.combinationId) return;
  980. if(that.presellId || that.combinationId){
  981. if(that.presellId){
  982. getPresellProductDetail(that.presellId).then(res => {
  983. that.productInfo = res.data;
  984. });
  985. }else if(that.combinationId){
  986. getCombinationDetail(that.combinationId).then(res => {
  987. that.productInfo = res.data.product;
  988. });
  989. }
  990. }else{
  991. getProductDetail(that.productId).then(res => {
  992. that.productInfo = res.data;
  993. });
  994. }
  995. },
  996. scroll() {
  997. if (window.scrollY < 300 && !this.loaded && !this.loading)
  998. this.getHistory();
  999. },
  1000. imageuploaded(res) {
  1001. console.log(res)
  1002. if (res.status !== 200)
  1003. return this.$util.Tips({
  1004. title: res.msg || "上传图片失败"
  1005. });
  1006. this.sendMsg(res.data.url, 3);
  1007. },
  1008. // 用户聊天记录
  1009. getHistory() {
  1010. if (this.loading || this.loaded) return;
  1011. this.loading = true;
  1012. getChatRecord(this.mer_id, {
  1013. page: this.page,
  1014. limit: this.limit
  1015. })
  1016. .then(({
  1017. data
  1018. }) => {
  1019. this.history = data.list.concat(this.history);
  1020. if (this.page === 1) {
  1021. this.$nextTick(function() {
  1022. // window.scrollTo(0, document.documentElement.scrollHeight + 999);
  1023. this.height();
  1024. });
  1025. }
  1026. this.page++;
  1027. this.loading = false;
  1028. this.loaded = data.length < this.limit;
  1029. })
  1030. .catch(err => {
  1031. this.$util.Tips({
  1032. title: err.msg || "加载失败"
  1033. });
  1034. });
  1035. },
  1036. // 客服聊天记录
  1037. getMerHistory() {
  1038. if (this.loading || this.loaded) return;
  1039. this.loading = true;
  1040. getMerHistory(this.userId, this.mer_id, {
  1041. page: this.page,
  1042. limit: this.limit
  1043. })
  1044. .then(({
  1045. data
  1046. }) => {
  1047. this.history = data.list.concat(this.history);
  1048. if (this.page === 1) {
  1049. this.$nextTick(function() {
  1050. this.height();
  1051. });
  1052. }
  1053. this.page++;
  1054. this.loading = false;
  1055. this.loaded = data.length < this.limit;
  1056. })
  1057. .catch(err => {
  1058. this.$util.Tips({
  1059. title: err.msg || "加载失败"
  1060. });
  1061. });
  1062. },
  1063. focus: function() {
  1064. this.active = false;
  1065. },
  1066. keyup: function() {
  1067. // console.log(this.$refs.input.innerHTML.length);
  1068. if (this.$refs.input.innerHTML.length > 0) {
  1069. this.sendColor = true;
  1070. } else {
  1071. this.sendColor = false;
  1072. }
  1073. },
  1074. addEmoji(name) {
  1075. this.sendMsg(name, 2);
  1076. },
  1077. sendMsg(msn, type) {
  1078. let self = this
  1079. if (this.userId == 0) {
  1080. this.height();
  1081. this.socket.send({
  1082. data: {
  1083. msn,
  1084. msn_type: type,
  1085. // to_uid: this.toUid,
  1086. mer_id: self.mer_id
  1087. },
  1088. type: "send_chat",
  1089. })
  1090. } else {
  1091. this.height();
  1092. this.socket.send({
  1093. data: {
  1094. msn,
  1095. msn_type: type,
  1096. // to_uid: this.toUid,
  1097. uid: self.userId
  1098. },
  1099. type: "service_chat",
  1100. })
  1101. }
  1102. },
  1103. sendTest() {
  1104. this.sendMsg(this.textCon, 1);
  1105. this.textCon = ''
  1106. this.height();
  1107. },
  1108. sendProduct() {
  1109. if(this.presellId || this.combinationId){
  1110. if(this.presellId){
  1111. this.sendMsg(this.presellId, 7);
  1112. this.presellId = 0;
  1113. }else if(this.combinationId){
  1114. this.sendMsg(this.combinationId, 8);
  1115. this.combinationId = 0;
  1116. }
  1117. }else{
  1118. this.sendMsg(this.productId, 4);
  1119. this.productId = 0;
  1120. }
  1121. this.productInfo = {};
  1122. },
  1123. sendOrder() {
  1124. this.sendMsg(this.orderId, 5);
  1125. this.orderId = 0;
  1126. this.orderInfo = {};
  1127. },
  1128. sendRefundOrder() {
  1129. this.sendMsg(this.refund_order_id, 6);
  1130. this.refund_order_id = 0;
  1131. this.refundDetail = {};
  1132. },
  1133. bindInput: function(e) {
  1134. if (e.detail.value) {
  1135. this.sendColor = true
  1136. } else {
  1137. this.sendColor = false
  1138. }
  1139. // if ($event.keyCode === 13) {
  1140. // $event.preventDefault();
  1141. // if (this.$refs.input.innerHTML) {
  1142. // this.sendMsg(this.$refs.input.innerHTML, 1);
  1143. // this.$refs.input.innerHTML = "";
  1144. // }
  1145. // }
  1146. this.height();
  1147. },
  1148. start() {
  1149. var that = this;
  1150. this.longClick = 0;
  1151. this.timeOutEvent = setTimeout(function() {
  1152. that.longClick = 1;
  1153. }, 500);
  1154. that.speak = "松开 结束";
  1155. that.recording = true;
  1156. },
  1157. move() {
  1158. clearTimeout(this.timeOutEvent);
  1159. this.timeOutEvent = 0;
  1160. },
  1161. end() {
  1162. clearTimeout(this.timeOutEvent);
  1163. if (this.timeOutEvent !== 0 && this.longClick === 0) {
  1164. //点击
  1165. //此处为点击事件----在此处添加跳转详情页
  1166. }
  1167. this.speak = "按住 说话";
  1168. this.recording = false;
  1169. return false;
  1170. },
  1171. voiceBnt: function() {
  1172. this.active = false;
  1173. if (this.voice === true) {
  1174. this.voice = false;
  1175. this.$nextTick(function() {
  1176. this.$refs.input.focus();
  1177. });
  1178. } else {
  1179. this.voice = true;
  1180. }
  1181. // window.scrollTo(0, document.documentElement.scrollHeight);
  1182. this.percent = 0;
  1183. this.footerConH = 0;
  1184. this.footerH = 0;
  1185. this.$nextTick(function() {
  1186. this.height();
  1187. });
  1188. },
  1189. emoticon: function() {
  1190. this.voice = false;
  1191. if (this.active === true) {
  1192. this.active = false;
  1193. this.isBQ = false
  1194. // this.$nextTick(function() {
  1195. // this.$refs.input.focus();
  1196. // });
  1197. } else {
  1198. this.active = true;
  1199. this.isBQ = true
  1200. // this.$nextTick(function() {
  1201. // this.$refs.input.blur();
  1202. // });
  1203. }
  1204. // this.$nextTick(function() {
  1205. // window.scrollTo(0, document.documentElement.scrollHeight);
  1206. // });
  1207. this.height();
  1208. },
  1209. height() {
  1210. let self = this
  1211. var scrollTop = 0
  1212. let info = uni.createSelectorQuery().select(".chat");
  1213. // let footerConH = this.$refs.footerCon.offsetHeight;
  1214. // let footerH = this.$refs.footer.offsetHeight;
  1215. // let scale = 750 / window.screen.availWidth;
  1216. // this.footerConH = (footerConH * scale) / 100;
  1217. // this.footerH = (footerH * scale) / 100;
  1218. // this.percent = ((this.footerConH - this.footerH) / this.footerConH) * 100;
  1219. setTimeout(res => {
  1220. info.boundingClientRect(function(data) { //data - 各种参数
  1221. console.log(data.height, 'data.height') // 获取元素高度
  1222. scrollTop = data.height
  1223. if (self.active) {
  1224. self.scrollTop = parseInt(scrollTop) + 500
  1225. } else {
  1226. self.scrollTop = parseInt(scrollTop) + 100
  1227. }
  1228. }).exec()
  1229. }, 1000)
  1230. },
  1231. // 滚动到头部
  1232. bindScroll() {
  1233. console.log('滚动到头部')
  1234. if (this.userId == 0) {
  1235. // this.getHistory();
  1236. this.getHistory();
  1237. this.getproductInfo();
  1238. this.getOrderInfo();
  1239. this.getRefundDetail();
  1240. this.getStoreDetail();
  1241. } else {
  1242. this.getMerHistory();
  1243. }
  1244. }
  1245. }
  1246. };
  1247. </script>
  1248. <style lang="scss">
  1249. page {
  1250. width: 100%;
  1251. height: 100%;
  1252. }
  1253. @import url("@/plugin/emoji-awesome/css/google.min.css");
  1254. .broadcast_num {
  1255. padding: 0 10rpx !important;
  1256. }
  1257. .noPad {
  1258. padding: 0 !important;
  1259. margin-bottom: 0 !important;
  1260. height: auto !important;
  1261. }
  1262. .broadcast-details_num {
  1263. width: 100%;
  1264. height: 80rpx;
  1265. line-height: 80rpx;
  1266. color: #000000;
  1267. font-size: 26rpx;
  1268. display: flex;
  1269. justify-content: space-between;
  1270. background: #fff;
  1271. border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
  1272. padding: 0 24rpx;
  1273. }
  1274. .broadcast-details_order {
  1275. padding: 15rpx;
  1276. }
  1277. .broadcast-details_box {
  1278. padding: 24rpx;
  1279. display: flex;
  1280. background: #fff;
  1281. border-radius: 6px;
  1282. margin-bottom: 24rpx;
  1283. }
  1284. .broadcast_details_model {
  1285. width: 100%;
  1286. height: 43rpx;
  1287. background: rgba(0, 0, 0, 0.5);
  1288. border-radius: 0px 0px 8px 8px;
  1289. position: absolute;
  1290. z-index: 2;
  1291. bottom: 0;
  1292. font-size: 22rpx;
  1293. color: #fff;
  1294. text-align: center;
  1295. line-height: 43rpx;
  1296. }
  1297. .broadcast_details_img {
  1298. width: 140rpx;
  1299. height: 140rpx;
  1300. border-radius: 8px;
  1301. overflow: hidden;
  1302. position: relative;
  1303. }
  1304. .broadcast_details_img img {
  1305. width: 100%;
  1306. height: 100%;
  1307. }
  1308. .broadcast_details_img_no {
  1309. width: 456rpx;
  1310. height: 456rpx;
  1311. border-radius: 8px 8px 0px 0px;
  1312. overflow: hidden;
  1313. margin-bottom: 10rpx;
  1314. }
  1315. .broadcast_details_picBox_no {
  1316. width: 100%;
  1317. }
  1318. .broadcast_details_img_no img {
  1319. width: 100%;
  1320. height: 100%;
  1321. }
  1322. .broadcast_details_tit {
  1323. font-size: 28rpx;
  1324. color: #333333;
  1325. height: 85rpx;
  1326. font-weight: 800;
  1327. overflow: hidden;
  1328. text-overflow: ellipsis;
  1329. display: -webkit-box;
  1330. -webkit-line-clamp: 2;
  1331. -webkit-box-orient: vertical;
  1332. text-align: left !important;
  1333. }
  1334. .broadcast_details_tit_no {
  1335. font-size: 28rpx;
  1336. color: #333333;
  1337. font-weight: 800;
  1338. text-align: left;
  1339. margin-top: 5rpx;
  1340. }
  1341. .broadcast_details_picBox {
  1342. width: 75%;
  1343. margin-left: 24rpx;
  1344. }
  1345. .broadcast_details_pic {
  1346. font-size: 36rpx;
  1347. color: #e93323;
  1348. text-align: left;
  1349. }
  1350. .broadcast_details_pic_num {
  1351. text-decoration: line-through;
  1352. font-size: 28rpx;
  1353. color: rgba(0, 0, 0, 0.5);
  1354. margin-left: 0.1rem;
  1355. }
  1356. .broadcast_details_btn {
  1357. width: 130rpx;
  1358. height: 50rpx;
  1359. background: #e83323;
  1360. opacity: 1;
  1361. border-radius: 125rpx;
  1362. color: #fff;
  1363. font-size: 24rpx;
  1364. text-align: center;
  1365. line-height: 50rpx;
  1366. }
  1367. .broadcast-details .chat {
  1368. padding: 1rpx 23rpx 0 23rpx;
  1369. margin-bottom: 3rpx;
  1370. }
  1371. .broadcast-details .chat .item {
  1372. margin-top: 37rpx;
  1373. }
  1374. .broadcast-details .chat .item .pictrue {
  1375. width: 80rpx;
  1376. height: 80rpx;
  1377. margin-top: 10rpx;
  1378. }
  1379. .broadcast-details .chat .item .pictrue image {
  1380. width: 100%;
  1381. height: 100%;
  1382. border-radius: 50%;
  1383. }
  1384. .broadcast-details .chat .item .text {
  1385. margin-left: 20rpx;
  1386. }
  1387. .broadcast-details .chat .item .text.textR {
  1388. text-align: right;
  1389. margin: 0 20rpx 0 0;
  1390. }
  1391. .broadcast-details .chat .item .text .name {
  1392. font-size: 24rpx;
  1393. color: #999;
  1394. }
  1395. .broadcast-details .chat .item .text .name .return {
  1396. color: #509efb;
  1397. margin-left: 17rpx;
  1398. }
  1399. .broadcast-details .chat .item .text.textR .name .return {
  1400. margin: 0 0.17rem 0 0;
  1401. }
  1402. .broadcast-details .chat .item .text .conter {
  1403. background-color: #fff;
  1404. border-radius: 8rpx;
  1405. padding: 16rpx 20rpx;
  1406. font-size: 30rpx;
  1407. color: #333;
  1408. position: relative;
  1409. max-width: 496rpx;
  1410. margin-top: 2rpx;
  1411. word-break: break-all;
  1412. .em{
  1413. margin: 0;
  1414. }
  1415. }
  1416. .broadcast-details .chat .item .text .spot {
  1417. width: 15rpx;
  1418. height: 15rpx;
  1419. background-color: #c00000;
  1420. border-radius: 50%;
  1421. margin-left: 20rpx;
  1422. }
  1423. .broadcast-details .chat .item .text .conter:before {
  1424. position: absolute;
  1425. content: "";
  1426. width: 0;
  1427. height: 0;
  1428. border-bottom: 9rpx solid transparent;
  1429. border-right: 14rpx solid #fff;
  1430. border-top: 9rpx solid transparent;
  1431. left: -14rpx;
  1432. top: 25rpx;
  1433. }
  1434. .broadcast-details .chat .item .text.textR .conter:before {
  1435. left: unset;
  1436. right: -14rpx;
  1437. transform: rotateY(180deg);
  1438. }
  1439. .broadcast-details .chat .item .text .conter img {
  1440. /* #ifdef H5 */
  1441. width: 100%;
  1442. /* #endif */
  1443. display: block;
  1444. }
  1445. .broadcast-details .chat .item .text .conter .signal {
  1446. width: 48rpx;
  1447. height: 48rpx;
  1448. }
  1449. .broadcast-details .chat .item .text .conter .signal.signalR {
  1450. transform: rotate(180deg);
  1451. -ms-transform: rotate(180deg);
  1452. -webkit-transform: rotate(180deg);
  1453. }
  1454. .broadcast-details .footerCon {
  1455. height: 100rpx;
  1456. width: 100%;
  1457. transition: all 0.005s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  1458. background-color: #fff;
  1459. }
  1460. .broadcast-details .footerCon.on {
  1461. position: relative;
  1462. top: -300rpx;
  1463. transform: translate3d(0, 0, 0) !important;
  1464. }
  1465. .broadcast-details .footerCon .banner .swiper-slide {
  1466. flex-wrap: wrap;
  1467. -webkit-flex-wrap: wrap;
  1468. background-color: #fff;
  1469. padding-bottom: 50rpx;
  1470. border-top: 1px solid #f5f5f5;
  1471. }
  1472. .broadcast-details .footerCon .banner .swiper-slide .emoji-outer,
  1473. .swiper-slide .em {
  1474. display: block;
  1475. width: 50rpx;
  1476. height: 50rpx;
  1477. margin: 40rpx 0 0 50rpx;
  1478. }
  1479. .broadcast-details .footerCon .banner .swiper-container-horizontal>.swiper-pagination-bullets {
  1480. bottom: 10rpx;
  1481. }
  1482. .broadcast-details .footerCon .slider-banner .swiper-pagination-bullet-active {
  1483. background-color: #999;
  1484. }
  1485. .broadcast-details .recording {
  1486. width: 300rpx;
  1487. height: 300rpx;
  1488. position: fixed;
  1489. top: 40%;
  1490. left: 50%;
  1491. margin-left: -150rpx;
  1492. }
  1493. .broadcast-details .recording img {
  1494. width: 100%;
  1495. height: 100%;
  1496. }
  1497. .broadcast-details .footer {
  1498. width: 100%;
  1499. background-color: #fff;
  1500. padding: 17rpx 26rpx;
  1501. }
  1502. .broadcast-details .footer img {
  1503. width: 61rpx;
  1504. height: 60rpx;
  1505. display: block;
  1506. }
  1507. .broadcast-details .footer .input,
  1508. .broadcast-details .footer .voice {
  1509. width: 440rpx;
  1510. border-radius: 10rpx;
  1511. background-color: #e5e5e5;
  1512. /* padding: 17rpx 30rpx; */
  1513. height: 60rpx;
  1514. padding-left: 20rpx;
  1515. }
  1516. .input {}
  1517. .broadcast-details .footer .input {
  1518. max-height: 150rpx;
  1519. overflow-y: auto;
  1520. overflow-x: hidden;
  1521. }
  1522. .broadcast-details .footer .send {
  1523. width: 70rpx;
  1524. text-align: center;
  1525. height: 60rpx;
  1526. line-height: 60rpx;
  1527. font-weight: bold;
  1528. }
  1529. .em {
  1530. display: inline-block;
  1531. width: 50rpx;
  1532. height: 50rpx;
  1533. margin: 40rpx 0 0 50rpx;
  1534. }
  1535. .emoji-outer {
  1536. position: absolute;
  1537. right: 50rpx;
  1538. bottom: 30rpx;
  1539. width: 50rpx;
  1540. height: 50rpx;
  1541. }
  1542. .broadcast-details {
  1543. display: flex;
  1544. flex-direction: column;
  1545. width: 100%;
  1546. overflow: hidden;
  1547. .hd-wrapper {
  1548. flex: 1;
  1549. display: flex;
  1550. flex-direction: column;
  1551. overflow: hidden;
  1552. &.on {
  1553. padding-bottom: 300rpx;
  1554. }
  1555. }
  1556. }
  1557. .store-wrapper {
  1558. display: flex;
  1559. align-items: center;
  1560. justify-content: space-between;
  1561. padding: 15rpx 20rpx;
  1562. background-color: #fff;
  1563. image {
  1564. width: 60rpx;
  1565. height: 60rpx;
  1566. margin-right: 10rpx;
  1567. }
  1568. .left {
  1569. display: flex;
  1570. align-items: center;
  1571. }
  1572. .link {
  1573. width: 80rpx;
  1574. height: 40rpx;
  1575. line-height: 38rpx;
  1576. border: 1px solid $theme-color;
  1577. border-radius: 20px;
  1578. font-size: 24rpx;
  1579. color: $theme-color;
  1580. text-align: center;
  1581. }
  1582. }
  1583. </style>