orderItemA.vue 13 KB

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