Order.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div class="toBuy-wrap">
  3. <div class="baseInfo-wrap">
  4. <img :src="coverImg" />
  5. <div>
  6. <h5>{{title}}</h5>
  7. <p>{{produce}}</p>
  8. <span>{{price}}</span>
  9. </div>
  10. </div>
  11. <div class="flow-wrap">
  12. <el-steps :active="active" finish-status="success">
  13. <el-step title="订单选择"></el-step>
  14. <el-step title="确认支付"></el-step>
  15. <el-step title="订单完成"></el-step>
  16. </el-steps>
  17. <div class="flow-content orderCompletion">
  18. <el-button class="confrimBtn price" @click="toShow" v-show="active==2">立即评价</el-button>
  19. <qrcode
  20. :value="value"
  21. :options="{ size: 170 }">
  22. </qrcode>
  23. <p>可扫描二维码,查看订单详情</p>
  24. </div>
  25. </div>
  26. <el-dialog title="我的评价" :visible.sync="dialogTableVisible" :show-close="false">
  27. <div class="dialogheader">
  28. <el-form label-position="right" label-width="80px">
  29. <el-form-item label="评价内容">
  30. <el-input type="textarea" v-model="evaluate"></el-input>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button type="primary" @click="toSubmitEvaluation">提交</el-button>
  34. <el-button @click="toCancel">取消</el-button>
  35. </el-form-item>
  36. </el-form>
  37. </div>
  38. </el-dialog>
  39. </div>
  40. </template>
  41. <script>
  42. import QRcode from '@xkeshi/vue-qrcode'
  43. export default{
  44. data(){
  45. return{
  46. active: 0,
  47. dialogTableVisible:false,
  48. evaluate:"",
  49. value: '',
  50. coverImg:"",
  51. title:"",
  52. produce:"",
  53. price:"",
  54. madeTags:[],
  55. }
  56. },
  57. components:{
  58. qrcode:QRcode,
  59. },
  60. mounted(){
  61. this.getGoodMess();
  62. },
  63. methods:{
  64. getGoodMess(){
  65. this.axios.post(this.Api.getOrderMess,{buyerId:this.$store.state.userMess.id,id:this.$route.query.id}).then((res)=>{
  66. console.log(res.data)
  67. if(res.data.code==200){
  68. this.coverImg=res.data.res.coverImg;
  69. this.title=res.data.res.title;
  70. this.produce=res.data.res.produce;
  71. this.price=res.data.res.price;
  72. this.evaluate=res.data.res.evaluate;
  73. this.madeTags=res.data.res.madeTags;
  74. console.log(this.evaluate)
  75. if(this.evaluate==""){
  76. this.active=2;
  77. }else{
  78. this.active=3;
  79. }
  80. //this.value="商品名称:"+this.title+";";
  81. let num=0;
  82. for(var i=0,length=this.madeTags.length;i<length;i++){
  83. // this.value+=this.madeTags[i].type+":"+this.madeTags[i].item.name+";"
  84. // this.value+="价格:"+this.madeTags[i].item.price+"元;"
  85. num+=this.madeTags[i].item.price
  86. }
  87. this.value+="price:"+num+";"
  88. }
  89. }).catch((err)=>{
  90. console.log("getShopTagList:"+err);
  91. });
  92. },
  93. next() {
  94. if (this.active++ > 2) this.active = 0;
  95. },
  96. toCancel(){
  97. this.dialogTableVisible=false;
  98. this.evaluate="";
  99. },
  100. toShow(){
  101. this.dialogTableVisible=true;
  102. },
  103. toSubmitEvaluation(){
  104. if(this.evaluate==""){
  105. this.$message.error('请输入评价内容');
  106. return;
  107. }
  108. let param={
  109. buyerId:this.$store.state.userMess.id,
  110. shopId:this.$route.query.shopId,
  111. goodId:this.$route.query.goodId,
  112. id:this.$route.query.id,
  113. comment:this.evaluate
  114. }
  115. this.axios.post(this.Api.submitEvaluation,param).then((res)=>{
  116. console.log(res.data)
  117. if(res.data.code==200){
  118. this.next();
  119. this.toCancel();
  120. }
  121. }).catch((err)=>{
  122. console.log("toSubmitEvaluation:"+err);
  123. });
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped>
  129. .toBuy-wrap{
  130. width: 100%;
  131. padding: 0 20px;
  132. }
  133. .baseInfo-wrap{
  134. width: 100%;
  135. height: 300px;
  136. margin-top: 20px;
  137. background-color: #fff;
  138. border-left: 6px solid #3eb983;
  139. padding: 20px 20px 20px 13px;
  140. }
  141. .baseInfo-wrap img{
  142. display: block;
  143. float: left;
  144. width: 260px;
  145. height: 260px;
  146. }
  147. .baseInfo-wrap div{
  148. float: left;
  149. padding-left: 20px;
  150. text-align: left;
  151. width: calc(100% - 260px);
  152. }
  153. .baseInfo-wrap h5{
  154. font-size: 30px;
  155. margin-bottom: 10px;
  156. }
  157. .baseInfo-wrap p{
  158. font-size: 16px;
  159. color: #666;
  160. width: 100%;
  161. height: 100px;
  162. }
  163. .baseInfo-wrap span{
  164. font-size: 30px;
  165. color: #EA6A69;
  166. line-height: 65px;
  167. display: block;
  168. }
  169. .flow-wrap{
  170. width: 100%;
  171. height: auto;
  172. margin-top: 20px;
  173. background-color: #fff;
  174. padding: 20px;
  175. }
  176. .flow-content{
  177. width: 600px;
  178. margin: 40px auto 0;
  179. }
  180. .confrimBtn{
  181. background-color: #3eb983;
  182. border-color: #3eb983;
  183. color: #fff;
  184. padding: 10px 40px;
  185. }
  186. .price{
  187. display: block;
  188. margin: 20px auto;
  189. }
  190. .orderCompletion{
  191. text-align: center;
  192. }
  193. .orderCompletion img{
  194. width: 180px;
  195. }
  196. .orderCompletion p{
  197. color: #3eb983;
  198. font-size: 18px;
  199. line-height: 30px;
  200. }
  201. </style>
  202. <style>
  203. .toBuy-wrap .el-step__head{
  204. text-align: left;
  205. }
  206. .toBuy-wrap .el-step__head.is-success{
  207. color: #3eb983;
  208. border-color: #3eb983;
  209. }
  210. .toBuy-wrap .el-step__title.is-success{
  211. color: #3eb983;
  212. }
  213. </style>