ck.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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" @click="ckItem(item)">
  30. <view class="lineCK">
  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">{{item.supplierName}}
  36. <view class="lineRgiht">
  37. <view>
  38. <image @click="goIm(item)" class="lineRgihtIMg" src="/static/img/xiaoxi.png" mode=""></image>
  39. </view>
  40. <view style="padding-left: 40rpx;">
  41. <image @click="call(item.mobilePhone)" 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. uni.makePhoneCall({
  160. phoneNumber: num
  161. })
  162. },
  163. gobyItem(item){
  164. item.supplierlist.forEach(item=>{
  165. item.ck=true
  166. })
  167. this.info= JSON.parse(JSON.stringify(item)) ;
  168. uni.setStorageSync('carModelInfo',this.info.carModelInfo )
  169. this.ckCarShow=false
  170. },
  171. ckcarClose(){
  172. this.ckCarShow=false;
  173. },
  174. qunfa(){
  175. var supplierlist=[]
  176. this.info.supplierlist.forEach(item=>{
  177. if(item.ck){
  178. supplierlist.push(item)
  179. }
  180. })
  181. uni.setStorageSync('supplierlist', supplierlist);
  182. uni.navigateTo({
  183. url:'qunfa?nLevelIDs='+this.info.carModelInfo.nLevelID+'&vin='+this.vin
  184. })
  185. },
  186. goIm(item){
  187. uni.setStorage({
  188. key: 'friend',
  189. data: item,
  190. success: function () {
  191. uni.navigateTo({
  192. url: './privateChat?to=' + item.id
  193. });
  194. }
  195. });
  196. },
  197. vinSupplier(){
  198. this.$http('imSys/vinSupplier', {
  199. vin:this.vin,
  200. },'GET').then(res => {
  201. console.log(res.data.length)
  202. //this.info=res.data[0]
  203. if(res.data.length>1){
  204. this.ckCarShow=true
  205. this.moreVinList=res.data
  206. console.log(this.moreVinList)
  207. }else{
  208. res.data[0].supplierlist.forEach(item=>{
  209. item.ck=true
  210. })
  211. this.info=res.data[0]
  212. //this.info
  213. uni.setStorageSync('carModelInfo',this.info.carModelInfo )
  214. }
  215. })
  216. },
  217. imLoginUrl(){
  218. this.$http('imSys/imLoginUrl', {
  219. token:this.token,
  220. },'POST').then(res => {
  221. // console.log(res)
  222. var users={
  223. userId:res.data.userId,
  224. name:res.data.users.name,
  225. avatar:'',
  226. id:res.data.userId,
  227. }
  228. this.currentUser=users
  229. this.connectGoEasy()
  230. uni.setStorageSync('users', users);
  231. })
  232. },
  233. connectGoEasy(){
  234. console.log(this.currentUser)
  235. //this.currentUser.id="1292F5DA-793B-4549-844E-C5F606869D0C"
  236. uni.setStorageSync('currentUser', this.currentUser);
  237. GoEasy.connect({
  238. id: this.currentUser.id,
  239. data: {
  240. name: this.currentUser.name,
  241. avatar: this.currentUser.avatar
  242. },
  243. onSuccess: () => {
  244. console.log('GoEasy connect successfully.')
  245. },
  246. onFailed: (error) => {
  247. console.log('Failed to connect GoEasy, code:' + error.code + ',error:' + error.content);
  248. },
  249. onProgress: (attempts) => {
  250. console.log('GoEasy is connecting', attempts);
  251. }
  252. });
  253. }
  254. }
  255. }
  256. </script>
  257. <style scoped>
  258. .content{
  259. min-height: 100vh;
  260. background: #F4F5F7;
  261. }
  262. .carLogo{
  263. width: 80rpx;height: 80rpx;
  264. }
  265. .top{
  266. padding: 24rpx;
  267. display: flex;
  268. background: #FFF;
  269. }
  270. .topRight{
  271. padding-left: 10rpx;
  272. display: flex;
  273. width: 600rpx;
  274. justify-content: space-between;
  275. }
  276. .brand{
  277. font-size: 30rpx;
  278. color: #1C1C1C;
  279. }
  280. .carModel{
  281. font-size: 26rpx;
  282. padding-top: 8rpx;
  283. color: #A5A5A5;
  284. }
  285. .lineRgihtIMg{
  286. width: 37rpx;
  287. height: 34rpx;
  288. }
  289. .lineRgihtIMg2{
  290. width: 31rpx;
  291. height: 35rpx;
  292. }
  293. .cont{
  294. margin-top: 20rpx;
  295. background: #FFF;
  296. }
  297. .line{
  298. display: flex;justify-content: space-between;
  299. padding: 20rpx;
  300. border-bottom: 1px solid #F4F5F7;
  301. }
  302. .lineLeft{
  303. display: flex;
  304. }
  305. .lineRgiht{
  306. display: flex;
  307. }
  308. .nameBox{
  309. padding-left: 24rpx;
  310. }
  311. .name{
  312. font-size: 30rpx;color: #1C1C1C;width: 650rpx;
  313. display: flex;justify-content: space-between;
  314. }
  315. .jingying{
  316. font-size: 26rpx;color: #A5A5A5;padding-top: 10rpx;
  317. }
  318. .lineCK{
  319. display: flex;
  320. align-items: center;
  321. }
  322. .ckcarJtimg{
  323. width: 26rpx;height: 26rpx;margin-top: 4rpx;
  324. }
  325. .ckcarlineBox{
  326. padding:24rpx ;
  327. border-bottom: 1px solid #EEEEEE;
  328. }
  329. .ckcarLeft{
  330. font-weight: 400;line-height: 36rpx;
  331. color: #1A1A1A;font-size: 26rpx;
  332. }
  333. .ckcarBox{
  334. width: 100vw;height: 100vh;
  335. background:rgba(0, 0, 0, 0.4) ;
  336. position: fixed;top: 0;left: 0;
  337. z-index: 111;
  338. }
  339. .ckcar{
  340. width: 750rpx;
  341. height: 772rpx;
  342. background: #FFFFFF;
  343. border-radius: 24rpx 24rpx 0rpx 0rpx;
  344. position: absolute;
  345. left: 0;
  346. bottom: 0;
  347. }
  348. .ckcarClose{
  349. width: 30rpx;height: 30rpx;
  350. }
  351. .ckcarTitle{
  352. font-weight: 500;font-size: 28rpx;
  353. color: #1A1A1A;
  354. line-height: 40rpx;
  355. }
  356. .ckcarTop{
  357. padding: 40rpx 26rpx 20rpx 24rpx;
  358. }
  359. .flex{
  360. display: flex;justify-content: space-between;
  361. }
  362. .ckcarClose{
  363. width: 30rpx;height: 30rpx;
  364. }
  365. .ckiMg{
  366. width: 40rpx;height: 40rpx;
  367. }
  368. .jtImg{
  369. width: 20rpx;height: 20rpx;
  370. margin-top: 30rpx;
  371. }
  372. .backImg{
  373. width: 44rpx;
  374. height: 44rpx;
  375. /* margin-left: 10rpx; */
  376. /* margin-right: 20rpx; */
  377. }
  378. .nav{
  379. height: 44px;
  380. display: flex;
  381. justify-content: space-between;
  382. align-items: center;
  383. border-bottom: 1px solid #eaeaea;
  384. }
  385. .goVin{
  386. width: 200rpx;
  387. color: #3F90F7;
  388. text-align: right;
  389. padding-right: 20rpx;
  390. }
  391. .navLeft{
  392. width: 200rpx;
  393. padding-left: 20rpx;
  394. }
  395. .navBox{
  396. position: fixed;
  397. left: 0;
  398. top: 0;
  399. z-index: 11;
  400. width: 100vw;
  401. }
  402. .qunfaBox{
  403. background: #FFFFFF;
  404. box-shadow: 0rpx -2rpx 20rpx 0rpx rgba(153,153,153,0.2);
  405. width: 750rpx;
  406. padding: 24rpx;
  407. position: fixed;
  408. left: 0;
  409. bottom: 0;
  410. display: flex;
  411. justify-content: center;
  412. }
  413. .qunfa{
  414. width: 602rpx;
  415. height: 74rpx;
  416. background: #3F90F7;
  417. border-radius: 8rpx;
  418. text-align: center;
  419. line-height: 74rpx;
  420. background: #3F90F7;
  421. font-weight: 500;
  422. font-size: 28rpx;
  423. color: #FEFFFE;
  424. border-radius: 10rpx;
  425. }
  426. </style>