自主产品,供应链食堂系统。将两个端拆开了。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

243 lines
6.1 KiB

5 years ago
  1. <template>
  2. <view>
  3. <view class="head">
  4. <view class="lf-row-between list">
  5. <view>批次号</view>
  6. <view class="lf-color-black">{{ order.batch_sn }}</view>
  7. </view>
  8. <view class="lf-row-between list">
  9. <view>订单编号</view>
  10. <view class="lf-color-black">{{ order.q_sn }}</view>
  11. </view>
  12. <view class="lf-row-between list">
  13. <view>订单状态</view>
  14. <view :class="stateClass(order.state)">{{ order.state }}</view>
  15. </view>
  16. <view class="lf-row-between list">
  17. <view>报价商</view>
  18. <view class="lf-color-black">{{ order.q_name }}</view>
  19. </view>
  20. <view class="lf-row-between list">
  21. <view>关联食堂</view>
  22. <view class="lf-color-black">{{ (order.canteen && order.canteen.canteen_name) || '' }}</view>
  23. </view>
  24. <view class="lf-row-between list">
  25. <view>创建时间</view>
  26. <view class="lf-color-black">{{ order.created_at }}</view>
  27. </view>
  28. <view class="lf-row-between list">
  29. <view>过期时间</view>
  30. <view class="lf-color-black">{{ order.deadline_text }}</view>
  31. </view>
  32. </view>
  33. <self-line></self-line>
  34. <view class="lf-m-t-30 lf-m-l-32 lf-m-r-32">
  35. <view class="lf-font-32 lf-color-black lf-font-bold lf-m-b-20">报价明细</view>
  36. <wyb-table :headers="headers" :contents="contents" :first-line-fixed="true" contentBgColor="#eef6fe" width="max-content" height="80vh"></wyb-table>
  37. </view>
  38. <view style="height: 140rpx;"></view>
  39. <!-- 操作按钮 -->
  40. <view class="fixed-bottom" v-if="$isRight(order) && type != 0">
  41. <view v-if="type == 1" class="lf-row-flex-end">
  42. <button class="btn btn2" style="background-color: #FF0000;" @click="orderStateChange('待发起')">撤销订单</button>
  43. </view>
  44. <view v-if="type == 2" class="lf-row-flex-end">
  45. <button class="btn btn1" @click="$url('/pages/offer/index?type=1&code='+ order.q_sn)">编辑</button>
  46. <button class="btn btn2" @click="orderStateChange('待审核')">发起报价</button>
  47. </view>
  48. <view v-if="type == 3 || type == 4" class="lf-row-between">
  49. <button class="btn btn1" @click="$url('/pages/offer/index?type=2&code='+ order.q_sn)">复用报价单</button>
  50. <button class="btn btn1" @click="$url('/pages/offer/index?type=3&code='+ order.batch_sn)">复用本批次</button>
  51. <view class="lf-font-32" style="color: #11D189;" v-if="type == 3">报价已通过</view>
  52. <view class="lf-font-32" style="color: #FF0000;" v-if="type == 4">报价已被拒绝</view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import wybTable from '@/components/wyb-table/wyb-table';
  59. export default {
  60. components: { wybTable },
  61. data(){
  62. return {
  63. type: 0,
  64. order: {},
  65. headers: [{
  66. label: '物资名称',
  67. key: 'name'
  68. },{
  69. label: '规格',
  70. key: 'spec'
  71. },{
  72. label: '品牌',
  73. key: 'brand'
  74. },{
  75. label: '品级',
  76. key: 'quality_level'
  77. },{
  78. label: '编号',
  79. key: 'number'
  80. },{
  81. label: '起购数',
  82. key: 'purchase_limit'
  83. },{
  84. label: '含税价',
  85. key: 'tax_price'
  86. },{
  87. label: '非含税价',
  88. key: 'non_tax_price'
  89. }],
  90. contents: [],
  91. q_sn: '', // 订单号
  92. show_count: 0
  93. }
  94. },
  95. computed: {
  96. stateClass(){
  97. return function(val){
  98. let class_name = {
  99. '已通过': 'passed',
  100. '待发起': 'wait',
  101. '待审核': 'quoted-price',
  102. '未通过': 'refuse'
  103. }
  104. return class_name[val];
  105. }
  106. }
  107. },
  108. onLoad(options){
  109. this.q_sn = options.q_sn;
  110. this.getDetail();
  111. },
  112. onShow(options){
  113. this.show_count++;
  114. if(this.show_count > 1){
  115. this.getDetail();
  116. }
  117. },
  118. methods: {
  119. stateType(val){
  120. let type = 0;
  121. switch(val){
  122. case '待审核': type = 1; break;
  123. case '待发起': type = 2; break;
  124. case '已通过': type = 3; break;
  125. case '未通过': type = 4; break;
  126. }
  127. this.type = type;
  128. },
  129. getDetail(){
  130. this.$http(this.API.API_SUPPLIER_QUOTATIONDETAIL, {
  131. q_sn: this.q_sn
  132. }).then(res => {
  133. console.log("getDetail", res);
  134. this.stateType(res.data.order.state);
  135. this.order = res.data.order || {};
  136. let list = res.data.order.item || [];
  137. let contents = list.map(item => {
  138. let obj = {
  139. name: item.material?.m_name || '',
  140. material_id: item.material?.id,
  141. spec: item.spec?.name || '',
  142. spec_id: item.spec?.id,
  143. brand: item?.material?.brand || '',
  144. quality_level: item?.material?.quality_level || '',
  145. number: item?.material?.m_sn || '',
  146. tax_price: item.tax_price,
  147. non_tax_price: item.non_tax_price,
  148. purchase_limit: item.purchase_limit
  149. }
  150. return obj;
  151. });
  152. this.contents = contents;
  153. }).catch(err => {
  154. this.$toBack();
  155. })
  156. },
  157. // 改变订单状态
  158. orderStateChange(state){
  159. this.$http(this.API.API_SUPPLIER_QUOTATIONUPDATE, {
  160. q_sn: this.q_sn,
  161. state: state
  162. }).then(res => {
  163. console.log("revokeOrder", res);
  164. this.$msg('操作成功');
  165. this.getDetail(); // 更新当前页面数据
  166. })
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped="scoped">
  172. .head{
  173. padding: 0 32rpx;
  174. width: 750rpx;
  175. box-sizing: border-box;
  176. height: auto;
  177. .list{
  178. padding: 30rpx 0;
  179. border-bottom: 1rpx solid #e5e5e5;
  180. font-size: 28rpx;
  181. color: #555555;
  182. &:last-child{
  183. border-bottom: none;
  184. }
  185. }
  186. }
  187. .fixed-bottom{
  188. position: fixed;
  189. bottom: 0rpx;
  190. left: 0rpx;
  191. z-index: 99;
  192. width: 750rpx;
  193. height: 98rpx;
  194. display: flex;
  195. // justify-content: flex-end;
  196. align-items: center;
  197. border-top: 1rpx solid #E5E5E5;
  198. background-color: #FFFFFF;
  199. box-sizing: border-box;
  200. padding: 0 32rpx;
  201. .btn{
  202. width: 212rpx;
  203. height: 82rpx;
  204. border-radius: 41rpx;
  205. margin: 0;
  206. padding: 0;
  207. font-size: 32rpx;
  208. display: flex;
  209. justify-content: center;
  210. align-items: center;
  211. }
  212. .btn1{
  213. border: 2rpx solid #555555;
  214. opacity: .5;
  215. }
  216. .btn2{
  217. background: #1833F2;
  218. color: #FFFFFF;
  219. margin-left: 20rpx;
  220. }
  221. }
  222. .fixed-bottom>view{
  223. width: 100%;
  224. }
  225. // 已报价,等待审核
  226. .quoted-price{
  227. color: #777777;
  228. }
  229. // 等待报价
  230. .wait{
  231. color: #1833F2;
  232. }
  233. // 已通过审核
  234. .passed{
  235. color: #0BCE5F;
  236. }
  237. // 报价被拒绝
  238. .refuse{
  239. color: #FF0000;
  240. }
  241. </style>