ck.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <view class="content">
  3. <view class="navBox">
  4. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  5. <view class="nav">
  6. <view class="navLeft" @click="goBack">
  7. <image src="../static/img/nav_icon_back.png" mode="aspectFit" class="backImg" @click="goback"></image>
  8. </view>
  9. <view class="title">供应商</view>
  10. <view class="goVin" ></view>
  11. </view>
  12. </view>
  13. <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
  14. <view style="height: 44px;"></view>
  15. <view class="top" v-if="info" @click="gocar">
  16. <view class="topLeft">
  17. <image :src="info.carModelInfo.logo" mode="" class="carLogo"></image>
  18. </view>
  19. <view class="topRight">
  20. <view>
  21. <view class="brand">{{info.carModelInfo.brand}}</view>
  22. <view class="carModel">{{info.title}}</view>
  23. </view>
  24. <image src="/static/img/icon_arrow.png" mode="" class="jtImg"></image>
  25. </view>
  26. </view>
  27. <view class="cont" v-if="info">
  28. <view class="line" v-for="(item,index) in info.supplierlist">
  29. <view class="lineLeft" >
  30. <view class="lineCK" @click="ckItem(item)">
  31. <image class="ckiMg" src="/static/img/icon_seled@2x.png" mode="" v-if="item.ck"></image>
  32. <image class="ckiMg" src="/static/img/duino.png" mode="" v-if="!item.ck"></image>
  33. </view>
  34. <view class="nameBox">
  35. <view class="name" @click="ckItem(item)">{{item.supplierName}}
  36. <view class="lineRgiht">
  37. <view @click.stop="goIm(item)" style="padding-left: 40rpx;">
  38. <image class="lineRgihtIMg" src="/static/img/xiaoxi.png" mode=""></image>
  39. </view>
  40. <view style="padding-left: 40rpx;" @click.stop="call(item.mobilePhone)">
  41. <image class="lineRgihtIMg2" src="/static/img/call.png" mode=""></image>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="jingying">经营品牌:{{item.brands}}</view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view style="height: 200rpx;"></view>
  51. <!-- 选择车型 -->
  52. <view class="ckcarBox" v-if="ckCarShow" >
  53. <view class="ckcar" @click.stop="">
  54. <view class="ckcarTop flex">
  55. <view class="ckcarTitle">请选择车型</view>
  56. <image src="../static/img/icon_quxiao.png" mode="" class="ckcarClose" @click="ckcarClose"></image>
  57. </view>
  58. <view class="ckcarlineBox" v-for="(item,index) in moreVinList" @click="gobyItem(item)">
  59. <view class="ckcarline flex">
  60. <view class="ckcarLeft">{{item.title}}</view>
  61. <image src="../static/img/icon_arrow.png" mode="" class="ckcarJtimg"></image>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- <view>token:{{token}}</view>
  67. <view>token:{{token}}</view> -->
  68. <view class="qunfaBox">
  69. <view class="qunfa" @click="qunfa">
  70. 一键群发
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import EmojiDecoder from '../lib/EmojiDecoder';
  77. import restApi from '../lib/restapi';
  78. import {formatDate} from '../lib/utils';
  79. import RecorderManager from '../lib/RecorderManager';
  80. const IMAGE_MAX_WIDTH = 200;
  81. const IMAGE_MAX_HEIGHT = 150;
  82. const recorderManager = new RecorderManager();
  83. const GoEasy = uni.$GoEasy;
  84. const GRTC = uni.$GRTC;
  85. export default {
  86. data() {
  87. return {
  88. //vin: 'JHMCM56557C404453',
  89. //vin:'LFV3A28K3D3000001',
  90. vin:'',
  91. list:[],
  92. info:'',
  93. currentUser:'',
  94. token:'',
  95. moreVinList:[],
  96. ckCarShow:false,
  97. androidE:'',
  98. iosE:'',
  99. iStatusBarHeight:'',
  100. }
  101. },
  102. onLoad(opt) {
  103. var token=opt.token
  104. this.vin=opt.vin
  105. this.token=token
  106. console.log(token)
  107. uni.setStorageSync('token', token);
  108. this.vinSupplier()
  109. this.imLoginUrl()
  110. //app交互
  111. /* var standalone = window.navigator.standalone
  112. var userAgent = window.navigator.userAgent.toLowerCase()
  113. var safari = /safari/.test(userAgent)
  114. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  115. var android = /android/.test(userAgent)
  116. if (ios) {
  117. // window.shopAppCallbackios=this.shopAppCallbackios;
  118. } else if (android) {
  119. // window.shopAppCallback=this.shopAppCallback;
  120. } */
  121. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  122. },
  123. onBackPress(options) {
  124. console.log('from:' + options.from)
  125. return true
  126. },
  127. methods: {
  128. goBack(){
  129. //app交互
  130. var standalone = window.navigator.standalone
  131. var userAgent = window.navigator.userAgent.toLowerCase()
  132. var safari = /safari/.test(userAgent)
  133. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  134. var android = /android/.test(userAgent)
  135. if (ios) {
  136. if ( true) {//!standalone&& !safari
  137. window.webkit.messageHandlers.goMyNav.postMessage(null)
  138. }
  139. } else if (android) {
  140. window.android.postMessage()
  141. }
  142. },
  143. gocar(){
  144. uni.navigateTo({
  145. url:'carModel?nLevelIDs='+this.info.carModelInfo.nLevelID+'&vin='+this.vin
  146. })
  147. },
  148. ckItem(item){
  149. console.log(item.ck)
  150. if(item.ck){
  151. //this.$set(item,"ck", false)
  152. item.ck=false
  153. }else{
  154. //this.$set(item,"ck", true)
  155. item.ck=true
  156. }
  157. },
  158. call(num){
  159. if(!num){
  160. uni.showToast({
  161. icon: 'none',
  162. title: '该供应商未设置联系方式',
  163. duration: 3000
  164. });
  165. return false
  166. }
  167. uni.makePhoneCall({
  168. phoneNumber: num
  169. })
  170. },
  171. gobyItem(item){
  172. item.supplierlist.forEach(item=>{
  173. item.ck=true
  174. })
  175. this.info= JSON.parse(JSON.stringify(item)) ;
  176. uni.setStorageSync('carModelInfo',this.info.carModelInfo )
  177. this.ckCarShow=false
  178. },
  179. ckcarClose(){
  180. this.ckCarShow=false;
  181. },
  182. qunfa(){
  183. var supplierlist=[]
  184. this.info.supplierlist.forEach(item=>{
  185. if(item.ck){
  186. supplierlist.push(item)
  187. }
  188. })
  189. uni.setStorageSync('supplierlist', supplierlist);
  190. uni.navigateTo({
  191. url:'qunfa?nLevelIDs='+this.info.carModelInfo.nLevelID+'&vin='+this.vin
  192. })
  193. },
  194. goIm(item){
  195. uni.setStorage({
  196. key: 'friend',
  197. data: item,
  198. success: function () {
  199. uni.navigateTo({
  200. url: './privateChat?to=' + item.id
  201. });
  202. }
  203. });
  204. },
  205. vinSupplier(){
  206. this.$http('imSys/vinSupplier', {
  207. vin:this.vin,
  208. },'GET').then(res => {
  209. console.log(res.data.length)
  210. //this.info=res.data[0]
  211. if(res.data.length>1){
  212. this.ckCarShow=true
  213. this.moreVinList=res.data
  214. console.log(this.moreVinList)
  215. }else{
  216. res.data[0].supplierlist.forEach(item=>{
  217. item.ck=true
  218. })
  219. this.info=res.data[0]
  220. //this.info
  221. uni.setStorageSync('carModelInfo',this.info.carModelInfo )
  222. }
  223. })
  224. },
  225. imLoginUrl(){
  226. this.$http('imSys/imLoginUrl', {
  227. token:this.token,
  228. },'POST').then(res => {
  229. // console.log(res)
  230. var users={
  231. userId:res.data.userId,
  232. name:res.data.users.name,
  233. avatar:'',
  234. id:res.data.userId,
  235. }
  236. this.currentUser=users
  237. this.connectGoEasy()
  238. uni.setStorageSync('users', users);
  239. })
  240. },
  241. connectGoEasy(){
  242. console.log(this.currentUser)
  243. //this.currentUser.id="1292F5DA-793B-4549-844E-C5F606869D0C"
  244. uni.setStorageSync('currentUser', this.currentUser);
  245. GoEasy.connect({
  246. id: this.currentUser.id,
  247. data: {
  248. name: this.currentUser.name,
  249. avatar: this.currentUser.avatar
  250. },
  251. onSuccess: () => {
  252. console.log('GoEasy connect successfully.')
  253. },
  254. onFailed: (error) => {
  255. console.log('Failed to connect GoEasy, code:' + error.code + ',error:' + error.content);
  256. },
  257. onProgress: (attempts) => {
  258. console.log('GoEasy is connecting', attempts);
  259. }
  260. });
  261. }
  262. }
  263. }
  264. </script>
  265. <style scoped>
  266. .content{
  267. min-height: 100vh;
  268. background: #F4F5F7;
  269. }
  270. .carLogo{
  271. width: 80rpx;height: 80rpx;
  272. }
  273. .top{
  274. padding: 24rpx;
  275. display: flex;
  276. background: #FFF;
  277. }
  278. .topRight{
  279. padding-left: 10rpx;
  280. display: flex;
  281. width: 600rpx;
  282. justify-content: space-between;
  283. }
  284. .brand{
  285. font-size: 30rpx;
  286. color: #1C1C1C;
  287. }
  288. .carModel{
  289. font-size: 26rpx;
  290. padding-top: 8rpx;
  291. color: #A5A5A5;
  292. }
  293. .lineRgihtIMg{
  294. width: 37rpx;
  295. height: 34rpx;
  296. }
  297. .lineRgihtIMg2{
  298. width: 31rpx;
  299. height: 35rpx;
  300. }
  301. .cont{
  302. margin-top: 20rpx;
  303. background: #FFF;
  304. }
  305. .line{
  306. display: flex;justify-content: space-between;
  307. padding: 20rpx;
  308. border-bottom: 1px solid #F4F5F7;
  309. }
  310. .lineLeft{
  311. display: flex;
  312. }
  313. .lineRgiht{
  314. display: flex;
  315. }
  316. .nameBox{
  317. padding-left: 24rpx;
  318. }
  319. .name{
  320. font-size: 30rpx;color: #1C1C1C;width: 650rpx;
  321. display: flex;justify-content: space-between;
  322. }
  323. .jingying{
  324. font-size: 26rpx;color: #A5A5A5;padding-top: 10rpx;
  325. width: 600rpx;
  326. overflow: hidden;
  327. text-overflow: ellipsis;
  328. white-space: nowrap;
  329. }
  330. .lineCK{
  331. display: flex;
  332. align-items: center;
  333. }
  334. .ckcarJtimg{
  335. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  336. }
  337. .ckcarlineBox{
  338. padding:24rpx ;
  339. border-bottom: 1px solid #EEEEEE;
  340. }
  341. .ckcarLeft{
  342. font-weight: 400;line-height: 36rpx;
  343. color: #1A1A1A;font-size: 26rpx;
  344. }
  345. .ckcarBox{
  346. width: 100vw;height: 100vh;
  347. background:rgba(0, 0, 0, 0.4) ;
  348. position: fixed;top: 0;left: 0;
  349. z-index: 111;
  350. }
  351. .ckcar{
  352. width: 750rpx;
  353. height: 772rpx;
  354. background: #FFFFFF;
  355. border-radius: 24rpx 24rpx 0rpx 0rpx;
  356. position: absolute;
  357. left: 0;
  358. bottom: 0;
  359. }
  360. .ckcarClose{
  361. width: 30rpx;height: 30rpx;
  362. }
  363. .ckcarTitle{
  364. font-weight: 500;font-size: 28rpx;
  365. color: #1A1A1A;
  366. line-height: 40rpx;
  367. }
  368. .ckcarTop{
  369. padding: 40rpx 26rpx 20rpx 24rpx;
  370. }
  371. .flex{
  372. display: flex;justify-content: space-between;
  373. }
  374. .ckcarClose{
  375. width: 30rpx;height: 30rpx;
  376. }
  377. .ckiMg{
  378. width: 40rpx;height: 40rpx;
  379. }
  380. .jtImg{
  381. width: 20rpx;height: 20rpx;
  382. margin-top: 30rpx;
  383. }
  384. .backImg{
  385. width: 44rpx;
  386. height: 44rpx;
  387. /* margin-left: 10rpx; */
  388. /* margin-right: 20rpx; */
  389. }
  390. .nav{
  391. height: 44px;
  392. display: flex;
  393. justify-content: space-between;
  394. align-items: center;
  395. border-bottom: 1px solid #eaeaea;
  396. }
  397. .goVin{
  398. width: 200rpx;
  399. color: #3F90F7;
  400. text-align: right;
  401. padding-right: 20rpx;
  402. }
  403. .navLeft{
  404. width: 200rpx;
  405. padding-left: 20rpx;
  406. }
  407. .navBox{
  408. position: fixed;
  409. left: 0;
  410. top: 0;
  411. z-index: 11;
  412. width: 100vw;
  413. background: #fff;
  414. }
  415. .qunfaBox{
  416. background: #FFFFFF;
  417. box-shadow: 0rpx -2rpx 20rpx 0rpx rgba(153,153,153,0.2);
  418. width: 750rpx;
  419. padding: 24rpx;
  420. position: fixed;
  421. left: 0;
  422. bottom: 0;
  423. display: flex;
  424. justify-content: center;
  425. }
  426. .qunfa{
  427. width: 602rpx;
  428. height: 74rpx;
  429. background: #3F90F7;
  430. border-radius: 8rpx;
  431. text-align: center;
  432. line-height: 74rpx;
  433. background: #3F90F7;
  434. font-weight: 500;
  435. font-size: 28rpx;
  436. color: #FEFFFE;
  437. border-radius: 10rpx;
  438. }
  439. </style>