orderItemA.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. <template>
  2. <view style="background-color: whitesmoke;">
  3. <view v-if="orderList!=''">
  4. <view class="itemV content" v-for="(item,index) in orderList">
  5. <view class="contentInRowS">
  6. <text class="timeText">{{item.ddId}}</text>
  7. <text v-if="item.collectPayment==1" class="jiedanBtdf" style="font-size: 24rpx;">{{$t('index.huodaofukan')}}</text>
  8. </view>
  9. <view class="contentColumn">
  10. <view class="contentInRowL">
  11. <text class="titleText pnametext" style="margin-left:20rpx;">{{$t('order.peisongfei')}}: {{$formPr(item.freight)}}{{$t('api.huobidanwei')}}</text>
  12. </view>
  13. <view class="contentInRowR">
  14. <text class="priceText">{{$t('order.shangpinxj')}}: {{shphj(item)}}</text>
  15. </view>
  16. </view>
  17. <view v-if="item.activity" class="contentInRowL" style="margin-left:20rpx;">
  18. <text class="titleText">{{$t('index.youhuiq')}}:</text>
  19. <text class="titleText" style="padding-left: 20rpx;">{{item.activity.salesName}}</text>
  20. </view>
  21. <view style="width: 100%;margin-top: 20rpx;margin-left: 20rpx;" class="contentInRowL">
  22. <view style="width: 100rpx" class="contentColumn">
  23. <text class="quhuodian">{{$t('order.quhuodian')}}</text>
  24. </view>
  25. <view style="margin-left: 20rpx;width: 100%;" class="contentColumn">
  26. <view v-if="item.store" class="" @click="gotoNav(item.store)">
  27. <view class="contentColumn">
  28. <text class="titleText">{{item.store.posName}}</text>
  29. <!-- <text class="distenText">({{$t('order.juli')}}{{item.qsjvli}})</text> -->
  30. </view>
  31. <view style="width: 94%;">
  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 v-for="(itemf,index) in item.food" style="width: 100%;">
  39. <view class="contentInRowL" style="margin-top: 12rpx;width: 90%;">
  40. <myImage class="spIcon" :mysrc="itemf.image" mymode="scaleToFill" ></myImage>
  41. <view class="contentColumn" style="margin-left: 10rpx;width: 78%;">
  42. <text class="addrText">{{itemf.name}}</text>
  43. <view class="contentInRowS">
  44. <view class="contentInRowL ">
  45. <text class="kouweisku" v-for="sku in itemf.ask">{{sku}}</text>
  46. </view>
  47. <text class="addrText">{{itemf.number}}(份)</text>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view v-if="item.activity" class="contentColumnC psfnote">
  55. <text v-if="item.activity.salesType==0" class="addrText" style="color:white;padding: 6rpx;">{{$t('order.qishouyhts')}}</text>
  56. </view>
  57. <view v-if="item.collectPayment==1" class="contentColumnC psfnote" style="background-color: darkgreen;">
  58. <text class="addrText" style="color:white;padding: 6rpx;">{{$t('order.qiszhifts')}}</text>
  59. </view>
  60. <view class="contentInRowS" style="margin-top: 10rpx;">
  61. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="callPhone(item.store.telephone,item.store)">
  62. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="phone-filled" size="28"></uni-icons>
  63. <label class="jiedanText">{{$t('order.lianxi')}}</label>
  64. </view>
  65. <view class="contentColumnC" style="margin:20rpx;padding-right: 10rpx;" @click="gotoNav(item.store)">
  66. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="navigate-filled" size="28"></uni-icons>
  67. <label class="jiedanText">Navigation</label>
  68. </view>
  69. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="qucanshibai(item)">
  70. <uni-icons custom-prefix="custom-icon" color="crimson" type="closeempty" size="28"></uni-icons>
  71. <label class="jiedanText">{{$t('order.qucanshib')}}</label>
  72. </view>
  73. <view class="contentColumnC" style="margin:20rpx;padding-left: 10rpx;" @click="quchan(item)">
  74. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="checkmarkempty" size="28"></uni-icons>
  75. <label class="jiedanText">{{$t('order.wanchengquhuo')}}</label>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <uni-popup style="z-index: 9999;" ref="popqc" type="center" :isMaskClick="true" :safeArea="true">
  81. <view class="contentColumn" style="width:600rpx;background-color: whitesmoke;border-radius: 10rpx;">
  82. <view class="item_list">
  83. <view class="item_content" v-for="(itemi,indexi) in annexList" @click="imagesel(indexi)">
  84. <netImage v-if="itemi!=''" width="180" height="180" bradius="4" :mysrc="itemi" mymode="scaleToFill" ></netImage>
  85. </view>
  86. <view class="item_content" @click="updataImage">
  87. <image class="upimagV" src="/static/imags/shangctp.png" mode="scaleToFill"></image>
  88. </view>
  89. </view>
  90. <view class="contentInRowC">
  91. <text class="actbttext" style="background-color:rosybrown;" @click="quxiaoqc">{{$t('index.quxiao')}}</text>
  92. <text class="actbttext" style="background-color:#006Aff;" @click="querenqucan">{{$t('order.wanchengquhuo')}}</text>
  93. </view>
  94. </view>
  95. </uni-popup>
  96. <uni-popup style="z-index: 9999;" ref="popNav" type="center" :isMaskClick="true" :safeArea="true">
  97. <disanfanfNav :lat="lat" :lon="lon" :cityName="addrName" v-on:ENavOpen="NavOpen"></disanfanfNav>
  98. </uni-popup>
  99. </view>
  100. </template>
  101. <script>
  102. import {
  103. UploadImage,
  104. setorderuzt
  105. } from '@/pages/api/basic';
  106. export default {
  107. name:"orderItem",
  108. props:{
  109. orderList:'',
  110. qsId:''
  111. },
  112. data() {
  113. return {
  114. isAndroid:true,
  115. annexList:[],
  116. actId:'',
  117. lat:0,
  118. lon:0,
  119. addrName:''
  120. };
  121. },
  122. mounted() {
  123. let systemInfo = uni.getSystemInfoSync();
  124. this.isAndroid = systemInfo.platform.toLowerCase() === 'android';
  125. },
  126. methods:{
  127. shphj(obj){
  128. console.log(obj)
  129. var jinr=0;
  130. var yunfei = 0;
  131. if(obj.type==0){
  132. yunfei=obj.freight;
  133. }
  134. if(obj.activity){
  135. if(obj.activity.salesType=="0"){
  136. if(obj.discountAmount){
  137. if(yunfei>obj.discountAmount){
  138. jinr=obj.amount-(yunfei-obj.discountAmount);
  139. }
  140. else{
  141. jinr =obj.amount-yunfei;
  142. }
  143. }else{
  144. jinr =obj.amount-yunfei;
  145. }
  146. }
  147. else{
  148. jinr =obj.amount-yunfei;
  149. }
  150. }
  151. else{
  152. jinr =obj.amount-yunfei;
  153. }
  154. jinr=parseInt(jinr);
  155. return this.$formPr(jinr)+this.$t('api.huobidanwei');
  156. },
  157. qucanshibai(obj){
  158. var that = this;
  159. uni.showModal({
  160. title: that.$t('api.message'),
  161. content:that.$t('order.qrqucanshib'),
  162. confirmText:that.$t('index.queren'),
  163. cancelText:that.$t('index.quxiao'),
  164. success: function (res) {
  165. if (res.confirm) { //这里是点击了确定以后
  166. that.setorderuzt(obj.id,9)
  167. } else { //这里是点击了取消以后
  168. console.log('点击取消')
  169. }
  170. }
  171. })
  172. },
  173. quchan(obj){
  174. console.log('quchan');
  175. this.actId=obj.id;
  176. if(obj.sqImg){
  177. this.annexList=JSON.parse(obj.sqImg);
  178. }
  179. else{
  180. this.annexList=[];
  181. }
  182. this.$refs.popqc.open('center');
  183. },
  184. querenqucan(){
  185. //还要同步上传图片
  186. if(this.annexList.length==0){
  187. uni.showToast({
  188. title:this.$t('order.qingxiansctp'),
  189. icon: 'none',
  190. duration: 2500
  191. })
  192. return;
  193. }
  194. this.$refs.popqc.close();
  195. var data={
  196. id:this.actId,
  197. state:4,
  198. //qsId:this.qsId,
  199. diningStatus:1,
  200. qsImg:JSON.stringify(this.annexList)
  201. }
  202. console.log(data)
  203. this.$http.post(`${setorderuzt}`,data,true)
  204. .then(r => {
  205. console.log(r);
  206. this.$emit('ErefleshList');
  207. })
  208. .catch(err => {
  209. console.log(err)
  210. })
  211. },
  212. quxiaoqc(){
  213. this.$refs.popqc.close();
  214. },
  215. imagesel(index){
  216. },
  217. updataImage(){
  218. var that = this;
  219. uni.showModal({
  220. title: that.$t('api.message'),
  221. content:that.$t('order.qingxuanz'),
  222. confirmText:that.$t('order.qupaishe'),
  223. cancelText:that.$t('order.qushangc'),
  224. success: function (res) {
  225. if (res.confirm) { //这里是点击了确定以后
  226. that.getimage(2);
  227. } else { //这里是点击了取消以后
  228. console.log('点击取消')
  229. that.getimage(1)
  230. }
  231. }
  232. })
  233. },
  234. getimage(state){
  235. var sourceType=[];
  236. if(state==1){
  237. sourceType=['album']
  238. }
  239. else{
  240. sourceType=['camera']
  241. }
  242. var that = this;
  243. uni.chooseImage({
  244. count: 1, // 图片数量
  245. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  246. sourceType:sourceType, //从相册选择或者拍照
  247. success: (res) => {
  248. const tempFilePaths = res.tempFilePaths;
  249. uni.uploadFile({
  250. url: that.$baseurl+UploadImage, //上传图片api
  251. filePath: tempFilePaths[0],
  252. name: 'file',
  253. header:{
  254. //"Authorization": userinfo.token
  255. },
  256. success: (res) => {
  257. let group = JSON.parse(res.data);
  258. var l = that.annexList.length;
  259. var temp = that.annexList;
  260. temp.push(group.data);
  261. that.annexList=temp;
  262. }
  263. });
  264. }
  265. });
  266. },
  267. callPhone(telphone,user){
  268. var that = this;
  269. uni.showModal({
  270. title: that.$t('api.message'),
  271. content:that.$t('api.nqdbddh'),
  272. confirmText:that.$t('index.queren'),
  273. cancelText:that.$t('index.quxiao'),
  274. success: function (res) {
  275. if (res.confirm) { //这里是点击了确定以后
  276. console.log('打电话')
  277. plus.device.dial(telphone, false );
  278. } else { //这里是点击了取消以后
  279. console.log('点击取消')
  280. }
  281. }
  282. })
  283. },
  284. async setorderuzt(rId,state){
  285. var that = this;
  286. var data;
  287. if(state==3){
  288. data={
  289. id:rId,
  290. state:state,
  291. qsId:this.qsId
  292. }
  293. }
  294. else{
  295. data={
  296. id:rId,
  297. state:state,
  298. qsId:this.qsId,
  299. diningStatus:1
  300. }
  301. }
  302. await this.$http.post(`${setorderuzt}`,data,true)
  303. .then(async r => {
  304. console.log(r);
  305. this.$emit('ErefleshList');
  306. })
  307. .catch(err => {
  308. console.log(err)
  309. })
  310. },
  311. gotoNav(store){
  312. this.lat = store.latitude;
  313. this.lon = store.longitude;
  314. this.addrName = store.posName;
  315. this.$refs.popNav.open('center');
  316. return;
  317. var navData={
  318. latitude:store.latitude,
  319. longitude:store.longitude,
  320. address:store.posName
  321. }
  322. var temp = JSON.stringify(navData);
  323. uni.navigateTo({
  324. url:'/pages/map/mapboxView?navdata='+temp
  325. })
  326. },
  327. NavOpen(){
  328. this.$refs.popNav.close();
  329. },
  330. },
  331. }
  332. </script>
  333. <style lang="scss">
  334. @import '@/common/common.scss';
  335. @font-face {
  336. font-family: zrht;
  337. src: url('/uni_modules/font/zrht.otf');
  338. }
  339. .itemV{
  340. margin-top: 16rpx;
  341. background-color: white;
  342. }
  343. .psfnote{
  344. width: 92%;
  345. margin-left: 4%;
  346. margin-top: 5rpx;
  347. border-radius: 10rpx;
  348. background-color: crimson;
  349. }
  350. .spIcon{
  351. width: 90rpx;
  352. height: 90rpx;
  353. }
  354. .kouweisku{
  355. color:chocolate;
  356. padding-right: 12rpx;
  357. font-size: 28rpx;
  358. }
  359. .qiangdImg{
  360. width: 120rpx;
  361. height: 120rpx;
  362. }
  363. .quhuodian{
  364. font-size: 26rpx;
  365. padding: 8rpx;
  366. color: royalblue;
  367. border-radius: 16rpx;
  368. border: solid royalblue;
  369. }
  370. .shouhuodian{
  371. font-size: 26rpx;
  372. padding: 8rpx;
  373. color: crimson;
  374. border-radius: 16rpx;
  375. border: solid crimson;
  376. }
  377. .lineimag{
  378. display: flex;
  379. flex-direction: column;
  380. justify-content: space-between;
  381. margin-left: 45rpx;
  382. width: 4rpx;
  383. background-color: lightgray;
  384. height: 100rpx;
  385. margin-top: 4rpx;
  386. margin-bottom: 4rpx;
  387. }
  388. .yuandian{
  389. width: 16rpx;
  390. height: 16rpx;
  391. background-color: lightgray;
  392. border-radius: 8rpx;
  393. margin-left: -8rpx;
  394. }
  395. .timeText{
  396. font-size: 32rpx;
  397. color: #006AFF;
  398. padding-left: 20rpx;
  399. font-weight: bold;
  400. }
  401. .priceText{
  402. font-size: 30rpx;
  403. color: crimson;
  404. padding-right: 20rpx;
  405. text-align: right;
  406. }
  407. .titleText{
  408. font-size: 28rpx;
  409. /* font-family: zrht; */
  410. }
  411. .distenText{
  412. font-size: 26rpx;
  413. color: darkgray;
  414. }
  415. .addrText{
  416. font-size: 28rpx;
  417. color: dimgray;
  418. }
  419. .stateText{
  420. font-size: 28rpx;
  421. color: darkgray;
  422. margin-top: 6rpx;
  423. padding-left: 8rpx;
  424. padding-right: 8rpx;
  425. padding-top: 2rpx;
  426. padding-bottom: 2rpx;
  427. border: 2rpx solid darkgray;
  428. border-radius: 8rpx;
  429. }
  430. .noteText{
  431. margin-top: 16rpx;
  432. font-size: 28rpx;
  433. color: dimgray;
  434. padding: 8rpx;
  435. background-color: whitesmoke;
  436. border-radius: 8rpx;
  437. }
  438. .connectText{
  439. font-size: 28rpx;
  440. color: black;
  441. padding: 8rpx;
  442. border: solid darkgray;
  443. border-radius: 8rpx;
  444. }
  445. .setImg{
  446. width: 30rpx;
  447. height: 30rpx;
  448. }
  449. .setImgB{
  450. width: 40rpx;
  451. height: 40rpx;
  452. }
  453. .jiedanText{
  454. font-size: 24rpx;
  455. color: black;
  456. }
  457. .jiedanTextS{
  458. font-size: 20rpx;
  459. color: black;
  460. }
  461. .wanchengV{
  462. width: 80%;
  463. height: 68rpx;
  464. border-radius: 10rpx;
  465. margin-left: 10%;
  466. margin-top: 40rpx;
  467. margin-bottom: 20rpx;
  468. background-color: #006AFF;
  469. }
  470. .wanchengT{
  471. font-weight: bold;
  472. font-size: 30rpx;
  473. color: black;
  474. border-radius: 8rpx;
  475. padding: 6rpx;
  476. margin-right: 30rpx;
  477. }
  478. .jiedanBtdf{
  479. padding: 10rpx;
  480. color:white;
  481. background-color: #1A1A1A;
  482. border-radius: 8rpx;
  483. box-shadow: 0rpx 0rpx 2rpx 0rpx #1A1A1A;
  484. }
  485. .item_list{
  486. display: flex;
  487. flex-wrap: wrap;
  488. justify-content: flex-start;
  489. .item_content{
  490. width:180rpx;
  491. height:180rpx;
  492. margin: 10rpx;
  493. box-sizing: border-box;
  494. }
  495. }
  496. .upimagV{
  497. width: 180rpx;
  498. height:180rpx;
  499. }
  500. .actbttext{
  501. width: 50%;
  502. line-height: 66rpx;
  503. font-size: 28rpx;
  504. color: white;
  505. text-align: center;
  506. }
  507. </style>