chat.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <view>
  3. <!--标题栏-->
  4. <bar-title bgColor="bg-white" isBack>
  5. <block slot="content">
  6. <text class="margin-right-xs">仔仔</text>
  7. <text class="cu-tag bg-blue sm radius">
  8. <text class="cuIcon-male"/>
  9. </text>
  10. </block>
  11. <block slot="right">
  12. <text class="cuIcon-more"/>
  13. </block>
  14. </bar-title>
  15. <!--商品信息-->
  16. <view class="bg-white zaiui-goods-details-box pay_status">
  17. <view class="cu-avatar radius" :style="[{backgroundImage:'url('+ goods_img +')'}]"/>
  18. <view class="goods-info-view">
  19. <view class="title-view">
  20. <view class="text-cut text-black">商品名称 99新 苹果 iPhoneX 256G 银色</view>
  21. <text class="text-right text-gray text-sm">交易成功</text>
  22. </view>
  23. <view class="price-tools-view">
  24. <text class="text-price text-red text-lg">2999.00</text>
  25. <view class="zaiui-tag-view">
  26. <text class="cu-tag bg-red radius sm">马上买</text>
  27. <text class="cu-tag line-black radius sm">钱款去向</text>
  28. <text class="cu-tag line-black radius sm">
  29. <text class="cuIcon-more"/>
  30. </text>
  31. </view>
  32. </view>
  33. </view>
  34. <!--提示-->
  35. <view class="zaiui-goods-tip-view" :class="tipShow?'show':''">
  36. <text class="text-black cuIcon-notification icon"/>
  37. <view class="text-sm content">
  38. <text class="text-black">平台绝对不会收取实名认证等任何费用。让你加微信支付或者点链接、扫二维码的都是骗子!</text>
  39. <text class="text-blue">查看骗术></text>
  40. </view>
  41. </view>
  42. <!--按钮-->
  43. <view class="zaiui-goods-info-btn-view" @tap="tipShowTap">
  44. <view class="h-line-view">
  45. <view class="h-line"/>
  46. <view class="h-line"/>
  47. </view>
  48. </view>
  49. </view>
  50. <!--聊天框-->
  51. <view class="zaiui-chat-scroll-view" :class="chatShow?'tools':''" @tap="setToolsHidden">
  52. <scroll-view scroll-into-view="news15" scroll-y class="scroll-view" @scroll="chatScroll" :scroll-top="scroll_top">
  53. <!--时间-->
  54. <view id="news1" class="news-view-item time">
  55. <text class="text-sm text-gray">14:52</text>
  56. </view>
  57. <!--对方-->
  58. <view id="news2" class="news-view-item left">
  59. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/1.jpg);"/>
  60. <view class="news-content">
  61. <view class="bg-white text-black content">您好</view>
  62. </view>
  63. </view>
  64. <!--提示-->
  65. <view id="news3" class="news-view-item notice">
  66. <view class="bg-white notice-content-view">
  67. <view class="cu-avatar round" style="background-image:url(/static/images/news/abb.png);"/>
  68. <view class="notice-content">
  69. <view class="text-black">温馨提示</view>
  70. <view class="text-gray text-sm introduce">请礼貌用语友好沟通,如遇骚扰等不文明行为,可以将对方屏蔽并投诉。</view>
  71. </view>
  72. </view>
  73. </view>
  74. <!--我-->
  75. <view id="news4" class="news-view-item right">
  76. <view class="news-content">
  77. <view class="bg-blue content">
  78. <text class="text-sm text-gray status">已读</text>
  79. <text>稍等一下下</text>
  80. </view>
  81. </view>
  82. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/2.jpg);"/>
  83. </view>
  84. <!--对方-->
  85. <view id="news5" class="news-view-item left">
  86. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/1.jpg);"/>
  87. <view class="news-content">
  88. <view class="bg-white text-black content">测试多行内容,测试多行内容,测试多行内容,测试多行内容,测试多行内容,测试多行内容</view>
  89. </view>
  90. </view>
  91. <!--我-->
  92. <view id="news6" class="news-view-item right">
  93. <view class="news-content">
  94. <view class="bg-blue content">
  95. <text class="text-sm text-blue status">未读</text>
  96. <text>测试多行内容,测试多行内容,测试多行内容,测试多行内容,测试多行内容,测试多行内容</text>
  97. </view>
  98. </view>
  99. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/2.jpg);"/>
  100. </view>
  101. <!--时间-->
  102. <view id="news7" class="news-view-item time">
  103. <text class="text-sm text-gray">15:52</text>
  104. </view>
  105. <!--订单状态-->
  106. <view id="news8" class="news-view-item order">
  107. <view class="bg-white order-content-view">
  108. <view class="cu-avatar radius" :style="[{backgroundImage:'url('+ goods_img +')'}]"/>
  109. <view class="order-content">
  110. <view class="title-view">
  111. <view class="text-black">卖家已发货</view>
  112. <text class="text-right text-blue text-sm">查看订单</text>
  113. </view>
  114. <view class="text-gray text-sm introduce">卖家已发货</view>
  115. </view>
  116. </view>
  117. </view>
  118. <!--小提示-->
  119. <view id="news9" class="news-view-item tip">
  120. <text class="text-sm text-gray">长按图片、文字或视频,支持撤回消息哦~</text>
  121. </view>
  122. <!--对方-->
  123. <view id="news10" class="news-view-item left">
  124. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/1.jpg);"/>
  125. <view class="news-content">
  126. <view class="cu-avatar img-content" :style="[{backgroundImage:'url('+ goods_img +')'}]"/>
  127. </view>
  128. </view>
  129. <!--我-->
  130. <view id="news11" class="news-view-item right">
  131. <view class="news-content">
  132. <view class="cu-avatar img-content" :style="[{backgroundImage:'url('+ goods_img +')'}]">
  133. <text class="text-sm text-blue status">未读</text>
  134. </view>
  135. </view>
  136. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/2.jpg);"/>
  137. </view>
  138. <!--对方-->
  139. <view id="news12" class="news-view-item left">
  140. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/1.jpg);"/>
  141. <view class="news-content">
  142. <view class="bg-white text-black content">
  143. <text class="cuIcon-sound sound-icon"/>
  144. <text class="margin-left-sm text-gray s-text">33”</text>
  145. </view>
  146. </view>
  147. </view>
  148. <!--我-->
  149. <view id="news13" class="news-view-item right">
  150. <view class="news-content">
  151. <view class="bg-blue content">
  152. <text class="text-sm text-gray status">已读</text>
  153. <text class="cuIcon-sound sound-icon"/>
  154. <text class="margin-left-sm s-text">33”</text>
  155. </view>
  156. </view>
  157. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/2.jpg);"/>
  158. </view>
  159. <!--对方-->
  160. <view id="news14" class="news-view-item left">
  161. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/1.jpg);"/>
  162. <view class="news-content">
  163. <view class="bg-white text-black content">
  164. <text>测试</text>
  165. <image class="emoji" src="/static/images/emoji_1/1.png" mode="widthFix"/>
  166. <text>表情的</text>
  167. </view>
  168. </view>
  169. </view>
  170. <!--我-->
  171. <view id="news15" class="news-view-item right">
  172. <view class="news-content">
  173. <view class="bg-blue content">
  174. <text class="text-sm text-gray status">已读</text>
  175. <text>测试</text>
  176. <image class="emoji" src="/static/images/emoji/1.png" mode="widthFix"/>
  177. <text>表情的</text>
  178. </view>
  179. </view>
  180. <view class="cu-avatar round" style="background-image:url(/static/images/avatar/2.jpg);"/>
  181. </view>
  182. </scroll-view>
  183. </view>
  184. <!--底部区域-->
  185. <view class="bg-white zaiui-footer-fixed zaiui-foot-padding-bottom">
  186. <!--操作区域-->
  187. <view class="cu-bar input zaiui-foot-bar-input-tools">
  188. <view class="action">
  189. <text class="cuIcon-rounddown text-gray" @tap="speedyTap"/>
  190. </view>
  191. <input class="input-radius" placeholder="输入聊天内容"/>
  192. <view class="action">
  193. <text class="cuIcon-emoji text-gray" @tap="emojiTap"/>
  194. </view>
  195. <view class="action">
  196. <text class="cuIcon-roundaddfill text-red" @tap="toolsTap"/>
  197. </view>
  198. </view>
  199. <!--快捷输入-->
  200. <view class="zaiui-speedy-view" :class="speedyShow?'show':''">
  201. <view class="key-bar text-center">走平台,支持平台验机吗?</view>
  202. <view class="key-bar text-center">能便宜一点吗?</view>
  203. <view class="key-bar text-center">是否包邮?</view>
  204. <view class="key-bar text-center">机器有发票吗?</view>
  205. <view class="key-bar text-center">机器配件都在吗?</view>
  206. <view class="key-bar text-center">能发个视频或图片吗?</view>
  207. </view>
  208. <!--表情栏-->
  209. <view class="zaiui-emoji-view" :class="emojiShow?'show':''">
  210. <view class="emoji-scroll-view-box">
  211. <swiper class="emoji-swiper" :current="emoji_swiper" indicator-dots @change="emoji_change">
  212. <swiper-item>
  213. <view class="cu-list grid no-border">
  214. <block v-for="(item,index) in emojiNum" :key="index" v-if="index < 20">
  215. <image class="emoji" :src="getEmojiUrl(index)" mode="widthFix" @tap="emojiSelectTap('[表情' + index + ']')"/>
  216. </block>
  217. <image class="del_btn" src="/static/zaiui/img/aa2.png" mode="widthFix" @tap="emojiDelTap"/>
  218. </view>
  219. </swiper-item>
  220. <swiper-item>
  221. <view class="cu-list grid no-border">
  222. <block v-for="(item,index) in emojiNum" :key="index" v-if="index >= 20 && index < 40">
  223. <image class="emoji" :src="getEmojiUrl(index)" mode="widthFix" @tap="emojiSelectTap('[表情' + index + ']')"/>
  224. </block>
  225. <image class="del_btn" src="/static/zaiui/img/aa2.png" mode="widthFix" @tap="emojiDelTap"/>
  226. </view>
  227. </swiper-item>
  228. </swiper>
  229. </view>
  230. <!--选择表情类型栏-->
  231. <scroll-view class="emoji-tools-scroll-view" scroll-x>
  232. <view id="emoji_tools1" class="emoji-tools-item" :class="emojiUrl=='emoji'?'select':''" @tap="emoji_tools_tap('emoji')">
  233. <image class="emoji" src="/static/images/emoji/1.png" mode="widthFix"/>
  234. </view>
  235. <view id="emoji_tools2" class="emoji-tools-item" :class="emojiUrl=='emoji_1'?'select':''" @tap="emoji_tools_tap('emoji_1')">
  236. <image class="emoji" src="/static/images/emoji_1/1.png" mode="widthFix"/>
  237. </view>
  238. </scroll-view>
  239. </view>
  240. <!--更多工具-->
  241. <view class="zaiui-tools-view" :class="toolsShow?'show':''">
  242. <view class="cu-list grid col-4 no-border">
  243. <view class="cu-item">
  244. <view class="img-view">
  245. <image class="img" src="/static/images/news/az2.png" mode="widthFix"/>
  246. </view>
  247. <text>拍照</text>
  248. </view>
  249. <view class="cu-item">
  250. <view class="img-view">
  251. <image class="img" src="/static/images/news/ayy.png" mode="widthFix"/>
  252. </view>
  253. <text>相册</text>
  254. </view>
  255. <view class="cu-item">
  256. <view class="img-view">
  257. <image class="img" src="/static/images/news/azf.png" mode="widthFix"/>
  258. </view>
  259. <text>语音通话</text>
  260. </view>
  261. <view class="cu-item">
  262. <view class="img-view">
  263. <image class="img" src="/static/images/news/aze.png" mode="widthFix"/>
  264. </view>
  265. <text>视频</text>
  266. </view>
  267. <view class="cu-item">
  268. <view class="img-view">
  269. <image class="img" src="/static/images/news/az4.png" mode="widthFix"/>
  270. </view>
  271. <text>位置</text>
  272. </view>
  273. <view class="cu-item">
  274. <view class="img-view">
  275. <image class="img" src="/static/images/news/az3.png" mode="widthFix"/>
  276. </view>
  277. <text>宝贝</text>
  278. </view>
  279. <view class="cu-item">
  280. <view class="img-view">
  281. <image class="img" src="/static/images/news/azg.png" mode="widthFix"/>
  282. </view>
  283. <text>联系卡</text>
  284. </view>
  285. </view>
  286. </view>
  287. </view>
  288. </view>
  289. </template>
  290. <script>
  291. import barTitle from '@/components/zaiui-common/basics/bar-title';
  292. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  293. export default {
  294. components: {
  295. barTitle
  296. },
  297. data() {
  298. return {
  299. goods_img: '/static/images/home/goods/10.png', scroll_top: 0, tipShow: false, chatShow: false, speedyShow: false,
  300. scrollHeight: 0, emojiShow: false, emojiNum: 40, emojiUrl: "emoji", toolsShow: false, emoji_swiper: 0,
  301. }
  302. },
  303. onLoad() {
  304. },
  305. onReady() {
  306. _tool.setBarColor(true);
  307. uni.pageScrollTo({
  308. scrollTop: 0,
  309. duration: 0
  310. });
  311. },
  312. methods: {
  313. getEmojiUrl(index) {
  314. //更多表情图片包下载:https://download.csdn.net/download/qq_31763107/12304958
  315. let num = index + 1;
  316. let url = "/static/images/" + this.emojiUrl + "/" + num + ".png";
  317. return url;
  318. },
  319. tipShowTap() {
  320. if(this.tipShow) {
  321. this.tipShow = false;
  322. } else {
  323. this.tipShow = true;
  324. }
  325. },
  326. chatScroll(event) {
  327. this.scrollHeight = event.detail.scrollHeight;
  328. },
  329. speedyTap() {
  330. if(this.speedyShow) {
  331. this.speedyShow = false;
  332. this.setChatShow(false);
  333. } else {
  334. this.setViewHidden();
  335. this.speedyShow = true;
  336. this.setChatShow(true);
  337. }
  338. },
  339. emojiSelectTap(name) {
  340. console.log(name);
  341. },
  342. emojiDelTap() {
  343. console.log('点击了删除');
  344. },
  345. emojiTap() {
  346. if(this.emojiShow) {
  347. this.emojiShow = false;
  348. this.setChatShow(false);
  349. } else {
  350. this.setViewHidden();
  351. this.emojiShow = true;
  352. this.setChatShow(true);
  353. }
  354. },
  355. toolsTap() {
  356. if(this.toolsShow) {
  357. this.toolsShow = false;
  358. this.setChatShow(false);
  359. } else {
  360. this.setViewHidden();
  361. this.toolsShow = true;
  362. this.setChatShow(true);
  363. }
  364. },
  365. setViewHidden() {
  366. this.speedyShow = false;
  367. this.emojiShow = false;
  368. this.toolsShow = false;
  369. },
  370. setChatShow(status){
  371. this.chatShow = status;
  372. this.scroll_top = this.scrollHeight;
  373. },
  374. setToolsHidden() {
  375. this.setViewHidden();
  376. this.setChatShow(false);
  377. },
  378. emoji_tools_tap(type) {
  379. this.emojiUrl = type;
  380. this.emoji_swiper = 0;
  381. },
  382. emoji_change(event) {
  383. this.emoji_swiper = event.detail.current;
  384. }
  385. }
  386. }
  387. </script>
  388. <style lang="scss">
  389. /* #ifdef APP-PLUS */
  390. @import "../../static/colorui/main.css";
  391. @import "../../static/colorui/icon.css";
  392. @import "../../static/zaiui/style/app.scss";
  393. /* #endif */
  394. @import "../../static/zaiui/style/chat.scss";
  395. </style>