info.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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.coupon_money||'0'}}</view>
  51. <view class="other">实付:¥{{info.total_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. source: {
  91. file: []
  92. }
  93. },
  94. statusList: [],
  95. personList: [],
  96. typeList: [],
  97. }
  98. },
  99. onLoad: async function(e) {
  100. const that = this;
  101. that.$set(that, `id`, e && e.id || '');
  102. },
  103. onShow: function() {
  104. const that = this;
  105. that.searchToken();
  106. },
  107. methods: {
  108. searchConfig() {
  109. const that = this;
  110. try {
  111. const res = uni.getStorageSync('config');
  112. if (res) that.$set(that, `config`, res);
  113. } catch (e) {
  114. uni.showToast({
  115. title: err.errmsg,
  116. icon: 'error',
  117. duration: 2000
  118. });
  119. }
  120. },
  121. async searchToken() {
  122. const that = this;
  123. try {
  124. const res = uni.getStorageSync('token');
  125. if (res) {
  126. const arr = await that.$api(`/user/${res._id}`, 'GET', {})
  127. if (arr.errcode == '0') {
  128. that.$set(that, `user`, arr.data);
  129. if (arr.data.type == '1') {
  130. that.searchConfig();
  131. await that.searchOther();
  132. await that.search();
  133. }
  134. }
  135. } else {
  136. uni.navigateTo({
  137. url: `/pagesIndex/login/index`
  138. })
  139. }
  140. } catch (e) {
  141. uni.showToast({
  142. title: err.errmsg,
  143. icon: 'error',
  144. duration: 2000
  145. });
  146. }
  147. },
  148. async search() {
  149. const that = this;
  150. if (that.id) {
  151. const res = await that.$api(`/order/${that.id}`, 'GET', {})
  152. if (res.errcode == '0') {
  153. const status = that.statusList.find(i => i.value == res.data.status)
  154. if (status) res.data.zhStatus = status.label
  155. if (res.data && res.data.source && res.data.source.person) {
  156. const person = that.personList.find(i => i.value == res.data.source.person)
  157. if (person) res.data.zhPerson = person.label
  158. }
  159. if (res.data && res.data.source && res.data.source.type) {
  160. const type = that.typeList.find(i => i.value == res.data.source.type)
  161. if (type) res.data.zhType = type.label
  162. }
  163. that.$set(that, `info`, res.data)
  164. } else {
  165. uni.showToast({
  166. title: res.errmsg,
  167. });
  168. }
  169. }
  170. },
  171. // 整理电话号
  172. getProps(phone) {
  173. if (!phone) return '暂无';
  174. return phone.replace(/^(\d{3})(\d{4})(\d{4})$/, '$1****$2');
  175. },
  176. // 核销券码
  177. async toOff() {
  178. const that = this;
  179. uni.showModal({
  180. title: '提示',
  181. content: '确定核销券码吗?',
  182. success: async function(res) {
  183. if (res.confirm) {
  184. const res = await that.$api(`/order/${that.id}`, 'POST', {
  185. status: "2"
  186. })
  187. if (res.errcode == '0') {
  188. uni.showToast({
  189. title: `核销券码成功`,
  190. });
  191. that.search();
  192. } else {
  193. uni.showToast({
  194. title: res.errmsg,
  195. });
  196. }
  197. }
  198. }
  199. });
  200. },
  201. // 查询其他信息
  202. async searchOther() {
  203. const that = this;
  204. let res;
  205. // 查询类型
  206. res = await that.$api(`/dictData`, 'GET', {
  207. type: 'order_status',
  208. is_use: '0',
  209. })
  210. if (res.errcode == '0') that.$set(that, `statusList`, res.data);
  211. // 出游人群
  212. res = await that.$api(`/dictData`, 'GET', {
  213. type: 'ticket_person',
  214. is_use: '0',
  215. })
  216. if (res.errcode == '0') that.$set(that, `personList`, res.data);
  217. // 服务特色
  218. res = await that.$api(`/dictData`, 'GET', {
  219. type: 'ticket_type',
  220. is_use: '0',
  221. })
  222. if (res.errcode == '0') that.$set(that, `typeList`, res.data);
  223. },
  224. }
  225. }
  226. </script>
  227. <style lang="scss" scoped>
  228. .main {
  229. display: flex;
  230. flex-direction: column;
  231. background-image: linear-gradient(to top, rgba(241, 241, 241, 1), rgba(135, 206, 250, 1), rgba(0, 122, 255, 1));
  232. .one {
  233. padding: 5vw;
  234. font-size: var(--font20Size);
  235. font-weight: bold;
  236. }
  237. .two {
  238. background-color: var(--mainColor);
  239. border-radius: 5px;
  240. margin: 2vw 2vw 0 2vw;
  241. padding: 2vw;
  242. .two_1 {
  243. display: flex;
  244. align-items: center;
  245. .image {
  246. width: 8vw;
  247. height: 8vw;
  248. border-radius: 8vw;
  249. }
  250. text {
  251. padding: 0 0 0 2vw;
  252. }
  253. }
  254. .two_2 {
  255. display: flex;
  256. justify-content: space-between;
  257. margin: 2vw 0 0 0;
  258. padding: 0 2vw;
  259. .left {
  260. width: 20vw;
  261. .image {
  262. width: 20vw;
  263. height: 20vw;
  264. border-radius: 1vw;
  265. }
  266. }
  267. .right {
  268. width: 65vw;
  269. margin: 0 0 0 2vw;
  270. .right_1 {
  271. display: flex;
  272. justify-content: space-between;
  273. .left {
  274. width: 55vw;
  275. .name {
  276. font-size: var(--font14Size);
  277. }
  278. .other {
  279. padding: 2px 0 0 0;
  280. font-size: var(--font12Size);
  281. color: var(--f85Color);
  282. }
  283. }
  284. .right {
  285. width: 10vw;
  286. text-align: right;
  287. .other {
  288. padding: 2px 0 0 0;
  289. font-size: var(--font12Size);
  290. color: var(--f85Color);
  291. }
  292. }
  293. }
  294. .right_2 {
  295. text-align: right;
  296. font-size: var(--font12Size);
  297. }
  298. }
  299. }
  300. }
  301. .thr {
  302. background-color: var(--mainColor);
  303. border-radius: 5px;
  304. margin: 2vw 2vw 0 2vw;
  305. padding: 2vw;
  306. .thr_1 {
  307. font-size: var(--font14Size);
  308. font-weight: bold;
  309. margin: 1vw 0;
  310. }
  311. .other {
  312. padding: 2px 0 0 0;
  313. font-size: var(--font12Size);
  314. color: var(--f85Color);
  315. }
  316. }
  317. .four {
  318. background-color: var(--mainColor);
  319. border-radius: 5px;
  320. margin: 2vw 2vw 0 2vw;
  321. padding: 2vw;
  322. .four_1 {
  323. font-size: var(--font14Size);
  324. font-weight: bold;
  325. margin: 1vw 0;
  326. }
  327. .list {
  328. border: 1px solid #d5d5da;
  329. border-radius: 5px;
  330. margin: 2vw 0 0 0;
  331. padding: 2vw;
  332. }
  333. .other {
  334. padding: 2px 0 0 0;
  335. font-size: var(--font12Size);
  336. color: var(--f85Color);
  337. }
  338. }
  339. .five {
  340. margin: 2vw 2vw 0 2vw;
  341. text-align: center;
  342. .button {
  343. margin: 2vw 0 0 0;
  344. background-color: var(--f3CColor);
  345. color: var(--mainColor);
  346. font-size: var(--font14Size);
  347. }
  348. }
  349. }
  350. </style>