ck.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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.imLoginUrl()
  109. // this.vinSupplier()
  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.redirectTo({
  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. if(res.code!=0){
  230. uni.showModal({
  231. title: '提示',
  232. content: res.msg,
  233. showCancel:false,
  234. success: function (res) {
  235. if (res.confirm) {
  236. console.log('用户点击确定');
  237. } else if (res.cancel) {
  238. console.log('用户点击取消');
  239. }
  240. }
  241. });
  242. return false
  243. }
  244. // console.log(res)
  245. var users={
  246. userId:res.data.userId,
  247. name:res.data.users.name,
  248. avatar:'',
  249. id:res.data.userId,
  250. }
  251. this.currentUser=users
  252. this.connectGoEasy()
  253. uni.setStorageSync('users', users);
  254. })
  255. },
  256. connectGoEasy(){
  257. console.log(this.currentUser)
  258. //this.currentUser.id="1292F5DA-793B-4549-844E-C5F606869D0C"
  259. uni.setStorageSync('currentUser', this.currentUser);
  260. GoEasy.connect({
  261. id: this.currentUser.id,
  262. data: {
  263. name: this.currentUser.name,
  264. avatar: this.currentUser.avatar
  265. },
  266. onSuccess: () => {
  267. this.vinSupplier()
  268. console.log('GoEasy connect successfully.')
  269. },
  270. onFailed: (error) => {
  271. // this.vinSupplier()
  272. console.log('Failed to connect GoEasy, code:' + error.code + ',error:' + error.content);
  273. },
  274. onProgress: (attempts) => {
  275. console.log('GoEasy is connecting', attempts);
  276. }
  277. });
  278. }
  279. }
  280. }
  281. </script>
  282. <style scoped>
  283. .content{
  284. min-height: 100vh;
  285. background: #F4F5F7;
  286. }
  287. .carLogo{
  288. width: 80rpx;height: 80rpx;
  289. }
  290. .top{
  291. padding: 24rpx;
  292. display: flex;
  293. background: #FFF;
  294. }
  295. .topRight{
  296. padding-left: 10rpx;
  297. display: flex;
  298. width: 600rpx;
  299. justify-content: space-between;
  300. }
  301. .brand{
  302. font-size: 30rpx;
  303. color: #1C1C1C;
  304. }
  305. .carModel{
  306. font-size: 26rpx;
  307. padding-top: 8rpx;
  308. color: #A5A5A5;
  309. }
  310. .lineRgihtIMg{
  311. width: 37rpx;
  312. height: 34rpx;
  313. }
  314. .lineRgihtIMg2{
  315. width: 31rpx;
  316. height: 35rpx;
  317. }
  318. .cont{
  319. margin-top: 20rpx;
  320. background: #FFF;
  321. }
  322. .line{
  323. display: flex;justify-content: space-between;
  324. padding: 20rpx;
  325. border-bottom: 1px solid #F4F5F7;
  326. }
  327. .lineLeft{
  328. display: flex;
  329. }
  330. .lineRgiht{
  331. display: flex;
  332. }
  333. .nameBox{
  334. padding-left: 24rpx;
  335. }
  336. .name{
  337. font-size: 30rpx;color: #1C1C1C;width: 650rpx;
  338. display: flex;justify-content: space-between;
  339. }
  340. .jingying{
  341. font-size: 26rpx;color: #A5A5A5;padding-top: 10rpx;
  342. width: 600rpx;
  343. overflow: hidden;
  344. text-overflow: ellipsis;
  345. white-space: nowrap;
  346. }
  347. .lineCK{
  348. display: flex;
  349. align-items: center;
  350. }
  351. .ckcarJtimg{
  352. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  353. }
  354. .ckcarlineBox{
  355. padding:24rpx ;
  356. border-bottom: 1px solid #EEEEEE;
  357. }
  358. .ckcarLeft{
  359. font-weight: 400;line-height: 36rpx;
  360. color: #1A1A1A;font-size: 26rpx;
  361. }
  362. .ckcarBox{
  363. width: 100vw;height: 100vh;
  364. background:rgba(0, 0, 0, 0.4) ;
  365. position: fixed;top: 0;left: 0;
  366. z-index: 111;
  367. }
  368. .ckcar{
  369. width: 750rpx;
  370. height: 772rpx;
  371. background: #FFFFFF;
  372. border-radius: 24rpx 24rpx 0rpx 0rpx;
  373. position: absolute;
  374. left: 0;
  375. bottom: 0;
  376. }
  377. .ckcarClose{
  378. width: 30rpx;height: 30rpx;
  379. }
  380. .ckcarTitle{
  381. font-weight: 500;font-size: 28rpx;
  382. color: #1A1A1A;
  383. line-height: 40rpx;
  384. }
  385. .ckcarTop{
  386. padding: 40rpx 26rpx 20rpx 24rpx;
  387. }
  388. .flex{
  389. display: flex;justify-content: space-between;
  390. }
  391. .ckcarClose{
  392. width: 30rpx;height: 30rpx;
  393. }
  394. .ckiMg{
  395. width: 40rpx;height: 40rpx;
  396. }
  397. .jtImg{
  398. width: 20rpx;height: 20rpx;
  399. margin-top: 30rpx;
  400. }
  401. .backImg{
  402. width: 44rpx;
  403. height: 44rpx;
  404. /* margin-left: 10rpx; */
  405. /* margin-right: 20rpx; */
  406. }
  407. .nav{
  408. height: 44px;
  409. display: flex;
  410. justify-content: space-between;
  411. align-items: center;
  412. border-bottom: 1px solid #eaeaea;
  413. }
  414. .goVin{
  415. width: 200rpx;
  416. color: #3F90F7;
  417. text-align: right;
  418. padding-right: 20rpx;
  419. }
  420. .navLeft{
  421. width: 200rpx;
  422. padding-left: 20rpx;
  423. }
  424. .navBox{
  425. position: fixed;
  426. left: 0;
  427. top: 0;
  428. z-index: 11;
  429. width: 100vw;
  430. background: #fff;
  431. }
  432. .qunfaBox{
  433. background: #FFFFFF;
  434. box-shadow: 0rpx -2rpx 20rpx 0rpx rgba(153,153,153,0.2);
  435. width: 750rpx;
  436. padding: 24rpx;
  437. position: fixed;
  438. left: 0;
  439. bottom: 0;
  440. display: flex;
  441. justify-content: center;
  442. }
  443. .qunfa{
  444. width: 602rpx;
  445. height: 74rpx;
  446. background: #3F90F7;
  447. border-radius: 8rpx;
  448. text-align: center;
  449. line-height: 74rpx;
  450. background: #3F90F7;
  451. font-weight: 500;
  452. font-size: 28rpx;
  453. color: #FEFFFE;
  454. border-radius: 10rpx;
  455. }
  456. </style>