info.vue 9.2 KB

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