info.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view class="main">
  3. <view v-if="user.type=='1'">
  4. <view class="one"> <text>{{info.zhStatus}}</text> </view>
  5. <view class="two">
  6. <view class="two_1">
  7. <image v-if="info.no&&info.no.source&&info.no.source.file.length>0" class="image"
  8. :src="info.no.source.file&&info.no.source.file.length>0?info.no.source.file[0].url:''">
  9. </image>
  10. <image v-else class="image"
  11. :src="config.logo_url&&config.logo_url.length>0?config.logo_url[0].url:''">
  12. </image>
  13. <text v-if="info.no.type=='0'">酒店民宿</text>
  14. <text v-else>景区门票</text>
  15. </view>
  16. <view class="two_2">
  17. <view class="left">
  18. <image v-if="info.no&&info.no.source&&info.no.source.file.length>0" class="image"
  19. :src="info.no.source.file&&info.no.source.file.length>0?info.no.source.file[0].url:''">
  20. </image>
  21. <image v-else class="image"
  22. :src="config.logo_url&&config.logo_url.length>0?config.logo_url[0].url:''">
  23. </image>
  24. </view>
  25. <view class="right">
  26. <view class="right_1">
  27. <view class="left">
  28. <view class="name textOver">{{info.source_name||'暂无'}}</view>
  29. <view class="other">{{info.zhType||'暂无'}}</view>
  30. <view class="other">{{info.zhPerson||'暂无'}}</view>
  31. </view>
  32. <view class="right">
  33. <view class="other">
  34. ¥{{info.no.source.money||'0'}}
  35. </view>
  36. <view class="other">
  37. ×{{info.no.num||'0'}}
  38. </view>
  39. </view>
  40. </view>
  41. <view class="right_2">
  42. 实付 ¥{{info.no.money||'0'}}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="thr">
  48. <view class="thr_1">优惠</view>
  49. <view class="other">商品总价:¥{{info.no.money||'0'}} <text>(共{{info.no.num||'0'}}件)</text> </view>
  50. <view class="other">优惠:¥{{info.no.discount||'0'}}</view>
  51. <view class="other">实付 ¥{{info.no.money||'0'}}</view>
  52. </view>
  53. <view class="four">
  54. <view class="four_1">订单信息</view>
  55. <view class="other">真实姓名:{{info.name||'暂无'}}</view>
  56. <view class="other">证件号码:{{info.card||'暂无'}}</view>
  57. <view class="other">手机号码:{{info.phone||'暂无'}}</view>
  58. <view class="other">购买日期:{{info.no.date||'暂无'}}</view>
  59. <view class="other">订单编号:{{info.no._id||'暂无'}}</view>
  60. <view class="other">下单时间:{{info.no.buy_time||'暂无'}}</view>
  61. </view>
  62. <view class="four">
  63. <view class="four_1">支付信息</view>
  64. <view class="other">支付时间:{{info.no.pay_time||'暂无'}}</view>
  65. <view class="other">交易快照:当发生交易纠纷时可作为交易凭证 ></view>
  66. <view class="other">支付数据:{{info.no.pay||'暂无'}}</view>
  67. </view>
  68. <view class="five" v-if="info.status=='1'">
  69. <button class="button" type="primary" size="mini" @tap="toOff()">确定核销</button>
  70. </view>
  71. </view>
  72. <view class="one" v-else>暂无权限核销券码</view>
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. id: '',
  80. config: {
  81. logo_url: []
  82. },
  83. user: {},
  84. info: {
  85. no: {
  86. source: {
  87. file: []
  88. }
  89. }
  90. },
  91. statusList: [],
  92. personList: [],
  93. typeList: [],
  94. }
  95. },
  96. onLoad: async function(e) {
  97. const that = this;
  98. that.$set(that, `id`, e && e.id || '');
  99. },
  100. onShow: function() {
  101. const that = this;
  102. that.searchToken();
  103. },
  104. methods: {
  105. searchConfig() {
  106. const that = this;
  107. try {
  108. const res = uni.getStorageSync('config');
  109. if (res) that.$set(that, `config`, res);
  110. } catch (e) {
  111. uni.showToast({
  112. title: err.errmsg,
  113. icon: 'error',
  114. duration: 2000
  115. });
  116. }
  117. },
  118. async searchToken() {
  119. const that = this;
  120. try {
  121. const res = uni.getStorageSync('token');
  122. if (res) {
  123. const arr = await that.$api(`/user/${res._id}`, 'GET', {})
  124. if (arr.errcode == '0') {
  125. that.$set(that, `user`, arr.data);
  126. if (arr.data.type == '1') {
  127. that.searchConfig();
  128. await that.searchOther();
  129. await that.search();
  130. }
  131. }
  132. } else {
  133. uni.navigateTo({
  134. url: `/pagesIndex/login/index`
  135. })
  136. }
  137. } catch (e) {
  138. uni.showToast({
  139. title: err.errmsg,
  140. icon: 'error',
  141. duration: 2000
  142. });
  143. }
  144. },
  145. async search() {
  146. const that = this;
  147. if (that.id) {
  148. const res = await that.$api(`/orderDetail/${that.id}`, 'GET', {})
  149. if (res.errcode == '0') {
  150. const status = that.statusList.find(i => i.value == res.data.status)
  151. if (status) res.data.zhStatus = status.label
  152. if (res.data && res.data.no && res.data.no.source && res.data.no.source.person) {
  153. const person = that.personList.find(i => i.value == res.data.no.source.person)
  154. if (person) res.data.zhPerson = person.label
  155. }
  156. if (res.data && res.data.no && res.data.no.source && res.data.no.source.type) {
  157. const type = that.typeList.find(i => i.value == res.data.no.source.type)
  158. if (type) res.data.zhType = type.label
  159. }
  160. res.data.phone = res.data.phone.replace(/^(\d{3})(\d{4})(\d{4})$/, "$1****$2")
  161. that.$set(that, `info`, res.data)
  162. } else {
  163. uni.showToast({
  164. title: res.errmsg,
  165. });
  166. }
  167. }
  168. },
  169. // 核销券码
  170. async toOff() {
  171. const that = this;
  172. uni.showModal({
  173. title: '提示',
  174. content: '确定核销券码吗?',
  175. success: async function(res) {
  176. if (res.confirm) {
  177. const res = await that.$api(`/orderDetail/${that.id}`, 'POST', {
  178. status: "2"
  179. })
  180. if (res.errcode == '0') {
  181. uni.showToast({
  182. title: `核销券码成功`,
  183. });
  184. that.search();
  185. } else {
  186. uni.showToast({
  187. title: res.errmsg,
  188. });
  189. }
  190. }
  191. }
  192. });
  193. },
  194. // 查询其他信息
  195. async searchOther() {
  196. const that = this;
  197. let res;
  198. // 查询类型
  199. res = await that.$api(`/dictData`, 'GET', {
  200. type: 'order_status',
  201. is_use: '0',
  202. })
  203. if (res.errcode == '0') that.$set(that, `statusList`, res.data);
  204. // 出游人群
  205. res = await that.$api(`/dictData`, 'GET', {
  206. type: 'ticket_person',
  207. is_use: '0',
  208. })
  209. if (res.errcode == '0') that.$set(that, `personList`, res.data);
  210. // 服务特色
  211. res = await that.$api(`/dictData`, 'GET', {
  212. type: 'ticket_type',
  213. is_use: '0',
  214. })
  215. if (res.errcode == '0') that.$set(that, `typeList`, res.data);
  216. },
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .main {
  222. display: flex;
  223. flex-direction: column;
  224. width: 100vw;
  225. height: 100vh;
  226. background-image: linear-gradient(to top, rgba(241, 241, 241, 1), rgba(135, 206, 250, 1), rgba(0, 122, 255, 1));
  227. .one {
  228. padding: 5vw;
  229. font-size: var(--font20Size);
  230. font-weight: bold;
  231. }
  232. .two {
  233. background-color: var(--mainColor);
  234. border-radius: 5px;
  235. margin: 2vw 2vw 0 2vw;
  236. padding: 2vw;
  237. .two_1 {
  238. display: flex;
  239. align-items: center;
  240. .image {
  241. width: 8vw;
  242. height: 8vw;
  243. border-radius: 8vw;
  244. }
  245. text {
  246. padding: 0 0 0 2vw;
  247. }
  248. }
  249. .two_2 {
  250. display: flex;
  251. justify-content: space-between;
  252. margin: 2vw 0 0 0;
  253. padding: 0 2vw;
  254. .left {
  255. width: 20vw;
  256. .image {
  257. width: 20vw;
  258. height: 20vw;
  259. border-radius: 1vw;
  260. }
  261. }
  262. .right {
  263. width: 65vw;
  264. margin: 0 0 0 2vw;
  265. .right_1 {
  266. display: flex;
  267. justify-content: space-between;
  268. .left {
  269. width: 55vw;
  270. .name {
  271. font-size: var(--font14Size);
  272. }
  273. .other {
  274. padding: 2px 0 0 0;
  275. font-size: var(--font12Size);
  276. color: var(--f85Color);
  277. }
  278. }
  279. .right {
  280. width: 10vw;
  281. text-align: right;
  282. .other {
  283. padding: 2px 0 0 0;
  284. font-size: var(--font12Size);
  285. color: var(--f85Color);
  286. }
  287. }
  288. }
  289. .right_2 {
  290. text-align: right;
  291. font-size: var(--font12Size);
  292. }
  293. }
  294. }
  295. }
  296. .thr {
  297. background-color: var(--mainColor);
  298. border-radius: 5px;
  299. margin: 2vw 2vw 0 2vw;
  300. padding: 2vw;
  301. .thr_1 {
  302. font-size: var(--font14Size);
  303. font-weight: bold;
  304. margin: 1vw 0;
  305. }
  306. .other {
  307. padding: 2px 0 0 0;
  308. font-size: var(--font12Size);
  309. color: var(--f85Color);
  310. }
  311. }
  312. .four {
  313. background-color: var(--mainColor);
  314. border-radius: 5px;
  315. margin: 2vw 2vw 0 2vw;
  316. padding: 2vw;
  317. .four_1 {
  318. font-size: var(--font14Size);
  319. font-weight: bold;
  320. margin: 1vw 0;
  321. }
  322. .other {
  323. padding: 2px 0 0 0;
  324. font-size: var(--font12Size);
  325. color: var(--f85Color);
  326. }
  327. }
  328. .five {
  329. margin: 2vw 2vw 0 2vw;
  330. text-align: center;
  331. .button {
  332. margin: 2vw 0 0 0;
  333. background-color: var(--f3CColor);
  334. color: var(--mainColor);
  335. font-size: var(--font14Size);
  336. }
  337. }
  338. }
  339. </style>