orderItem.vue 15 KB

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