receipt.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view>
  3. <view class="order_info" >
  4. <view class="order_title" >
  5. <view class="business_name">{{orderInfo.business_name}}</view>
  6. </view>
  7. <view class="product_list" >
  8. <view class="product_item" v-for="(product_info,k) in orderInfo.product_list" :key="k" >
  9. <image class="product_img" :src="product_info.product_thumb" mode=""></image>
  10. <view class="product_info">
  11. <view class="product_name">
  12. <text v-if="product_info.is_rebate">【赠】</text> {{product_info.product_name}}
  13. </view>
  14. <view class="product_spec">
  15. {{product_info.product_spec}}
  16. </view>
  17. </view>
  18. <view class="buy_num">
  19. x{{product_info.buy_num}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="upload_box">
  25. <view class="image_box" @click="chooseImage()">
  26. <image class="upload_image" :src="localImage" v-if="localImage"></image>
  27. <text class="upload_text" v-if="!localImage" >请点此处上传图片</text>
  28. </view>
  29. </view>
  30. <view class="info_alter">
  31. <view class="">
  32. 请谨慎上传回执,上传后无法修改
  33. </view>
  34. <view class="">
  35. 上传后有机会获得积分
  36. </view>
  37. </view>
  38. <view class="btn_box">
  39. <button class="upload_btn" v-if="localImage" @click="toApply()">提交</button>
  40. <button class="upload_btn disable" v-if="!localImage">提交</button>
  41. </view>
  42. <uni-popup ref="sharePopup" type="center" :mask-click="false">
  43. <view class="share_info">
  44. <view class="state_icon">
  45. <uni-icons type="checkbox" color="#07C160"></uni-icons>
  46. </view>
  47. <view class="state_text">图片上传成功</view>
  48. <button class="share_btn" open-type="share">
  49. <uni-icons type="weixin" color="#FFFFFF"></uni-icons>
  50. <text>立即分享到微信群</text>
  51. </button>
  52. <view class="info_text">工作人员审核通过后将发放积分</view>
  53. </view>
  54. </uni-popup>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. order_id:0,
  62. localImage:"",
  63. orderInfo:{},
  64. shareInfo:{
  65. title: "我已经完成一笔订单,你也快来吧",
  66. path: '/pages/index/index',
  67. imageUrl:"",
  68. }
  69. }
  70. },
  71. onLoad(param){
  72. this.order_id = param.order_id;
  73. },
  74. onShow() {
  75. // 登录提示
  76. if( !this.$checkAccess.alterLogin() ) return ;
  77. // 判断订单ID
  78. if( this.order_id <= 0 ) {
  79. uni.showModal({
  80. content:"未知的活动ID",
  81. showCancel:false,
  82. })
  83. return ;
  84. }
  85. // 没有数据的话,或者请求中,不允许刷新
  86. if( this.isReqing ) return ;
  87. // 设置请求中
  88. this.isReqing = true;
  89. // 请求列表
  90. this.$http.request('api/orders/get_item',{id:this.order_id}).then((re)=>{
  91. // 设置非请求中
  92. this.isReqing = false;
  93. // 成功结果
  94. if( re.code == 'success' ){
  95. this.orderInfo = re.data;
  96. }else{
  97. if( re.code != 'no_login' ){
  98. uni.showModal({
  99. content:re.msg,
  100. showCancel:false,
  101. })
  102. }
  103. }
  104. });
  105. },
  106. onShareAppMessage(obj) {
  107. return this.shareInfo;
  108. },
  109. methods: {
  110. chooseImage(){
  111. uni.chooseImage({
  112. count: 1, // 默认9,设置图片的数量
  113. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
  114. sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  115. success: (chooseImageRes) => {
  116. let tempFilePaths = chooseImageRes.tempFilePaths;
  117. this.localImage = tempFilePaths[0];
  118. },
  119. })
  120. },
  121. toApply(){
  122. // 判断订单ID
  123. if( this.order_id <= 0 ) {
  124. uni.showModal({
  125. content:"未知的活动ID",
  126. showCancel:false,
  127. })
  128. return ;
  129. }
  130. // 判断订单ID
  131. if( !this.localImage ) {
  132. uni.showModal({
  133. content:"请上传图片",
  134. showCancel:false,
  135. })
  136. return ;
  137. }
  138. // 没有数据的话,或者请求中,不允许刷新
  139. if( this.isReqing ) return ;
  140. // 请求中
  141. uni.showLoading();
  142. // 设置请求中
  143. this.isReqing = true;
  144. // 请求列表
  145. this.$http.fileupload('api/orders_receipt/apply',this.localImage,{order_id:this.order_id}).then((re)=>{
  146. // 设置非请求中
  147. uni.hideLoading();
  148. // 成功结果
  149. if( re.code == 'success' ){
  150. // 赋值
  151. this.shareInfo = re.data.share_info;
  152. // 弹出提示
  153. this.$refs.sharePopup.open('center');
  154. }else{
  155. if( re.code != 'no_login' ){
  156. // 设置请求中
  157. this.isReqing = false;
  158. // 允许请求
  159. uni.showModal({
  160. content:re.msg,
  161. showCancel:false,
  162. })
  163. }
  164. }
  165. });
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="less">
  171. .order_info{
  172. display: block;
  173. background: #FFFFFF;
  174. margin: 0rpx auto;
  175. padding: 0rpx 35rpx;
  176. margin-bottom: 10rpx;
  177. .order_title{
  178. width: 100%;
  179. height: 60rpx;
  180. display: block;
  181. overflow: hidden;
  182. line-height: 60rpx;
  183. .business_name{
  184. float: left;
  185. font-size: 32rpx;
  186. }
  187. .order_status{
  188. float: right;
  189. color: #999999;
  190. font-size: 24rpx;
  191. }
  192. }
  193. .product_list{
  194. display: block;
  195. overflow: hidden;
  196. margin: 15rpx auto;
  197. .product_item{
  198. display: block;
  199. height: 100rpx;
  200. overflow: hidden;
  201. .product_img{
  202. float: left;
  203. width: 80rpx;
  204. height: 80rpx;
  205. display: block;
  206. margin-top: 10rpx;
  207. margin-right: 30rpx;
  208. }
  209. .product_info{
  210. float: left;
  211. width: 480rpx;
  212. height: 100rpx;
  213. display: block;
  214. overflow: hidden;
  215. .product_name{
  216. display: block;
  217. height: 60rpx;
  218. display: block;
  219. font-size: 28rpx;
  220. line-height: 60rpx;
  221. overflow: hidden;
  222. }
  223. .product_spec{
  224. color: #999999;
  225. height: 40rpx;
  226. display: block;
  227. font-size: 24rpx;
  228. line-height: 40rpx;
  229. overflow: hidden;
  230. }
  231. }
  232. .buy_num{
  233. float: right;
  234. height: 100rpx;
  235. color: #999999;
  236. font-size: 26rpx;
  237. text-align: right;
  238. position: relative;
  239. line-height: 100rpx;
  240. }
  241. }
  242. }
  243. .product_list.active{
  244. height: auto !important;
  245. }
  246. }
  247. .upload_box{
  248. display: block;
  249. width: 750rpx;
  250. height: 410rpx;
  251. margin-top: 20rpx;
  252. text-align: center;
  253. padding: 20rpx 0rpx;
  254. background-color: #FFFFFF;
  255. .image_box{
  256. width: 400rpx;
  257. height: 400rpx;
  258. display: block;
  259. color: #999999;
  260. font-size: 28rpx;
  261. margin: 0rpx auto;
  262. line-height: 400rpx;
  263. border: 2rpx solid #999999;
  264. .upload_image{
  265. width: 400rpx;
  266. height: 400rpx;
  267. }
  268. }
  269. }
  270. .info_alter{
  271. // color: #E03519;
  272. display: block;
  273. font-size: 26rpx;
  274. overflow: hidden;
  275. line-height: 60rpx;
  276. text-align: center;
  277. margin: 0rpx auto;
  278. background-color: #FFFFFF;
  279. }
  280. .btn_box{
  281. display: block;
  282. overflow: hidden;
  283. margin: 20rpx auto;
  284. .upload_btn{
  285. color: #FFFFFF;
  286. display: block;
  287. width: 680rpx;
  288. height: 80rpx;
  289. margin: 0 auto;
  290. font-size: 28rpx;
  291. line-height: 80rpx;
  292. padding: 0rpx 0rpx;
  293. border-radius: 10rpx;
  294. background-color: #07C160;
  295. }
  296. .upload_btn.disable{
  297. background-color: #999999;
  298. }
  299. .upload_btn::after{
  300. border: none;
  301. }
  302. }
  303. .share_info{
  304. width: 600rpx;
  305. height: 600rpx;
  306. background-color: #FFFFFF;
  307. .state_icon{
  308. width: 240rpx;
  309. height: 240rpx;
  310. display: block;
  311. margin: 20rpx auto;
  312. text-align: center;
  313. font-size: 240rpx !important;
  314. .uni-icons{
  315. font-size: 240rpx !important;
  316. }
  317. }
  318. .state_text{
  319. height: 80rpx;
  320. display: block;
  321. font-size: 32rpx;
  322. margin: 20rpx auto;
  323. line-height: 80rpx;
  324. text-align: center;
  325. }
  326. .share_btn{
  327. color: #FFFFFF;
  328. display: block;
  329. width: 560rpx;
  330. height: 80rpx;
  331. font-size: 30rpx;
  332. margin: 20rpx auto;
  333. line-height: 80rpx;
  334. padding: 0rpx 0rpx;
  335. border-radius: 10rpx;
  336. background-color: #07C160;
  337. .uni-icons{
  338. margin-right: 20rpx;
  339. font-size: 36rpx !important;
  340. }
  341. }
  342. .info_text{
  343. height: 60rpx;
  344. display: block;
  345. font-size: 26rpx;
  346. margin-top: 20rpx;
  347. line-height: 60rpx;
  348. text-align: center;
  349. }
  350. }
  351. </style>