orderItem.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <template>
  2. <view style="background-color: whitesmoke;">
  3. <view class="itemV content" v-for="(item,index) in orderList">
  4. <view class="contentInRowS">
  5. <text class="timeText">{{item.ddId}}</text>
  6. <text v-if="item.collectPayment==1" class="jiedanBtdf" style="font-size: 24rpx;">{{$t('index.huodaofukan')}}</text>
  7. </view>
  8. <view class="contentColumn">
  9. <view class="contentInRowL">
  10. <text class="titleText pnametext" style="margin-left:20rpx;">{{$t('order.peisongfei')}}: {{$formPr(item.freight)}}{{$t('api.huobidanwei')}}</text>
  11. </view>
  12. <view class="contentInRowR">
  13. <text class="priceText">{{$t('order.shangpinxj')}}: {{$formPr(item.amount)}}{{$t('api.huobidanwei')}}</text>
  14. </view>
  15. </view>
  16. <view v-if="item.activity" class="contentInRowL" style="margin-left:20rpx;">
  17. <text class="titleText pnametext">{{$t('index.youhuiq')}}:</text>
  18. <text class="titleText" style="padding-left: 20rpx;">{{item.activity.salesName}}</text>
  19. </view>
  20. <view style="width: 100%;margin-top: 20rpx;margin-left: 20rpx;" class="contentInRowL">
  21. <view style="width: 100rpx" class="contentColumn">
  22. <text class="quhuodian">{{$t('order.quhuodian')}}</text>
  23. <view class="lineimag">
  24. </view>
  25. </view>
  26. <view style="margin-left: 20rpx;width: 80%;" class="contentColumn">
  27. <view class="contentColumn">
  28. <text class="titleText pnametext">{{item.store.posName}}</text>
  29. <text class="distenText">({{$t('order.juli')}}{{item.qsjvli}}Km)</text>
  30. </view>
  31. <view>
  32. <text class="addrText">{{item.store.address}}</text>
  33. </view>
  34. <view >
  35. <text v-if="item.diningStatus==1" class="stateText">{{$t('order.shangjiayqrcc')}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <view v-if="item.shaddress!=null" style="margin-left: 20rpx;margin-top: 20rpx;" class="contentInRowL">
  40. <view style="width: 100rpx" class="contentColumn">
  41. <text class="shouhuodian">{{$t('order.shouhuodian')}}</text>
  42. </view>
  43. <view style="margin-left: 20rpx;width: 80%;" class="contentColumn" @click="openBimg(item.shaddress.annexes)">
  44. <view class="contentInRowL">
  45. <text class="titleText">{{item.shaddress.name}}</text>
  46. <text class="distenText">({{$t('order.juli')}}{{item.jvli}}Km)</text>
  47. </view>
  48. <text class="addrText">{{item.shaddress.address}}</text>
  49. <text v-if="item.remarks!=''" class="noteText">{{item.remarks}}</text>
  50. </view>
  51. </view>
  52. <view v-if="item.activity" class="contentColumnC psfnote">
  53. <text v-if="item.activity.salesType==0" class="addrText" style="color:white;padding: 6rpx;">{{$t('order.qishouyhts')}}</text>
  54. </view>
  55. <view class="contentInRowC" style="width: 100%;margin-top: 10rpx;">
  56. <view class="contentInRowC wanchengV" @click="jiedan(item)">
  57. <view class="wanchengT">{{$t('shouye.jieshoudd')}}</view>
  58. </view>
  59. </view>
  60. <view v-if="item.state==2||1" style="margin-bottom: 20rpx;margin-top: 20rpx;" class="contentInRowS">
  61. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="callPhone(item.shaddress.phone,item.user)">
  62. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="phone-filled" size="28"></uni-icons>
  63. <text class="jiedanText">{{$t('order.lianxi')}}</text>
  64. </view>
  65. <view class="contentColumnC" style="margin:20rpx;padding-right: 10rpx;" @click="gotoNav(item.shaddress)">
  66. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="navigate-filled" size="28"></uni-icons>
  67. <text class="jiedanText">Navigation</text>
  68. </view>
  69. <view class="contentColumnC" style="margin:20rpx;" @click="Exchange(item.ddId,item.user)">
  70. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="chatboxes" size="28"></uni-icons>
  71. <text class="jiedanText">{{$t('exchange.xinxi')}}</text>
  72. </view>
  73. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="imCall(item.ddId,item.user)">
  74. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="phone" size="28"></uni-icons>
  75. <text class="jiedanText">IM Call</text>
  76. </view>
  77. </view>
  78. </view>
  79. <uni-popup style="z-index: 9999;" ref="popNav" type="center" :isMaskClick="true" :safeArea="true">
  80. <disanfanfNav :lat="lat" :lon="lon" :cityName="addrName" v-on:ENavOpen="NavOpen"></disanfanfNav>
  81. </uni-popup>
  82. </view>
  83. </template>
  84. <script>
  85. import api from "@/pages/api/api.js"
  86. import {
  87. setorderuzt
  88. } from '@/pages/api/basic';
  89. export default {
  90. name:"orderItem",
  91. props:{
  92. orderList:'',
  93. qsId:''
  94. },
  95. data() {
  96. return {
  97. isAndroid:true,
  98. lat:0,
  99. lon:0,
  100. addrName:''
  101. };
  102. },
  103. mounted() {
  104. let systemInfo = uni.getSystemInfoSync();
  105. this.isAndroid = systemInfo.platform.toLowerCase() === 'android';
  106. },
  107. methods:{
  108. openBimg(mysrc){
  109. if(!mysrc){
  110. return;
  111. }
  112. if(mysrc.length<8){
  113. return;
  114. }
  115. console.log(mysrc);
  116. uni.navigateTo({
  117. url:'/pages/index/BigimageView?mysrc='+mysrc
  118. })
  119. },
  120. jiedan(obj){
  121. var online = getApp().globalData.isOnline;
  122. if(!online){
  123. uni.showToast({
  124. title: this.$t('user.xiaxianzh'),
  125. icon: 'none',
  126. duration: 2500
  127. })
  128. return;
  129. }
  130. if(this.qsId<=0 ||''==this.qsId){
  131. uni.showToast({
  132. title: this.$t('user.denglushixiao'),
  133. icon: 'none',
  134. duration: 2500
  135. })
  136. return;
  137. }
  138. var austate = getApp().globalData.auditStatus;
  139. if(austate!=1){
  140. uni.showToast({
  141. title: this.$t('user.zhanghaowsh'),
  142. icon: 'none',
  143. duration: 2500
  144. })
  145. return;
  146. }
  147. if(obj.collectPayment==1){
  148. var that = this;
  149. uni.showModal({
  150. title:that.$t('shouye.jieshoudd'),
  151. content:that.$t('index.jiedanfengx'),
  152. confirmText:that.$t('index.queren'),
  153. cancelText:that.$t('index.quxiao'),
  154. success: function (res) {
  155. if (res.confirm) { //这里是点击了确定以后
  156. that.setorderuzt(obj,3)
  157. //向商家推送通知
  158. that.pushMsg(obj);
  159. } else { //这里是点击了取消以后
  160. console.log('点击取消')
  161. }
  162. }
  163. })
  164. }
  165. else{
  166. this.setorderuzt(obj,3)
  167. }
  168. },
  169. pushMsg(obj){//消息推送
  170. if(obj.shanghu.cid==''||obj.shanghu.cid==null||obj.shanghu.cid==undefined){
  171. return;
  172. }
  173. api('pushMsgSJ',{
  174. cid:obj.shanghu.cid,
  175. title:'新订单|Lệnh mới',
  176. content:'你有新订单了|Anh có lệnh mới.',
  177. payload:''
  178. },res=>{
  179. console.log(res)
  180. },failc=>{
  181. //console.log('getadvertis----',failc)
  182. })
  183. },
  184. callPhone(telphone,user){
  185. var that = this;
  186. uni.showModal({
  187. title: that.$t('api.message'),
  188. content:that.$t('api.nqdbddh'),
  189. confirmText:that.$t('index.queren'),
  190. cancelText:that.$t('index.quxiao'),
  191. success: function (res) {
  192. if (res.confirm) { //这里是点击了确定以后
  193. console.log('打电话')
  194. plus.device.dial(telphone, false );
  195. } else { //这里是点击了取消以后
  196. console.log('点击取消')
  197. }
  198. }
  199. })
  200. },
  201. imCall(ddid,user){
  202. var data = {
  203. ddId:ddid,
  204. userId:user.userId,
  205. nickName:user.nickName,
  206. avatar:user.avatar,
  207. cid:user.cid
  208. }
  209. uni.setStorageSync('imUser',data);
  210. uni.navigateTo({
  211. url:'/pages/imcall/audioCall?caller=1'
  212. })
  213. },
  214. Exchange(ddid,user){
  215. var data = {
  216. ddId:ddid,
  217. userId:user.userId,
  218. nickName:user.nickName,
  219. avatar:user.avatar,
  220. cid:user.cid
  221. }
  222. uni.setStorageSync('imUser',data);
  223. uni.navigateTo({
  224. url:'/pages/imcall/GoeasyExchange?caller=1'
  225. })
  226. },
  227. setorderuzt(obj,state,){
  228. var that = this;
  229. var data;
  230. if(obj.collectPayment==1){
  231. data={
  232. id:obj.id,
  233. state:state,
  234. qsId:this.qsId,
  235. collectPayment:obj.collectPayment
  236. }
  237. }
  238. else{
  239. data={
  240. id:obj.id,
  241. state:state,
  242. qsId:this.qsId
  243. }
  244. }
  245. uni.showLoading({
  246. title:'Loading...',
  247. mask:true
  248. })
  249. this.$http.post(`${setorderuzt}`,data,true)
  250. .then(r => {
  251. uni.hideLoading();
  252. console.log(r);
  253. if(r.data.code==500){
  254. uni.showToast({
  255. title: r.data.msg,
  256. icon: 'none',
  257. duration: 2500
  258. })
  259. return;
  260. }
  261. this.$emit('ErefleshList');
  262. })
  263. .catch(err => {
  264. uni.hideLoading();
  265. console.log(err)
  266. })
  267. },
  268. gotoNav(store){
  269. this.lat = store.latitude;
  270. this.lon = store.longitude;
  271. this.addrName = store.address;
  272. this.$refs.popNav.open('center');
  273. return;
  274. var navData={
  275. latitude:store.latitude,
  276. longitude:store.longitude,
  277. address:store.address
  278. }
  279. var temp = JSON.stringify(navData);
  280. uni.navigateTo({
  281. url:'/pages/map/mapboxView?navdata='+temp
  282. })
  283. // if(this.isAndroid){
  284. // this.handlePosition(store.latitude,store.longitude,store.address);
  285. // }
  286. // else{
  287. // var temp = JSON.stringify(navData);
  288. // uni.navigateTo({
  289. // url:'/pages/map/mapboxView?navdata='+temp
  290. // })
  291. // }
  292. },
  293. NavOpen(){
  294. this.$refs.popNav.close();
  295. },
  296. handlePosition(lat,lon,cityName) {
  297. //如果是Andrios的设备
  298. if (plus.os.name == 'Android') {
  299. console.log('Android')
  300. const hasBaiduMap = plus.runtime.isApplicationExist({
  301. pname: 'com.baidu.BaiduMap',
  302. action: 'baidumap://'
  303. });
  304. const hasAmap = plus.runtime.isApplicationExist({
  305. pname: 'com.autonavi.minimap',
  306. action: 'androidamap://'
  307. });
  308. const hasgoogle = plus.runtime.isApplicationExist({
  309. pname: 'com.google.android.apps.maps',
  310. action: 'comgooglemaps://'
  311. });
  312. //重点是下面的url要根据官方给出的api进行对应,不同的需求对应不同的api
  313. let urlBaiduMap =
  314. 'baidumap://map/direction?region=起点&destination='+lat+','+lon+'&coord_type=wgs84&mode=riding&src=andr.paotuiwang.qishou';
  315. urlBaiduMap = encodeURI(urlBaiduMap)
  316. let urlAmap =
  317. 'androidamap://viewMap?sourceApplication=appname&poiname='+cityName+'&lat='+lat+'&lon='+lon+'&dev=1';
  318. urlAmap = encodeURI(urlAmap)
  319. var buttons=[];
  320. if(hasBaiduMap){
  321. buttons.push({
  322. title: this.$t('user.baiduNav'),
  323. value:urlBaiduMap
  324. })
  325. }
  326. if(hasAmap){
  327. buttons.push({
  328. title: this.$t('user.gaodeNav'),
  329. value:urlAmap
  330. })
  331. }
  332. // if(hasgoogle){
  333. // buttons.push({title: this.$t('user.googleNav')})
  334. // }
  335. if(buttons.length==0){
  336. if(hasgoogle){
  337. var url = 'google.navigation:q=' + lat + ',' + lon; //如果是国外应用,应该优先使用这个,会启动google地图。这个接口不能统一坐标系,进入百度地图时会有偏差
  338. plus.runtime.openURL(url);
  339. return;
  340. }
  341. }
  342. plus.nativeUI.actionSheet({
  343. title: this.$t('user.xuanzedaoh'),
  344. cancel: this.$t('index.quxiao'),
  345. buttons: buttons
  346. }, function(e) {
  347. plus.runtime.openURL(buttons[e.index-1].value);
  348. });
  349. } else {
  350. // iOS上获取本机是否安装了百度高德地图,需要在manifest里配置,在manifest.json文件app-plus->distribute->apple->urlschemewhitelist节点下添加(如urlschemewhitelist:["iosamap","baidumap"])
  351. var url='';
  352. var that = this;
  353. plus.nativeUI.actionSheet({
  354. title: this.$t('user.xuanzedaoh'),
  355. cancel: this.$t('index.quxiao'),
  356. buttons: [{
  357. title: this.$t('user.baiduNav')
  358. },{
  359. title: this.$t('user.gaodeNav')
  360. },{
  361. title: this.$t('user.googleNav')
  362. },{
  363. title: this.$t('user.appleNav')
  364. }]
  365. }, function(e) {
  366. switch (e.index) {
  367. case 1:
  368. url ='baidumap://map/marker?location='+lat+','+lon+'&title='+cityName+'&content='+cityName+'&coord_type=wgs84&src=ios.baidu.openAPIdemo';
  369. break;
  370. case 2:
  371. url ='iosamap://path?sourceApplication=fuxishan_uni_client&dlat='+lat+'&dlon='+lon+'&dname='+cityName+'&dev=1&t=0';
  372. break;
  373. case 3:
  374. url='comgooglemapsurl://?daddr='+ lat + ',' + lon;
  375. break;
  376. case 4:
  377. url = 'http://maps.apple.com/?q=' +cityName + '&ll=' + lat + ',' + lon + '&spn=0.008766,0.019441';
  378. break;
  379. default:
  380. break;
  381. }
  382. if (url!='') {
  383. url = encodeURI(url)
  384. plus.runtime.openURL(url, function(e) {
  385. plus.nativeUI.alert(that.$t('user.weianzhuangapp'));
  386. });
  387. }
  388. })
  389. }
  390. },
  391. },
  392. }
  393. </script>
  394. <style>
  395. @import '@/common/common.scss';
  396. @font-face {
  397. font-family: zrht;
  398. src: url('/uni_modules/font/zrht.otf');
  399. }
  400. .itemV{
  401. margin-top: 16rpx;
  402. background-color: white;
  403. }
  404. .psfnote{
  405. width: 92%;
  406. margin-left: 4%;
  407. margin-top: 5rpx;
  408. border-radius: 10rpx;
  409. background-color: crimson;
  410. }
  411. .qiangdImg{
  412. width: 120rpx;
  413. height: 120rpx;
  414. }
  415. .quhuodian{
  416. font-size: 26rpx;
  417. padding: 8rpx;
  418. color: royalblue;
  419. border-radius: 16rpx;
  420. border: solid royalblue;
  421. }
  422. .shouhuodian{
  423. font-size: 26rpx;
  424. padding: 8rpx;
  425. color: crimson;
  426. border-radius: 16rpx;
  427. border: solid crimson;
  428. }
  429. .lineimag{
  430. display: flex;
  431. flex-direction: column;
  432. justify-content: space-between;
  433. margin-left: 45rpx;
  434. width: 4rpx;
  435. background-color: lightgray;
  436. height: 100rpx;
  437. margin-top: 4rpx;
  438. margin-bottom: 4rpx;
  439. }
  440. .yuandian{
  441. width: 16rpx;
  442. height: 16rpx;
  443. background-color: lightgray;
  444. border-radius: 8rpx;
  445. margin-left: -8rpx;
  446. }
  447. .timeText{
  448. font-size: 32rpx;
  449. color: #006AFF;
  450. padding-left: 20rpx;
  451. font-weight: bold;
  452. }
  453. .priceText{
  454. font-size: 30rpx;
  455. color: crimson;
  456. padding-right: 20rpx;
  457. }
  458. .titleText{
  459. font-size: 28rpx;
  460. /* font-family: zrht; */
  461. }
  462. .pnametext{
  463. overflow: hidden;
  464. text-overflow: ellipsis;
  465. display: -webkit-box;
  466. -webkit-line-clamp: 1;
  467. -webkit-box-orient: vertical;
  468. }
  469. .distenText{
  470. font-size: 30rpx;
  471. color: darkgray;
  472. }
  473. .addrText{
  474. font-size: 28rpx;
  475. color: dimgray;
  476. }
  477. .stateText{
  478. font-size: 28rpx;
  479. color: darkgray;
  480. margin-top: 6rpx;
  481. padding-left: 8rpx;
  482. padding-right: 8rpx;
  483. padding-top: 2rpx;
  484. padding-bottom: 2rpx;
  485. border: 2rpx solid darkgray;
  486. border-radius: 8rpx;
  487. }
  488. .noteText{
  489. margin-top: 16rpx;
  490. font-size: 28rpx;
  491. color: dimgray;
  492. padding: 8rpx;
  493. background-color: whitesmoke;
  494. border-radius: 8rpx;
  495. }
  496. .connectText{
  497. font-size: 28rpx;
  498. color: black;
  499. margin-top: 6rpx;
  500. padding-left: 8rpx;
  501. padding-right: 8rpx;
  502. padding-top: 2rpx;
  503. padding-bottom: 2rpx;
  504. border: 2rpx solid darkgray;
  505. border-radius: 8rpx;
  506. }
  507. .setImg{
  508. width: 30rpx;
  509. height: 30rpx;
  510. }
  511. .setImgB{
  512. width: 40rpx;
  513. height: 40rpx;
  514. }
  515. .jiedanText{
  516. font-size: 24rpx;
  517. color: black;
  518. }
  519. .jiedanTextS{
  520. font-size: 20rpx;
  521. color: black;
  522. }
  523. .wanchengV{
  524. width: 80%;
  525. height: 68rpx;
  526. border-radius: 10rpx;
  527. margin-top: 40rpx;
  528. margin-bottom: 20rpx;
  529. background-color: #006AFF;
  530. }
  531. .shuaxinBT{
  532. font-weight: bold;
  533. font-size: 30rpx;
  534. color: black;
  535. border-radius: 8rpx;
  536. padding: 6rpx;
  537. margin-right: 30rpx;
  538. }
  539. .wanchengT{
  540. width: 100%;
  541. font-weight: bold;
  542. font-size: 26rpx;
  543. color: white;
  544. border-radius: 8rpx;
  545. text-align: center;
  546. }
  547. .jiedanBt{
  548. padding: 10rpx;
  549. color:white;
  550. background-color: #00A6FF;
  551. border-radius: 8rpx;
  552. box-shadow: 0rpx 0rpx 10rpx 0rpx #00A6FF;
  553. }
  554. .jiedanBtdf{
  555. padding: 10rpx;
  556. color:white;
  557. background-color: #1A1A1A;
  558. border-radius: 8rpx;
  559. box-shadow: 0rpx 0rpx 2rpx 0rpx #1A1A1A;
  560. }
  561. </style>